Jump to content

delete product from cart not working in prestashop


NishantVadgama
 Share

Recommended Posts

I am using prestashop 1.6.0.14

and In my local store I have overrided paymentModule's validation() method and in that method I have check that if cart having product id = 18 then remove it.

code as follows

 

if ($this->context->cart->containsProduct(18))

{

$this->context->cart->deleteProduct(18);

this->context->cart->update();

}

it works fine remove product from ps_cart_product table but order placed with that product why so..?

to trace I have printed as follows

 

if ($this->context->cart->containsProduct(18))

{

$this->context->cart->deleteProduct(18);

this->context->cart->update();

print_r('<br>---------------------------------------------------------<br>');
print_r($this->context->cart->getProducts());
print_r('<br>---------------------------------------------------------<br>');
print_r($this->context->cart->getPackageList());exit;
}

when print getProducts() does not contain product id 18 but getPackageList() still contains that product why so..?

and how can I delete product form that also..?

help me please 

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More