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

#   coupon unwanted applied

##

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

Less More

- Posts: 515
- Thank you received: 22
-
-

9 years 4 months ago [\#274396](#274396) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#274396 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")* was created by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")*

-- HikaShop version -- : 3.1.1
-- Joomla version -- : 3.7.3
-- PHP version -- : 7.0

When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???

See screenshots

- [ ![checkout&#95;2017-07-21.jpg](/forum/attachment/39297) ](/forum/attachment/39297 "...2017-07-21.jpg") [ ](/forum/attachment/39297?download=1 "...2017-07-21.jpg")
- [ ![product&#95;configuration.jpg](/forum/attachment/39298) ](/forum/attachment/39298 "...figuration.jpg") [ ](/forum/attachment/39298?download=1 "...figuration.jpg")
- [ ![category.jpg](/forum/attachment/39299) ](/forum/attachment/39299 "category.jpg") [ ](/forum/attachment/39299?download=1 "category.jpg")
- [ ![coupon.jpg](/forum/attachment/39300) ](/forum/attachment/39300 "coupon.jpg") [ ](/forum/attachment/39300?download=1 "coupon.jpg")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MTIyNy1jb3Vwb24tdW53YW50ZWQtYXBwbGllZD90bXBsPW1hcmtkb3du) 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: 86587
- Thank you received: 14326
-
-

9 years 4 months ago [\#274403](#274403) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#274403 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")*

Hi,

Try changing the code: Code:

foreach ($id as $productid) { if($product-&gt;product_id !== $productid[0]) { foreach ($products as $product2) { if(!empty($product-&gt;cart_product_parent_id) &amp;&amp; $product2-&gt;cart_product_id == $product-&gt;cart_product_parent_id &amp;&amp; $product2-&gt;product_id == $productid[0]) { $coupon-&gt;products[] = $product; } } } else { $coupon-&gt;products[] = $product; } }

to:
Code:

foreach ($id as $productid) { if($product-&gt;product_id !== $productid[0]) { foreach ($products as $product2) { if(!empty($product-&gt;cart_product_parent_id) &amp;&amp; $product2-&gt;cart_product_id == $product-&gt;cart_product_parent_id &amp;&amp; $product2-&gt;product_id == $productid[0]) { $coupon-&gt;products[] = $product; break 2; } } } else { $coupon-&gt;products[] = $product; break; } }

in the file administrator/components/com_hikashop/classes/discount.php
That should allow the system to count the products only once and not once per category link between the product and the categories of the coupon.
Let us know how that goes so that we can add the patch on our end.

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

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

Less More

- Posts: 515
- Thank you received: 22
-
-

9 years 4 months ago [\#274462](#274462) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#274462 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")*

Hello Nicolas,

Yes, this code works fine, problem solved! Thanks again.

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

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

Less More

- Posts: 515
- Thank you received: 22
-
-

9 years 2 months ago [\#278674](#278674) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#278674 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")*

Hello Nicolas,

I installed the 3.2.0 version, but the couponpatch was not applied as far as I could see, as the unwanted coupon behaviour was back....I changed the code myself again.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MTIyNy1jb3Vwb24tdW53YW50ZWQtYXBwbGllZD90bXBsPW1hcmtkb3du) 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: 86587
- Thank you received: 14326
-
-

9 years 2 months ago [\#278687](#278687) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#278687 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")*

Hi,

I do not confirm.
I see the patch on the install package of the 3.2.0:
[ monosnap.com/file/XAsMnyG4znkRuJKaKu0A62B8oLx9wa](https://monosnap.com/file/XAsMnyG4znkRuJKaKu0A62B8oLx9wa)
So either we're talking about something else, or you didn't look at the install package of the 3.2.0

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

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

Less More

- Posts: 515
- Thank you received: 22
-
-

9 years 2 months ago [\#278698](#278698) by [jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")  Replied by *[jouwnaambord.nl](/forum/user/1188-jouwnaambord-nl "View jouwnaambord.nl's Profile")* on topic *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#278698 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")*

Hi Nicolas,

You're right, I didn't. But after installing 3.2.0, the couponcode was applied again to a single product in multiple categories. After pasting the php code into discount.php it worked as before.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5MTIyNy1jb3Vwb24tdW53YW50ZWQtYXBwbGllZD90bXBsPW1hcmtkb3du) 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: 86587
- Thank you received: 14326
-
-

9 years 2 months ago [\#278703](#278703) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[coupon unwanted applied](/forum/27-checkout/891227-coupon-unwanted-applied#278703 "-- HikaShop version -- : 3.1.1 -- Joomla version -- : 3.7.3 -- PHP version -- : 7.0  When a product is assigned to more than one category, it gets a 10% COUPON discount (wich shouldn't, because this should only apply when a customer order more than 1 product). When assigning the product to a single category, it works fine???  See screenshots")*

Hi,

I don't see why applying that patch would change anything since the code is already there.
There must have been a reason to it.
For next release, if you could first do a copy of the website and test the update there so that you could confirm the issue we should be able to look into it.

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

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