- Posts: 40
- Thank you received: 2
Cart API needs some improvement...
- thesilentman
-
Topic Author
- Offline
Less
More
13 years 4 months ago #106544
by thesilentman
Cart API needs some improvement... was created by thesilentman
Hi guys,
I have been doing some custom development around Hikashop's API's and I came to a point where I need to know exactly which product's removal (or subtraction of quantity) has triggered an
onBeforeCartUpdate
-- or --
onAfterCartUpdate
event.
Unfortunately the product_id that is passed in the parameters, doesn't hold this info. I don't know if this is by design or a bug.
I have found that there is an array ($cartClass->new_quantities) which holds the product_id as the key and the quantity that was modified as the value, but I am not sure how reliable this is, in order to use it. Could you comment on that?
Thanks,
Frank
I have been doing some custom development around Hikashop's API's and I came to a point where I need to know exactly which product's removal (or subtraction of quantity) has triggered an
onBeforeCartUpdate
-- or --
onAfterCartUpdate
event.
Unfortunately the product_id that is passed in the parameters, doesn't hold this info. I don't know if this is by design or a bug.
I have found that there is an array ($cartClass->new_quantities) which holds the product_id as the key and the quantity that was modified as the value, but I am not sure how reliable this is, in order to use it. Could you comment on that?
Thanks,
Frank
Please Log in or Create an account to join the conversation.
13 years 4 months ago #106548
by nicolas
Replied by nicolas on topic Cart API needs some improvement...
product_id contains the new quantity as value of the table for each product id (keys of the table). And it will be 0 if the product is removed.
Please Log in or Create an account to join the conversation.
- thesilentman
-
Topic Author
- Offline
Less
More
- Posts: 40
- Thank you received: 2
13 years 4 months ago #106549
by thesilentman
Replied by thesilentman on topic Cart API needs some improvement...
Yes, but there is no product id. How do I get the product id (and possibly quantity) which was removed?
Please Log in or Create an account to join the conversation.
13 years 4 months ago #106551
by nicolas
Replied by nicolas on topic Cart API needs some improvement...
As I said in my message the product ids are the keys of the array.
In fact to be more precise, the keys of the array are the values of the column "cart_product_id" which identify each product line of the cart.
In fact to be more precise, the keys of the array are the values of the column "cart_product_id" which identify each product line of the cart.
Please Log in or Create an account to join the conversation.
- thesilentman
-
Topic Author
- Offline
Less
More
- Posts: 40
- Thank you received: 2
13 years 4 months ago #106553
by thesilentman
Replied by thesilentman on topic [SOLVED] Cart API needs some improvement...
Ahh, yes just checked. This works, yes, thank you very much.
Please Log in or Create an account to join the conversation.
Time to create page: 0.188 seconds