coupon unwanted applied

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
7 years 4 months ago #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

Attachments:

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

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
7 years 4 months ago #274403

Hi,

Try changing the code:

				foreach ($id as $productid) {
					if($product->product_id !== $productid[0]) {
						foreach ($products as $product2) {
							if(!empty($product->cart_product_parent_id) && $product2->cart_product_id == $product->cart_product_parent_id && $product2->product_id == $productid[0]) {
								$coupon->products[] = $product;
							}
						}
					} else {
						$coupon->products[] = $product;
					}
				}
to:
				foreach ($id as $productid) {
					if($product->product_id !== $productid[0]) {
						foreach ($products as $product2) {
							if(!empty($product->cart_product_parent_id) && $product2->cart_product_id == $product->cart_product_parent_id && $product2->product_id == $productid[0]) {
								$coupon->products[] = $product;
								break 2;
							}
						}
					} else {
						$coupon->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 or Create an account to join the conversation.

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
7 years 4 months ago #274462

Hello Nicolas,

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

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

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
7 years 2 months ago #278674

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 or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
7 years 2 months ago #278687

Hi,

I do not confirm.
I see the patch on the install package of the 3.2.0:
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 or Create an account to join the conversation.

  • Posts: 507
  • Thank you received: 21
  • Hikashop Business
7 years 2 months ago #278698

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 or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
7 years 2 months ago #278703

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 or Create an account to join the conversation.

Time to create page: 0.065 seconds
Powered by Kunena Forum