Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

View details/Add to cart button switcher


psynaptic

Recommended Posts

Posted

I'm trying to hack the Add to Cart buttons in the product listing so that when a product has attributes it shows a 'View Details' instead of 'Add to Cart' button. I found a contribution that changes all Add to Cart buttons on pages other than product_info to View Details:

 

View Details instead of Add to Cart

 

However, I would really like to have the buttons switch between Add to Cart and View Details depending on if the product has attributes or not. I have tried doing the following in modules/product_listing.php:

         case 'PRODUCT_LIST_BUY_NOW':
           $lc_align = 'center';
           $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

	if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
             $lc_text .= 'has attributes';
           } else {
             $lc_text .= 'no attributes';
		}

This is an effort to find out if tep_has_product_attributes will work for what I want to achieve. Unfortunately, it just echos 'no attributes' whether the product has them or not.

 

Does anyone know why it's not working?

Archived

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

×
×
  • Create New...