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

#   Discount amount not applied to first product id in discount

##

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

Less More

- Posts: 32
- Thank you received: 2
-
-

8 years 7 months ago -  8 years 7 months ago [\#290435](#290435) by [PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")  *[Discount amount not applied to first product id in discount](/forum/3-bug-report/894274-discount-amount-not-applied-to-first-product-id-in-discount#290435 "-- HikaShop version -- : 3.4.0  Hi,  When using discount on product with variants, choosing when adding product only &quot;all variants&quot; 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")* was created by *[PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")*

-- 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: 8 years 7 months ago by [PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile"). Reason: #closed

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84OTQyNzQtZGlzY291bnQtYW1vdW50LW5vdC1hcHBsaWVkLXRvLWZpcnN0LXByb2R1Y3QtaWQtaW4tZGlzY291bnQ/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: 86358
- Thank you received: 14290
-
-

8 years 7 months ago [\#290473](#290473) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount amount not applied to first product id in discount](/forum/3-bug-report/894274-discount-amount-not-applied-to-first-product-id-in-discount#290473 "-- HikaShop version -- : 3.4.0  Hi,  When using discount on product with variants, choosing when adding product only &quot;all variants&quot; 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")*

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

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

Less More

- Posts: 32
- Thank you received: 2
-
-

8 years 7 months ago [\#290491](#290491) by [PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")  Replied by *[PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")* on topic *[Discount amount not applied to first product id in discount](/forum/3-bug-report/894274-discount-amount-not-applied-to-first-product-id-in-discount#290491 "-- HikaShop version -- : 3.4.0  Hi,  When using discount on product with variants, choosing when adding product only &quot;all variants&quot; 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")*

**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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84OTQyNzQtZGlzY291bnQtYW1vdW50LW5vdC1hcHBsaWVkLXRvLWZpcnN0LXByb2R1Y3QtaWQtaW4tZGlzY291bnQ/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: 86358
- Thank you received: 14290
-
-

8 years 7 months ago [\#290492](#290492) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount amount not applied to first product id in discount](/forum/3-bug-report/894274-discount-amount-not-applied-to-first-product-id-in-discount#290492 "-- HikaShop version -- : 3.4.0  Hi,  When using discount on product with variants, choosing when adding product only &quot;all variants&quot; 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")*

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

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

Less More

- Posts: 32
- Thank you received: 2
-
-

8 years 7 months ago [\#290510](#290510) by [PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")  Replied by *[PortobelloDigital](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")* on topic *[Discount amount not applied to first product id in discount](/forum/3-bug-report/894274-discount-amount-not-applied-to-first-product-id-in-discount#290510 "-- HikaShop version -- : 3.4.0  Hi,  When using discount on product with variants, choosing when adding product only &quot;all variants&quot; 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")*

**- 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

- [ ![dscount-db-1.PNG](/forum/attachment/43193) ](/forum/attachment/43193 "dscount-db-1.PNG") [ ](/forum/attachment/43193?download=1 "dscount-db-1.PNG")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMtYnVnLXJlcG9ydC84OTQyNzQtZGlzY291bnQtYW1vdW50LW5vdC1hcHBsaWVkLXRvLWZpcnN0LXByb2R1Y3QtaWQtaW4tZGlzY291bnQ/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: 86358
- Thank you received: 14290
-
-

8 years 7 months ago [\#290517](#290517) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount amount not applied to first product id in discount](/forum/3-bug-report/894274-discount-amount-not-applied-to-first-product-id-in-discount#290517 "-- HikaShop version -- : 3.4.0  Hi,  When using discount on product with variants, choosing when adding product only &quot;all variants&quot; 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")*

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](/forum/user/13368-portobellodigital "View PortobelloDigital's Profile")

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

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