Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Replace images with a button on product listing


Guest

Recommended Posts

Posted

I'd like to replace the images in the product listing box with a More Info button but keep the image on the product info page. Any one know how?

Thanks

Posted

product_listing.php....around line 160...The code that controls the image is below:

 

  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, 'class=shadow1') . '</a> ';
           }

 

The specific line is:

 

$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, 'class=shadow1') . '</a> ';

 

You could change: tep_image(DIR_WS_IMAGES . $listing['products_image'],

 

to something like: tep_image(DIR_WS_IMAGES . '/more_info.gif'],

 

And create an image ('more_info.gif') as your button with 'More Info' on it!

 

That seems the easiest way!

Posted

This removes the image in the product listing module but I am unable to figure out how to call the button.

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 . 'button_more_info.gif' . $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
           }
           break;

If I put this: 'button_more_info.gif' in [ ] I get an error.

Posted

Try adding a slash e.g.

 

'/button_more_info.gif'

 

and make sure the gif is in your images folder.......

 

if that doesn't work, let me know and i'll try it myself and get back to you.

 

 

b

Posted

just tried this:

 

              $lc_text = ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . '/oscommerce.gif' /*$listing['products_image']*/, $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'class=shadow1') . '</a> ';

 

and it put the oscommerce image in so it definately works.

 

B

Archived

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

×
×
  • Create New...