First ... think out what happens on a checkout ...
1 Things added to cart
2 4 pages to test for this as a security
a. shopping cart
b. checkout_shipping
c. checkout payment
d. checkout_confirmation
Goal: Alert customer that checkout is not possible if true
If on shopping_cart, you want a message triggered ...
If on the checkout_ pages, you want to return to shopping cart and the message triggered ...
So there needs to be a shopping_cart content test that triggers on the 4 pages with 3 of the pages returning to the shopping_cart to display the message ...
For the 3 checkout pages, you can add to the header_php.php files the code in RED:
Code:
// bof: invalid products together
if (($_SESSION['cart']->in_cart_check('master_categories_id','3') > 0 && $_SESSION['cart']->in_cart_check('master_categories_id','39') > 0)) {
$messageStack->add_session('header', 'Invalid Products together', 'error');
zen_redirect(zen_href_link(FILENAME_SHOPPING_CART));
}
// eof: invalid products together
// Stock Check
The shopping_cart header_php.php code is slightly different:
Code:
if (!$_SESSION['valid_to_checkout']) {
$messageStack->add('shopping_cart', ERROR_CART_UPDATE . $_SESSION['cart_errors'] , 'caution');
}
// bof: invalid products together
if (($_SESSION['cart']->in_cart_check('master_categories_id','3') > 0 && $_SESSION['cart']->in_cart_check('master_categories_id','39') > 0)) {
$messageStack->add('shopping_cart', 'Invalid Products together', 'error');
}
// eof: invalid products together
Now, how you want to explain this is up to you on the messageStack ...
You may even want to customize it further to mark the conflicting products similar to the out of stock flag, but you will need to do additional coding for the shopping_cart header_php.php and possibly the template to do so ...
Bookmarks