close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Products Results page link only active when picture on detail page

Thread began 11/17/2015 9:22 am by Charles | Last modified 2/03/2016 10:27 am by Ray Borduin | 1749 views | 11 replies |

Charles

Products Results page link only active when picture on detail page

I'd like to create a PHP condition where the links i Have on the products__results page(the Thumb and Title) to the products_detail page are only active when there is a picture in the DB field('Big_Pic_Name') for the products_detail page. You can see the products_results at http://outofchaos.net/gsc/www/products_results.php?Category_ID=6&Search=1 and file is attached. Your help would be much appreciated.

Sign in to reply to this post

Ray BorduinWebAssist

You can just add an IF statement around the code you want conditionally added like:

php:
<?php if ($row_WADAproducts['Big_Pic_Name']) { ?>

<a href="products_detail.php?ID=<?php echo($row_WADAproducts['ID']); ?>
<?php 
?>
<?php 
echo(isset($_GET["pageNum_WADAproducts"])?"&pageNum_WADAproducts=".intval($_GET["pageNum_WADAproducts"]):""); ?>" >
<font color="#1c2372"><?php echo($row_WADAproducts['Product_Name']); ?></font>
<?php if ($row_WADAproducts['Big_Pic_Name']) { ?>
</a>
<?php ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

Thanks for having a go at this. Tried this code and it just deadens the Title link even if there is an entry in Big_Pic_Name. You can see this in the PM link below where the IF code has been inserted.

Sign in to reply to this post

Ray BorduinWebAssist

You would have to add that column to your SELECT statement above as well. Right now you aren't including the Big_Pic_Name column in the select statement.

Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

Closer - That helped as now the link is active when there is a Big_Pic_Name and it's dead when there is none. However, now when you click on an active Product Name/Title, I am getting this error 'You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'color=' at line 1.'
The code seems to be constructing the link now with extra characters - <font%20color= added to the link to make .../products_detail.php?ID=4<font%20color=
Tried several moves with the <font> piece of code but they all failed. Maybe you can see the syntax error. Latest products_results.php file and link attached.

Sign in to reply to this post

Ray BorduinWebAssist

You aren't closing your <a> tag properly. Update lines 367-369 from:

php:
<a href="products_detail.php?ID=<?php echo($row_WADAproducts['ID']); ?>

<?php 
?>
<?php 
echo(isset($_GET["pageNum_WADAproducts"])?"&pageNum_WADAproducts=".intval($_GET["pageNum_WADAproducts"]):""); ?>


to:

php:
<a href="products_detail.php?ID=<?php echo($row_WADAproducts['ID']); ?><?php echo(isset($_GET["pageNum_WADAproducts"])?"&pageNum_WADAproducts=".intval($_GET["pageNum_WADAproducts"]):""); ?>">

<?php ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

That worked and the Title/Name link works properly. So now I applied the IF code around the thumbnail pics for the link to be active when there is a Big_Pic_Name and is dead when there is no Big_Pic_Name, but I am getting some erratic results in how the thumbs display see links below. Can you see the syntax problem?
The new code is in the attached file lines 365 - 370

Sign in to reply to this post

Ray BorduinWebAssist

You have the same issue on the other link....
The code that begins on line 365:

php:
<?php if ($row_WADAproducts['Big_Pic_Name']) { ?>

                        <a href="products_detail.php?ID=<?php echo($row_WADAproducts['ID']); ?>
                        <?php ?>
                        <?php echo(isset($_GET["pageNum_WADAproducts"])?"&pageNum_WADAproducts=".intval($_GET["pageNum_WADAproducts"]):""); ?>" >


should be:

php:
<?php if ($row_WADAproducts['Big_Pic_Name']) { ?>

                        <a href="products_detail.php?ID=<?php echo($row_WADAproducts['ID']); ?><?php echo(isset($_GET["pageNum_WADAproducts"])?"&pageNum_WADAproducts=".intval($_GET["pageNum_WADAproducts"]):""); ?>" >
                        <?php ?>
Sign in to reply to this post
Did this help? Tips are appreciated...

Charles

That seems to have done it - works perfectly now. I just was having trouble seeing it. Thanks for the help.

Sign in to reply to this post

Charles

I am using the same code you suggested above on the products_detail page below to make the appearance of the Sold_by and 6 Spec fields conditional. It looks fine and works fine with one exception: if there is no data in the Sold-by field, the 'Sold BY does not appear - good, but the 6 Spec fields(even if the have data) do not appear.
Looking at the code, it looks like I need to close line 291 <?php if ($row_WADAproducts['Sold_by']) { ?>
<div class="WADADetailsShortDesc">Sold By: <?php echo($row_WADAproducts['Sold_by']); ?></div><?php } ?>
. . . with a <?php } ?> but when I do that I get a syntax error on line 310. Probably something small I'm just not seeing. I'm stuck. Please have a look. Any suggestions much appreciated.

Sign in to reply to this post
loading

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...