Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Add to cart button doesn't work for products with attributes


Recommended Posts

Hi everyone,


I have noticed a strange issue with my estore.


When trying to purchase an item from the product list (eg new products for December) using the 'add to cart' button it works great, except when the product has an attribute linked to it (ie size or color).


I have done some research and it looks like the includes/application_top.php file could well be the cause of this...


Here is the code -


// customer adds a product from the products page


case 'add_product' : if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {

$attributes = isset($HTTP_POST_VARS['id']) ? $HTTP_POST_VARS['id'] : '';

$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $attributes))+1, $attributes);


tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));





Any ideas why it clears the cart when the 'add to cart' button is clicked from the product list only when a product has an attribute?


Incidentally, it takes you straight to the actual product listing instead of your cart, and even when you proceed to click the 'add to cart' button from within the listing itself, it displays "Your Shopping Cart is empty!".... NOTE: this does not happen if you go directly to the product listing and then 'add to cart' so the problem is definitely caused from the product listing page.


Any help would be greatly appreciated, I'm sure this must be quite common in OSC2.3





Link to comment
Share on other sites

Normally this is how it works.


Clicking on the "buy now" button for a product without attributes in the product listing will add it to the cart.


Clicking on the "buy now" button for a product with attributes in the product listing will not add it to the cart but will instead take you to the product info page .. where you can select the wanted attributes and then click the "add to cart" button to add it to the cart.

Link to comment
Share on other sites

  • 2 weeks later...


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

  • Create New...