- Posts: 217
- Thank you received: 4
Check if cart is empty in plugin
- FilipHradil
-
Topic Author
- Offline
Less
More
11 years 6 months ago #192854
by FilipHradil
Check if cart is empty in plugin was created by FilipHradil
-- HikaShop version -- : 2.3.5
Hello,
please I need to check if a cart is empty in my plugin (onBeforeCartUpdate)
I tried everything but I didn't succeed.
Many thanks!
Filip
Hello,
please I need to check if a cart is empty in my plugin (onBeforeCartUpdate)
I tried everything but I didn't succeed.
Many thanks!
Filip
Please Log in or Create an account to join the conversation.
11 years 6 months ago #192858
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic Check if cart is empty in plugin
Hi,
www.hikashop.com/support/support/documen...l#onBeforeCartUpdate
As you can see in the documentation, the $cart contains the future new cart.
So if you want the old cart, the best is to load it using the $cartClass ; like calling "$cartClass->loadCart()"
Regards,
www.hikashop.com/support/support/documen...l#onBeforeCartUpdate
As you can see in the documentation, the $cart contains the future new cart.
So if you want the old cart, the best is to load it using the $cartClass ; like calling "$cartClass->loadCart()"
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
- FilipHradil
-
Topic Author
- Offline
Less
More
- Posts: 217
- Thank you received: 4
11 years 6 months ago #192946
by FilipHradil
Replied by FilipHradil on topic Check if cart is empty in plugin
Thank you!
So how can I check number of items in cart, or whether is empty?
Thanks
So how can I check number of items in cart, or whether is empty?
Thanks
Please Log in or Create an account to join the conversation.
11 years 6 months ago #193082
by Xavier
Replied by Xavier on topic Check if cart is empty in plugin
Hi,
To check the content of the old cart, you can do:
To check the content of the old cart, you can do:
Code:
$cartClass = hikashop_get('class.cart');
$oldCart = $cartClass->get();
if(!empty($oldCart)){
//...
}
Please Log in or Create an account to join the conversation.
- FilipHradil
-
Topic Author
- Offline
Less
More
- Posts: 217
- Thank you received: 4
11 years 6 months ago #193170
by FilipHradil
Replied by FilipHradil on topic Check if cart is empty in plugin
Hello Xavier,
that is exacly what I needed.
Thanks you!
Filip
that is exacly what I needed.
Thanks you!
Filip
Please Log in or Create an account to join the conversation.
Time to create page: 0.170 seconds