Add to cart button in osCommerce keeps redirecting back to product page

1.3k Views Asked by At

I have an ebook item in osCommerce that includes product attributes. When I click the Add to Cart button from the index page it should go directly to the shopping_cart.php page. However, it only keeps redirecting the customer back to the product_info.php page.

Why is it doing that?

2

There are 2 best solutions below

0
On

If the product has attributes osCommerce expects that you select one of them before adding the product to the cart. That's why it is redirecting you to the product detail page.

0
On

try this code: find if ($col === 0) {$new_prods_content .= '';} (around line 29)

below add this code:

$new_prods_content .= '<td width="30%" align="center" valign="top">
    <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . 
    $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . 
    $new_products['products_image'], $new_products['products_name'], 
    SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br /><a href="' . 
    tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . 
    $new_products['products_id']) . '">' . $new_products['products_name'] . 
    '</a><br />' . $currencies->display_price($new_products['products_price'], 
    tep_get_tax_rate($new_products['products_tax_class_id'])) . 
    '&nbsp&nbsp&nbsp' . tep_draw_button(IMAGE_BUTTON_IN_CART, null , 
    tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 
    'action=buy_now&products_id=' . $new_products['products_id'])) .'</td>';


       i have added this code for new products in index.php page and when customer clicks add to cart button, it will add the item to cart and show shopping_cart.php page.