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

#   product bundle stock not updated on succesful order

##

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

Less More

- Posts: 7
- Thank you received: 1
-

2 years 7 months ago [\#359927](#359927) by [tlweb](/forum/user/81165-tlweb "View tlweb's Profile")  *[product bundle stock not updated on succesful order](/forum/25-install-update/907935-product-bundle-stock-not-updated-on-succesful-order#359927 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.2.x -- Browser(s) name and version -- : safari latest -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I have a product that has 2 variants because you have an option to get a free product or discount.  This product has 21 bundled products linked to it.  When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?  See attache screenshots for configuration")* was created by *[tlweb](/forum/user/81165-tlweb "View tlweb's Profile")*

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 4.4.3
-- PHP version -- : 8.2.x
-- Browser(s) name and version -- : safari latest
-- Error-message(debug-mod must be tuned on) -- : no error message

Hi,

I have a product that has 2 variants because you have an option to get a free product or discount.

This product has 21 bundled products linked to it.

When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?

See attache screenshots for configuration

- [ ![Schermafbeelding2024-03-21om15.58.56.png](/forum/attachment/59016) ](/forum/attachment/59016 "...om15.58.56.png") [ ](/forum/attachment/59016?download=1 "...om15.58.56.png")
- [ ![Schermafbeelding2024-03-21om16.03.48.png](/forum/attachment/59017) ](/forum/attachment/59017 "...om16.03.48.png") [ ](/forum/attachment/59017?download=1 "...om16.03.48.png")
- [ ![Schermafbeelding2024-03-21om16.03.55.png](/forum/attachment/59018) ](/forum/attachment/59018 "...om16.03.55.png") [ ](/forum/attachment/59018?download=1 "...om16.03.55.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzkwNzkzNS1wcm9kdWN0LWJ1bmRsZS1zdG9jay1ub3QtdXBkYXRlZC1vbi1zdWNjZXNmdWwtb3JkZXI/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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86321
- Thank you received: 14279
-
-

2 years 7 months ago -  2 years 7 months ago [\#359929](#359929) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[product bundle stock not updated on succesful order](/forum/25-install-update/907935-product-bundle-stock-not-updated-on-succesful-order#359929 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.2.x -- Browser(s) name and version -- : safari latest -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I have a product that has 2 variants because you have an option to get a free product or discount.  This product has 21 bundled products linked to it.  When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?  See attache screenshots for configuration")*

Hi,

Bundled products on products with variants is not supported now.
However, looking into it, I think it could be added with a few lines of code.
Try adding the code: Code:

$query = 'SELECT product_parent_id FROM #__hikashop_product WHERE product_parent_id &gt; 0 AND product_id IN ('.implode(',', $bundle_product_ids).')'; $this-&gt;database-&gt;setQuery($query); $parents = $this-&gt;database-&gt;loadObjectList('product_parent_id'); if(!empty($parents)) { foreach($parents as $k =&gt; $v) { $bundle_product_ids[ (int)$k ] = (int)$k; } }

before the line: Code:

$query = 'SELECT pr.product_id as &#96;bundle_id&#96;, pr.product_related_id as &#96;product_id&#96;, pr.product_related_quantity, p.product_name, p.product_code, p.product_tax_id '.

in the file administrator/components/com_hikashop/classes/order_product.php and it should hopefully do it.

Note also that the stock will be updated based on the "Update the product stock on confirmed status" option of the HikaShop configuration. If that option is activated, the status of the order needs to be confirmed for the stock to be updated.

Last edit: 2 years 7 months ago by [nicolas](/forum/user/63-nicolas "View nicolas's Profile").

The following user(s) said Thank You: [tlweb](/forum/user/81165-tlweb "View tlweb's Profile")

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

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

Less More

- Posts: 7
- Thank you received: 1
-

2 years 7 months ago -  2 years 7 months ago [\#359933](#359933) by [tlweb](/forum/user/81165-tlweb "View tlweb's Profile")  Replied by *[tlweb](/forum/user/81165-tlweb "View tlweb's Profile")* on topic *[product bundle stock not updated on succesful order](/forum/25-install-update/907935-product-bundle-stock-not-updated-on-succesful-order#359933 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.2.x -- Browser(s) name and version -- : safari latest -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I have a product that has 2 variants because you have an option to get a free product or discount.  This product has 21 bundled products linked to it.  When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?  See attache screenshots for configuration")*

There is an error in your query syntax. It didn't have "FROM" in it. But at first i thought it worked. But now i can't get it to work anymore.

Last edit: 2 years 7 months ago by [tlweb](/forum/user/81165-tlweb "View tlweb's Profile").

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

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

Less More

- Posts: 7
- Thank you received: 1
-

2 years 7 months ago -  2 years 7 months ago [\#359934](#359934) by [tlweb](/forum/user/81165-tlweb "View tlweb's Profile")  Replied by *[tlweb](/forum/user/81165-tlweb "View tlweb's Profile")* on topic *[product bundle stock not updated on succesful order](/forum/25-install-update/907935-product-bundle-stock-not-updated-on-succesful-order#359934 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.2.x -- Browser(s) name and version -- : safari latest -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I have a product that has 2 variants because you have an option to get a free product or discount.  This product has 21 bundled products linked to it.  When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?  See attache screenshots for configuration")*

removed this because it's not true.

Last edit: 2 years 7 months ago by [tlweb](/forum/user/81165-tlweb "View tlweb's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzkwNzkzNS1wcm9kdWN0LWJ1bmRsZS1zdG9jay1ub3QtdXBkYXRlZC1vbi1zdWNjZXNmdWwtb3JkZXI/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")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86321
- Thank you received: 14279
-
-

2 years 7 months ago [\#359962](#359962) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[product bundle stock not updated on succesful order](/forum/25-install-update/907935-product-bundle-stock-not-updated-on-succesful-order#359962 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.2.x -- Browser(s) name and version -- : safari latest -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I have a product that has 2 variants because you have an option to get a free product or discount.  This product has 21 bundled products linked to it.  When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?  See attache screenshots for configuration")*

Hi,

So I've looked into it today and it's a bit more complicated.
I had to add the code: Code:

$query = 'SELECT product_parent_id, product_id FROM #__hikashop_product WHERE product_parent_id &gt; 0 AND product_id IN ('.implode(',', $bundle_product_ids).')'; $this-&gt;database-&gt;setQuery($query); $parents = $this-&gt;database-&gt;loadObjectList('product_id'); if(!empty($parents)) { foreach($parents as $k =&gt; $v) { $bundle_product_ids[ (int)$v-&gt;product_parent_id ] = (int)$v-&gt;product_parent_id; } }

instead of the code I gave you yesterday, and I also had to change the code: Code:

if($product-&gt;product_id != $bundle_data-&gt;bundle_id) continue;

to: Code:

// check that the current bundle data is for the current product if($product-&gt;product_id != $bundle_data-&gt;bundle_id) { // the current bundle data is not for the current product $found = false; // check if the product is actually a variant of a product linked to the bundled data foreach($parents as $parent) { if($parent-&gt;product_id == $product-&gt;product_id &amp;&amp; $parent-&gt;product_parent_id == $bundle_data-&gt;bundle_id) { $found = true; } } if(!$found) continue; }

in that same file. Now it's working fine in my tests.

We'll be including the modifications for the next version of HikaShop.

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

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

Less More

- Posts: 7
- Thank you received: 1
-

2 years 7 months ago [\#360009](#360009) by [tlweb](/forum/user/81165-tlweb "View tlweb's Profile")  Replied by *[tlweb](/forum/user/81165-tlweb "View tlweb's Profile")* on topic *[product bundle stock not updated on succesful order](/forum/25-install-update/907935-product-bundle-stock-not-updated-on-succesful-order#360009 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.2.x -- Browser(s) name and version -- : safari latest -- Error-message(debug-mod must be tuned on) -- : no error message  Hi,  I have a product that has 2 variants because you have an option to get a free product or discount.  This product has 21 bundled products linked to it.  When i order the product the stock of those 21 products is not updated. WHat am i doing wrong?  See attache screenshots for configuration")*

Hi Nicolas,

I've tested your updated code but it still is not working for me unfortunately. I'll set up a test domain tomorrow so i can do more extensive testing.

Kind regards,

Tom

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI1LWluc3RhbGwtdXBkYXRlLzkwNzkzNS1wcm9kdWN0LWJ1bmRsZS1zdG9jay1ub3QtdXBkYXRlZC1vbi1zdWNjZXNmdWwtb3JkZXI/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.086 seconds

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

[](#top)
