Discount amount not applied to first product id in discount

  • Posts: 32
  • Thank you received: 2
6 years 7 months ago #290435

-- HikaShop version -- : 3.4.0

Hi,

When using discount on product with variants, choosing when adding product only "all variants" for each product, the first product in the discount dont got the amount applied:

Discount type : discount
Discount percent amount: 50
Discount code : discount-50
Discount product id : 2 or 100 to the same

Last edit: 6 years 7 months ago by PortobelloDigital. Reason: #closed

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 7 months ago #290473

Hi,

We'll need more precise information to be able to help.
Please provide:
- a screenshot of the settings of the discount
- a screenshot of the settings of the product for which it doesn't work properly
- a link to the product page of that product
- an explanation of the expected result compared to what is on the product page

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

  • Posts: 32
  • Thank you received: 2
6 years 7 months ago #290491

screenshot of the settings of the discount

  • discount-1.PNG
  • discount-2.PNG
  • discount-3.PNG

screenshot of the settings of the product for which it doesn't work properly
  • discount-product-1.PNG
  • discount-product-2.PNG
  • discount-product-variant-1.PNG

link to the product page of that product
Link
  • discount-front-1.PNG
  • discount-front-2.PNG

explanation of the expected result compared to what is on the product page
Product page dont got discount on each variants

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 7 months ago #290492

Hi,

Thanks for that.
So some additional questions:
- If the first product of that list doesn't have variants, do you still have the problem ?
- do you have the problem for all the variants of that product on the product page ?
- do you have the problem on the cart/checkout as well ?
- do you have the problem with the default template of joomla too ?

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

  • Posts: 32
  • Thank you received: 2
6 years 7 months ago #290510

- If the first product of that list doesn't have variants, do you still have the problem ?
No, setting another product without variant in first position fix the problem

- do you have the problem for all the variants of that product on the product page ?
Yes

- do you have the problem on the cart/checkout as well ?
Yes

do you have the problem with the default template of joomla too ?
Yes

But, when doing thoose test, when editing a discount, adding a product, saving then removing and saved again fixed the issue ..., so i tested on another discount: open and save fix the issue

All of discount was imported via phpmyadmin via CSV, maybe the issue is here :

When saving, the field "discount_product_id" in the table "#_hikashop_discount" add "," in first :
After import and before saving from backend = 1,2,3,4,5,6,7,8,9,...
After saving from backend = ,1,2,3,4,5,6,7,8,9,...

And some field a change see attachments (line 1 = after saving discount from backend and line 2 after import from db)
In my CSV for import discount, i only fulled thoose fields : discount_id,discount_type,discount_percent_amount,discount_code,discount_published,discount_product_id,discount_currency_id,discount_tax

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
6 years 7 months ago #290517

Hi,

So the problem is indeed with your CSV. You need to have the list of product_ids starts with a comma and end with a comma.
That's because the search in MySQL is done in order to match ,XX, where XX is the id of the product.
That way, it allows us to simply the MySQL queries. Otherwise, with would need a more complex condition which would be: match ,XX, or match XX, or match ,XX
If you don't add a comma at the beginning and the end, then the first and the last products won't get the discount/coupon.

The following user(s) said Thank You: PortobelloDigital

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

Time to create page: 0.068 seconds
Powered by Kunena Forum