Jump to content

update cart after addDiscount


Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...