In includes/classes/shopping_cart.php on line 1812 there is this code:
PHP Code:
if ((DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) && $messageStack->size('shopping_cart') == 0) {
$messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
} else {
if ($_GET['main_page'] != FILENAME_SHOPPING_CART) {
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
}
This is inside a product loop and will redirect to the shopping cart page if the current page is not the shopping cart. The problem is that the redirect should actually be outside of the product loop and should only happen after all of the products have been updated. This doesn't happen in normal Zen Cart but becomes a bug if you try to override the shopping cart page and has DISPLAY_CART == 'true'. Only the first product in the loop will get updated.
Will changing the code to following cause any issues (just removing the else statement entirely)?
PHP Code:
if ((DISPLAY_CART == 'false' && $_GET['main_page'] != FILENAME_SHOPPING_CART) && $messageStack->size('shopping_cart') == 0) {
$messageStack->add_session('header', ($this->display_debug_messages ? 'FUNCTION ' . __FUNCTION__ . ': ' : '') . SUCCESS_ADDED_TO_CART_PRODUCTS, 'success');
}
It seems redundant to have that redirect since the last line of the function, outside of the loop is:
PHP Code:
zen_redirect(zen_href_link($goto, zen_get_all_get_params($parameters)));
Bookmarks