Here's a quick vQmod script for preventing coupons from applying to products that are on special

If you have 2 products:

Hat - 20.00

Shirt - special for 15.00

Coupon for 50% off would normally give a total of:

20.00 * .50 = 10.00

15.00 * .50 = 7.50

Total: 17.50

This mod will ignore the products that are on special from getting the additional discount:

20.00 * .50 = 10.00

15.00 (special ignored) = 15.00

Total: 25.00

If you have 2 products:

Hat - 20.00

Shirt - special for 15.00

Coupon for 50% off would normally give a total of:

20.00 * .50 = 10.00

15.00 * .50 = 7.50

Total: 17.50

This mod will ignore the products that are on special from getting the additional discount:

20.00 * .50 = 10.00

15.00 (special ignored) = 15.00

Total: 25.00

#### Attachments

*for both 1.4.x and 1.5.x*

Just tried this vQmod. It said "Coupon applied succesful", although its' shown value was zero at checkout. Any solution to display "Coupons are not eligible for special products"?

**I'm using Open Cart 1.5.4.1 on http://www.importpieseauto.ro**

Oh, didn't try it with 2 products. That's good though.

Thank you!

Thank you!

**I'm using Open Cart 1.5.4.1 on http://www.importpieseauto.ro**

Thank you! Can check something else off my "need to fix" list!

Running Opencart v2.2 with multi-stores from http://www.labeshops.com which has links to all my stores.

Is there a possibility to use or modify the file for Voucher ?

I know that if someone had bought me a gift voucher to a website and then when I went to use it on a product I couldn't as it was already on sale would disappoint me, stopping an already discounted item from being discounted further is one thing but this seems to be penalising your customers for buying and using a gift voucher from you instead of using cash...Angelheart29 wrote:Is there a possibility to use or modify the file for Voucher ?

Just my opinion from the side of a customer as well as a eCommerce website owner.

but

when I tried with 2 products 1 Special & 1 Regular the coupon set discount of $5.00 is showing less actually, it showed $4.38

Any idea why it is not showing the right amount as per coupon.

Thanks

The mod does account for fixed / percentage correctly, it just depends on your definition of correctly!

There are two ways this COULD work, but obviously only 1 of those options can actually be applied (without a lot of headache and extra options in admin pages etc etc etc)...

NB: In the following examples I will use Prod 1 = $20.00, Prod 2 = $10.00, Basket total = $30.00

Method 1: Fixed discounts could / should be deducted from the basket total, so a discount code for $10 is always $10

Method 2: Fixed discounts get deducted as a percentage per product

Example method 1: Basket total = $30 :: Discounted total = $20

Example method 2: Prod 1 discount = $6.6666, Prod 2 discount = $3.3333 :: Total discount = $9.9999 :: Discounted total = $30 - $9.9999 = $20.0001

I'm not quite sure why, but when the mod was written it was obviously decided that method 2 was the way to go.

As a result of this, when we apply the FREE vqmod above which skips products with special prices, the portion of discount that would have been applied to that product is no longer applied, so if Prod 1 was actually using a special price, the discount would get ignored and the basket total would become:

Prod 1 discount: *skipped*

Prod 2 discount: $3.3333

Total discount: $3.3333

Discounted total: $30 - $3.3333 = $26.6667

In order to get method 1 working, you would need to disable the "fixed rate" portion of the existing coupons code, then add some new code elsewhere which deducts the fixed rate discount from the final basket price (and adjusts taxes accordingly too).

[EDIT] As far as I can tell, it has been written this way so that a discount code cant cause a product to become a loss for the retailer, e.g. if I reduce the sale price of a product to my cost price (e.g. because I want to clear the stock) then I don't want someone to be able to get 10% off that price as this would mean they have bought the product from me for less than what I paid for it from my supplier!

There are two ways this COULD work, but obviously only 1 of those options can actually be applied (without a lot of headache and extra options in admin pages etc etc etc)...

NB: In the following examples I will use Prod 1 = $20.00, Prod 2 = $10.00, Basket total = $30.00

Method 1: Fixed discounts could / should be deducted from the basket total, so a discount code for $10 is always $10

Method 2: Fixed discounts get deducted as a percentage per product

Example method 1: Basket total = $30 :: Discounted total = $20

Example method 2: Prod 1 discount = $6.6666, Prod 2 discount = $3.3333 :: Total discount = $9.9999 :: Discounted total = $30 - $9.9999 = $20.0001

I'm not quite sure why, but when the mod was written it was obviously decided that method 2 was the way to go.

As a result of this, when we apply the FREE vqmod above which skips products with special prices, the portion of discount that would have been applied to that product is no longer applied, so if Prod 1 was actually using a special price, the discount would get ignored and the basket total would become:

Prod 1 discount: *skipped*

Prod 2 discount: $3.3333

Total discount: $3.3333

Discounted total: $30 - $3.3333 = $26.6667

In order to get method 1 working, you would need to disable the "fixed rate" portion of the existing coupons code, then add some new code elsewhere which deducts the fixed rate discount from the final basket price (and adjusts taxes accordingly too).

[EDIT] As far as I can tell, it has been written this way so that a discount code cant cause a product to become a loss for the retailer, e.g. if I reduce the sale price of a product to my cost price (e.g. because I want to clear the stock) then I don't want someone to be able to get 10% off that price as this would mean they have bought the product from me for less than what I paid for it from my supplier!

Web developer for Cotswold Web Services / Innuo Ltd

Need help with your Opencart website? Give us a call to see how we can help.

i have 2 products in cart

1. 189 (normal price)

2. 159 (special price from 189)

my coupon value is 100 (not percentage) . After applying the coupon it shows a discount of 54...

We don't have VAT or any kind of other taxes.

Why is the discount 54 and not 100?

If you made it work, can you please help me, i can't do it myself.markdyer wrote:The product is that this mod is not taking into account fixed/percentage correctly. When using a fixed discount the sub total also needs to exclude items that are on special.. I played around with the coupon system today and got it working but it requires more then this mod details.. correct me if I'm wrong.

Who is online

Users browsing this forum: No registered users and 4 guests