Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Click to enlarge on main list?


Juha

Recommended Posts

hi,

 

I'd like to have the click to enlarge work on the product list in index.php. I want to remove the extra step you have to take when trying view a large image: first you go to the product listing in a gategory and click the thumb, which gets you to individual product description (product_info.php) and only then you can enlarge the image.

 

The idea is that when you are viewing the product listing in index.php, you can click the thumb and get the large image popup, or you can click the product name and go to product description. Has anyone done this or is there a contirbution that does this?

Link to comment
Share on other sites

  • 2 weeks later...

Hi, here you go (maybe a little late but hopefully this helps someone else)....

 

 

Open catalog/index.php, and place this javascript above the </head> tag:

 

<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>

 

Then open catalog/includes/modules/product_listing.php and find this code:

 

case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
           } else {
             $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
           break;

 

Replace with:

 

case 'PRODUCT_LIST_IMAGE':
           $lc_align = 'center';
           if (isset($HTTP_GET_VARS['manufacturers_id'])) {
             $lc_text = '<script language="javascript"><!--
document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $listing['products_image']) . '</a>\')//--></script>';
           } else {
             $lc_text = '<script language="javascript"><!--
document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $listing['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $listing['products_image']) . '</a>\')//--></script>';
           }
           break;

 

I'm not calculating image size in this example.

Link to comment
Share on other sites

  • 2 months later...

Hi Sky,

 

and many thanks! I just happened to check if there's any replies to my post since I now have time to complete the missing things on my site, and what do you know, there you are! I made the changes and it works beautifully. Thanks again! :D

 

Juha

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...