Skip to main content

Cart API needs some improvement...

More
13 years 4 months ago #106544 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

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #106548 by nicolas
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.

More
13 years 4 months ago #106549 by thesilentman
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.

More
13 years 4 months ago #106551 by nicolas
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.

Please Log in or Create an account to join the conversation.

More
13 years 4 months ago #106553 by thesilentman
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
Powered by Kunena Forum