I have an AJAX add to cart customization, or I don't redirect to the shopping cart. Because of this the customer may never visit the shopping cart page (cart.php) where the On Sale sales are applies. How do I work around this?
Posted by Nick Poindexter on 04 March 2010 05:07 PM
There are two solutions to this. If you are using On Sale verions 2.0 or higher you can enable this option:|
On Sale -> Settings -> Calculate Sales on both the Cart and Checkout pages
This will simply calculate the sales once the customer reaches the checkout.
Or you can add the sale calculation to your custom mod, or the cart.php page if you don't redirect to the cart after adding a product. To do this add the following code to your script somewhere after the product has been added to the cart:
// On Sale :: www.alteredcart.com //
// End On Sale //
If this is the cart.php file you can add it after:
# Recalculate cart totals after new item added
$products = func_products_in_cart($cart, (!empty($user_account["membershipid"]) ? $user_account["membershipid"] : ""));
$cart = func_array_merge($cart, func_calculate($cart, $products, $login, $current_area, 0));