Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Click to Enlarge link to Product URL


bkellum

Recommended Posts

Hello all,

 

I have been searching all over for some ideas on how to make the "Click to Enlarge" text under the products image to link to the products url instead of opening the large image popup. Any Ideas on how to do this?

 

I have entered the Product URL in the Product listing so as it works on the product page where it says, "For more information, please visit this products webpage. Now I need to get this link (product webpage) to work when you click on the "Click to Enlarge" text.

 

The reason for this is that I have a photo slideshow for each product and do not want to use the large image popup, but would rather use the link from "Click to Enlarge" to send users to view the slideshow.

 

Make sense? I think I am close but I'm sure there is a way to use the data entered for the product url for each product and link to it from the "Click to Enlarge".

 

Thanks for any help you can provide.

 

Bill

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

In your catalog/product_info.php look for this code around line 109:

 

			  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAM
E_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAG
ES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_I
MAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE
. '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) .
'" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $produ
ct_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')
. '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
		  </td>

 

and replace with this:

<td class="main"><?php echo sprintf(TEXT_CLICK_TO_ENLARGE, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>

 

this is from around line 181 where it prints the More Information link. Only change is the TEXT_CLICK_TO_ENLARGE to keep that text, but of course you could make it say whatever you'd like.

Link to comment
Share on other sites

In your catalog/product_info.php look for this code around line 109:

 

<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAM
E_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAG
ES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_I
MAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE
. '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) .
'" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $produ
ct_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')
. '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>

 

and replace with this:

<td class="main"><?php echo sprintf(TEXT_CLICK_TO_ENLARGE, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>

 

this is from around line 181 where it prints the More Information link. Only change is the TEXT_CLICK_TO_ENLARGE to keep that text, but of course you could make it say whatever you'd like.

Thanks for your reply. I changed the above but now I have lost my product image and the "CLICK TO ENLARGE" text no longer links to anything. I can see where you were going with this but appears to be just a little off. I'm going to study your changes to see what needs to be tweaked to make this work. Thanks again, Bill Kellum

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

ah, looks like I got carried away, and replaced everything...not just the link.

 

try changing it this way:

 <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) . ''" target="_blank">' . tep_image(DIR_WS_IMAG
ES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_I
MAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE
. '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) .
'" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $produ
ct_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')
. '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>

it's only the tep_href_link's that really only need changed, removing the javascript part in the first section, and making both FILENAME_REDIRECT to $product_info['products_url'] rather than just opening FILENAME_POPUP_IMAGE

Link to comment
Share on other sites

ah, looks like I got carried away, and replaced everything...not just the link.

 

try changing it this way:

<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) . ''" target="_blank">' . tep_image(DIR_WS_IMAG
ES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_I
MAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE
. '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) .
'" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $produ
ct_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')
. '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>

 

Jeff, Thanks for the info. I replaced the original code with above and now I am getting the following error:

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/wwwrei9/public_html/eshop/product_info.php on line 109

 

I'm searching for errors in the code as we speak. Thanks, Bill Kellum

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

Jeff, Thanks for the info. I replaced the original code with above and now I am getting the following error:

 

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ',' or ';' in /home/wwwrei9/public_html/eshop/product_info.php on line 109

 

I'm searching for errors in the code as we speak. Thanks, Bill Kellum

Jeff,

 

I think I corrected the syntax error on line 109 (which started with "document write") by removing an extra ' after the code:

urlencode($product_info['products_url']), 'NONSSL', true, false) . ''"

I believe it should be

urlencode($product_info['products_url']), 'NONSSL', true, false) . '"

However, even after making this change, I am now getting a parse error on line 110, the line immediately after the above line.

<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) . '" target="_blank">' . tep_image(DIR_WS_IMAG
ES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_I
MAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE
. '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) .
'" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $produ
ct_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')
. '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>

Any clues?

 

Thanks for any help you can provide,

 

Bill Kellum

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

It seems the code is right. I popped this in a test store and it worked fine. But before I checked I made it one long line. I think maybe where it breaks is what's causing the parse error. In the script section make everything from document.write all the way to ?>'); on the same line. And in the noscript sections put everything from the <?php to the closing ?> on on line. Here's the code again copied from the file I tested:

 <script language="javascript"><!--
document.write('<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>

 

Jeff,

 

I think I corrected the syntax error on line 109 (which started with "document write") by removing an extra ' after the code:

urlencode($product_info['products_url']), 'NONSSL', true, false) . ''"

I believe it should be

urlencode($product_info['products_url']), 'NONSSL', true, false) . '"

However, even after making this change, I am now getting a parse error on line 110, the line immediately after the above line.

<td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) . '" target="_blank">' . tep_image(DIR_WS_IMAG
ES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_I
MAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE
. '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false) .
'" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $produ
ct_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"')
. '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
</td>

Any clues?

 

Thanks for any help you can provide,

 

Bill Kellum

Link to comment
Share on other sites

It seems the code is right. I popped this in a test store and it worked fine. But before I checked I made it one long line. I think maybe where it breaks is what's causing the parse error. In the script section make everything from document.write all the way to ?>'); on the same line. And in the noscript sections put everything from the <?php to the closing ?> on on line. Here's the code again copied from the file I tested:

 

Thanks Jeff!

Bill Kellum

 

Sounds Good Productions

STS Tutorials & more: STSv4.6, STS Add-ons (STS Power Pack), STS V4 Forum STS Forum FREE TEMPLATE

Link to comment
Share on other sites

  • 2 years later...

I'm trying to display Products Url in product listing page under "Manufacture" column list.

 

I modified this code:

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> ';

break;

 

To this:

 

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = ' <a href="' . tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($listing['products_url']), 'NONSSL', true, false) . '">'</a> ';

break;

 

I am missing something because the link redirects to index page.

So I tried to to put "pd.products_url" in $listing_sql...index.php page but gives me an error msg.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...