[Skip to main content](#vessel-content)

#   Cart API needs some improvement...

##

- **[thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")**
- [![thesilentman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13495-thesilentman "View thesilentman's Profile") Topic Author
- [ Offline](/forum/user/13495-thesilentman)

Less More

- Posts: 40
- Thank you received: 2
-
-

13 years 5 months ago [\#106544](#106544) by [thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")  *[Cart API needs some improvement...](/forum/2-general-talk-about-hikashop/83001-cart-api-needs-some-improvement#106544 "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&#95;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-&gt;new&#95;quantities) which holds the product&#95;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")* was created by *[thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")*

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-&gt;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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDAxLWNhcnQtYXBpLW5lZWRzLXNvbWUtaW1wcm92ZW1lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

13 years 5 months ago [\#106548](#106548) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart API needs some improvement...](/forum/2-general-talk-about-hikashop/83001-cart-api-needs-some-improvement#106548 "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&#95;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-&gt;new&#95;quantities) which holds the product&#95;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")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDAxLWNhcnQtYXBpLW5lZWRzLXNvbWUtaW1wcm92ZW1lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")**
- [![thesilentman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13495-thesilentman "View thesilentman's Profile") Topic Author
- [ Offline](/forum/user/13495-thesilentman)

Less More

- Posts: 40
- Thank you received: 2
-
-

13 years 5 months ago [\#106549](#106549) by [thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")  Replied by *[thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")* on topic *[Cart API needs some improvement...](/forum/2-general-talk-about-hikashop/83001-cart-api-needs-some-improvement#106549 "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&#95;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-&gt;new&#95;quantities) which holds the product&#95;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")*

Yes, but there is no product id. How do I get the product id (and possibly quantity) which was removed?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDAxLWNhcnQtYXBpLW5lZWRzLXNvbWUtaW1wcm92ZW1lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86320
- Thank you received: 14279
-
-

13 years 5 months ago [\#106551](#106551) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Cart API needs some improvement...](/forum/2-general-talk-about-hikashop/83001-cart-api-needs-some-improvement#106551 "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&#95;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-&gt;new&#95;quantities) which holds the product&#95;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")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDAxLWNhcnQtYXBpLW5lZWRzLXNvbWUtaW1wcm92ZW1lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")**
- [![thesilentman's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/13495-thesilentman "View thesilentman's Profile") Topic Author
- [ Offline](/forum/user/13495-thesilentman)

Less More

- Posts: 40
- Thank you received: 2
-
-

13 years 5 months ago [\#106553](#106553) by [thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")  Replied by *[thesilentman](/forum/user/13495-thesilentman "View thesilentman's Profile")* on topic *[\[SOLVED\] Cart API needs some improvement...](/forum/2-general-talk-about-hikashop/83001-cart-api-needs-some-improvement#106553 "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&#95;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-&gt;new&#95;quantities) which holds the product&#95;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")*

Ahh, yes just checked. This works, yes, thank you very much.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzgzMDAxLWNhcnQtYXBpLW5lZWRzLXNvbWUtaW1wcm92ZW1lbnQ/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.067 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
