bluego78 Posted August 6, 2012 Share Posted August 6, 2012 Hi, i'm creating a payment type that add a discount to the cart automatically. I invoke addDiscount method from cart, in the validation phase. It works, but the total of the cart is not updated... why? what can i do to update my cart after addDiscount method? Thanks Link to comment Share on other sites More sharing options...
bluego78 Posted August 6, 2012 Author Share Posted August 6, 2012 OK.. I've solved with this: In validation page: $payment_instance = new MY_PAYMENT(); if(!isset($_POST['addDiscount']) || $_POST['addDiscount']=='') { $cart->addDiscount($payment_instance->discount_id); echo '<b style="font-size:14px;">Wait, we're processing your order...</b>'; echo '<form method="POST" id="addDiscountForm" action="validation.php"> <input type="hidden" name="addDiscount" value="'.$payment_instance->discount_id.'" /> </form>'; echo '<script>document.getElementById(\'addDiscountForm\').submit();</script>'; exit(); } echo $payment_instance->validatePayment($cart); include_once(dirname(__FILE__).'/../../footer.php'); Hope this could be useful for someone else. Bye Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now