Jump to content

Recommended Posts

thank you Mr.Raiwa I was wondering if i can apply the discount on the  shopping_cart.php

for example:


SubTotal: $293.87
BOO Sale 15% Discount: -$51.86
Shipping: $0.00
Sales Tax: $27.92
Total: $321.79

Share this post


Link to post
Share on other sites
Posted (edited)

in Order Total:

when i enabled the Module Version 4.4.2 BS Display Discount false to true shopping cart gives a error 500

i am running php5.6

Edited by Kevin.Dallas

Share this post


Link to post
Share on other sites

Revert your installation to the version which was working in your Edge store. Hope you have a backup.

If you need to update to 4.4.2 follow the update instructions. If you didn’t had problems with your previous version, don’t update.

Share this post


Link to post
Share on other sites

2.3.4.1 CE and PHP 7.0

Sorry if this has been addressed before...

I'm using Discount Coupons 4.4.2 BS  with Modular Shopping Cart and have been for quite some time with no problems.

Normally, I just assign a dollar amount or percentage off anything in the website.

What I'm experimenting with is assigning a coupon code for $5 off any purchase of $25 or more from CATEGORY A only.

I've set up the coupon so it only applies only to CATEGORY A.

If I add an item to my cart from CATEGORY A that costs $20, the coupon will not apply.  Which is great, I haven't hit the $25 threshold yet.

But, if I now add an item from ANOTHER category to the cart and hit $25 in the order sub-total, the coupon applies - which I feel is wrong.

I haven't purchased $25 worth of items from CATEGORY A yet - and that is the only category that should be getting the discount.

Is it just me or is this the way it's set up to work?  I get the feeling this all revolves around order sub-total.

- Andrea

Share this post


Link to post
Share on other sites

Hello Andrea,

Yes it is coded like you say, reference is order-subtotal, not amount of discountable products/categories.: Minimum Order Sub-Total:

I understand your concern, but the module doesn't take care for all possible combinations. If it would like you wish, there would be other users needing just like it is now.

I'll think about if this could be implemented with a switcheable option.

rgds
Rainer

Share this post


Link to post
Share on other sites

HI @raiwa - hope you're doing well. 

Yes, I guess I learned that the hard way yesterday.  Had never done that before, trying to assign a coupon to be applied to certain categories only.

That just does not work.  In the end, it's all about the order sub-total.

You do have to have something in your cart from that category to trigger the coupon, but...not necessarily the dollar amount you applied to it.

My dilemma is that I'm also using another discount module called Better Together.

It's set up to offer a Buy 1, Get 1 50% off in a few cats and I was trying to figure out a way to offer a discount coupon that would exclude those categories, since the buyers are already getting discounts to start with.

Last thing I need is someone getting discounts off the first one and then throwing in a $5 coupon code at the end.  Not a good way to make money!

Oh, well.  Lots to think about.  Thank You for replying to my post - your help is always appreciated!

- Andrea

 

 

Share this post


Link to post
Share on other sites

It should, but I don't remember having it tried. Just try, installation is easy and fast.

Share this post


Link to post
Share on other sites
On 8/17/2019 at 2:21 PM, raiwa said:

Hello Omar @Omar_one,

The fact that it aplies only 39€ is correct as it's supposed you will not "pay" to the customer the difference of 11 €. It is coded like this, max discount is always order subtotal.

The tax is not shown as there is zero subtotal ergo tax is also zero.

What is wrong is the negative total. It should be 8€, shipping is not included in discount.  I checked the code and it seems there is a bug inherit since time.

Please change the fillowing in the ot_discount.php module:

Find line 208-212:


                  if (!empty($order_tax)) {
                    $order->info['tax'] = $order_tax;
                  } else {
                    $order->info['total'] -= $discount;
                  }

and change to:


                  if (!empty($order_tax)) {
                    $order->info['tax'] = $order_tax;
                  }

Please confirm and I'll upload this fix.

Hi @raiwa

Warning, I have tested your fix and I found a serious bug when the order is without VAT applied.
In that case discount is not applied in total.

Another way to solve the minor bug related is to apply a "Minimum Order Sub-Total" amount more than the amount of the discount and not equal.
NB: Or not apply "Minimum Order Sub-Total".

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

@milerwan,

Please see this post and use the latest version 5.1.2 where this is fixed.

 

Share this post


Link to post
Share on other sites
36 minutes ago, raiwa said:

@milerwan,

Please see this post and use the latest version 5.1.2 where this is fixed.

 

So what was the fix you applied to solve the issue of @Omar_one ?

By the way, I have taken a look on the "includes/modules/order_total/ot_shipping.php" file and find this sentence :

                      $subtotal_correction +=  $order->products[$i]['final_price']; //use for tax calculation only products which have taxes

But it seems the "$subtotal_correction" variable is alone on the script so it doesn't affect anything normally...
A vestige of a past version that must be removed?


 


Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites
3 hours ago, milerwan said:

So what was the fix you applied to solve the issue of @Omar_one ?

Its in the updated 5.1.2. package. Please download and compare file.

3 hours ago, milerwan said:

By the way, I have taken a look on the "includes/modules/order_total/ot_shipping.php" file and find this sentence :


                      $subtotal_correction +=  $order->products[$i]['final_price']; //use for tax calculation only products which have taxes

But it seems the "$subtotal_correction" variable is alone on the script so it doesn't affect anything normally...
A vestige of a past version that must be removed?

Possible. I'll have a look and remove in the next update. Thank you.

Share this post


Link to post
Share on other sites

@raiwa I find a fix...

To fix the @Omar_one issue when "$discount" amount is superior to "$order_subtotal", find this sentence :

                  if ( tep_not_null($order_tax)) {
                    $order->info['tax'] = $order_tax;
                  } else {
                    $order->info['total'] -= $discount;                  
                  }

or this one :

                  if (!empty($order_tax)) {
                    $order->info['tax'] = $order_tax;
                  } else {
                    $order->info['total'] -= $discount;                  
                  }

And add below this :

                  // fix negative amount BOF
                  if ($order->info['total'] < 0) {
                    $order->info['total'] += $discount;
                  }
                  // fix negative amount EOF

More simple method and works with or without tax added in total.

Edited by milerwan

Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

I remember there were more reasons for this modification and I tested the fix included in 5.1.2 with all variants and settings. I will not begin again and risk to break the code.

Use whatever you wish in your store. Thank you.

Share this post


Link to post
Share on other sites
48 minutes ago, raiwa said:

I remember there were more reasons for this modification and I tested the fix included in 5.1.2 with all variants and settings. I will not begin again and risk to break the code.

Use whatever you wish in your store. Thank you.

Sorry it's because I haven't located the fix...
Now I see it...

You have modify this :

                    $order_tax = 0;

By this :

		    $order_tax = $order->info['tax'];

So yes, it is better than my fix. :)


Osc v2.3.4 BS "custom"
PHP 7.3 compatible (710 modified files => o_O')

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×