Author Topic: Clear cart  (Read 4714 times)

Offline vanuatoo

  • Newbie
  • *
  • Posts: 1
  • Karma: +0/-0
    • View Profile
Clear cart
« on: October 02, 2017, 04:52:09 AM »
Hello,

I'm implementing integration with 3rd party payment system.
I have one problem. When the payment system invokes callback.php I need to update the order status (which I'm doing in the database) and also clear the customer cart.
Can you help me how to properly clear the cart without using API?
Any example code would be very helpful.

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5772
  • Karma: +274/-2
    • View Profile
Re: Clear cart
« Reply #1 on: October 02, 2017, 08:12:32 AM »
Hello.

Check how others builtin extensions do this for example paypal standard or paypal pro

Offline maxter

  • Full Member
  • ***
  • Posts: 228
  • Karma: +64/-0
    • View Profile
Re: Clear cart
« Reply #2 on: October 02, 2017, 09:18:58 AM »
Cart clear will be with simple call to cart object with clear method.
Here is the cart class:
https://github.com/abantecart/abantecart-src/blob/master/public_html/core/lib/cart.php#L498

Here is how you will call it:
$this->cart->clear();
This is assuming you are inside of the controller or model

 

Powered by SMFPacks Social Login Mod