Jump to content

Freezing a cart


Recommended Posts

Hi,

 

I am developing a payment module, and want to freeze the cart (disable add or remove cart items) before redirecting customer to the payment gateway. Payment gateway does not return the amount paid and I dont want to save it in cookie (client side). Is there any way to freeze the shopping cart?

 

Prestashop Version : 1.6.1.10

 

Thanks,

Edited by arashrad (see edit history)
Link to comment
Share on other sites

Hi...

 

Your all cart data in cart context object. please use that and pass your payment module.

 

if you need order cart total the use your like in controller file

 

$this->context->cart->getOrderTotal(true, Cart::BOTH);

Thanks

 

Hi,

 

Thanks for your answer.

 

The problem is:

1 - A customer has opened two browser tabs each one showing one product.

2 - In one of the tabs he adds the product to the cart and asks to checkout and is redirected to payment gateway.

3 - In the second tab he adds the product to his cart. now the cart total price is more than the price sent to the payment gateway.

4 - In the first tab customer pays the price (which totals to price before adding the second product) and is redirected back to the validation page.

5 - Because the gateway I use, does not return total paid amount and expects me to know it, there is no way to know that the price of second product is not included in the paid total. So I accept the payment and customer gets the second product for free.

 

Now what should I do:

1 - Save the amount sent to the gateway in cookie (on the client):

or

2 - Freeze the cart before redirecting to the gateway.

or

3 - Create a table and save the information needed in it.

 

Is the first way safe? Third option requires many more steps to be added to the module creation and installat and uninstall steps and makes it more complicated. So in my opinion the second way is reasonable.

 

Now the question: Is there any way to do the second choice?

 

Thanks

Edited by arashrad (see edit history)
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...