Forums / Setting Up Specials and SaleMaker / Buy one get one free, tax calculation problem

Buy one get one free, tax calculation problem

Views: 8,495

Results 1 to 13 of 13
13 Oct 2016, 1:42 PM
#1
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Buy one get one free, tax calculation problem

Dear members,

I encounter a problem after installing the plugin 'Buy one get one free'
I installed it in a testversion of my online store and the problem is that the tax rate isn't calculating correctly.
When the products you want to sell f.e. buy 4 get 1 for free, the program calculates 4 times the price, then it substracts 1 time the price. Ok so far
But then comes the tax calculation. And here it calculates the tax on the subtotal ( 4 * price).

Attachment 16730

See this example.
Anyone knows how to adjust this?

Many thanks.

Koen

13 Oct 2016, 2:10 PM
#2
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Buy one get one free, tax calculation problem

on the admin -> modules -> order-totals -> ot_bogo is the configuration for this module. there is a tax_class there. is that set to the same tax class as for your products?

it seems that this should be a configuration that is not correct for the module.

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

13 Oct 2016, 2:23 PM
#3
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Re: Buy one get one free, tax calculation problem

Maybe I have another plugin installed. I couldn't adjust the tax rate. Only sort order.

13 Oct 2016, 6:16 PM
#4
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Buy one get one free, tax calculation problem

i'm not sure why that is not there. you need to check the value of:

MODULE_ORDER_TOTAL_BOGO_TAX_CLASS

you can also get there with this URL:

https://yoursite.com/YOUR_ADMIN/configuration.php?gID=6

although there are quite of few other values there, that you do not want to alter.

you want to find that configuration value and ensure that its tax class is set to the same tax class as your products.

in addition, it looks like if you have NOT logged in, it will not deduct the tax from the discount. there needs to be a customer_id in the SESSION else it will not subtract the discount.

i have not installed this module, from the code that is what it looks like; and it looks like it should work.

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

13 Oct 2016, 6:29 PM
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Buy one get one free, tax calculation problem

carlwhat:

you need to check the value of:

MODULE_ORDER_TOTAL_BOGO_TAX_CLASS

you can also get there with this URL:

https://yoursite.com/YOUR_ADMIN/configuration.php?gID=6
It's a lot simpler and safer to use the Admin->Tools->Developers Tool Kit and just paste MODULE_ORDER_TOTAL_BOGO_TAX_CLASS into the first input field.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2016, 5:00 AM
#6
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Re: Buy one get one free, tax calculation problem

Hello to you all and thanks for replying on my problem.

This value isn't there yet: MODULE_ORDER_TOTAL_BOGO_TAX_CLASS. But there are two plugins available on the zen cart website for 'BOGO'
One called Buy1get1free. In this one you can enter how many articles you want to sell and how many the costumer get's for free at the bottom of the article adjustment page. This is the plugin I'm using at this moment because is easy to use, but it's without the tax rate :(.
The other plugin, I think the one carlwhat is referring is the one called BOGO and here you can enter tax rates in the admin -> Modules -> order total but here I have to give on entire category and not only one product and that's a bit of a gap for me I think.
What I'm trying to do is to change the code of the plugin I'm using that the value of the discount is the value tax included. So then you get subtotal - discount ( tax included ) + shipping + tax ( from subtotal) = total price.

14 Oct 2016, 5:04 AM
#7
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Re: Buy one get one free, tax calculation problem

Maybe just for explaining even more:

Attachment 16732

Attachment 16733

14 Oct 2016, 5:47 AM
#8
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Buy one get one free, tax calculation problem

I'm not familiar with the module you're using.
But it might be worth reading here: http://www.thatsoftwareguy.com/zencart_bogo_bonanza.html ... several of his Zen Cart plugins are also in the Zen Cart downloads area and have support threads here on these forums.

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

14 Oct 2016, 8:30 AM
#9
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Re: Buy one get one free, tax calculation problem

if($_SESSION['cost_minimize_agg'] > 0){
$this->output[] = array('title' => $this->title . ':',
'text' => '-' . $currencies->format($_SESSION['cost_minimize_agg']+$order->info['tax'], true, $order->info['currency'], $order->info['currency_value']),
'value' => $_SESSION['cost_minimize_agg']);

This is what I have added in the code and here lies the solution for my problem I think.
Just that now the free articles are have the entire tax extra and not for just the amount of articles that are free.
Anyone knows a solution to that?

14 Oct 2016, 9:03 AM
#10
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Re: Buy one get one free, tax calculation problem

Problem solved
Afterward you always would hit your one head.

'text' => '-' . $currencies->format($_SESSION['cost_minimize_agg']+COLOR=#008000[/COLOR], true, $order->info['currency'], $order->info['currency_value']),
'value' => $_SESSION['cost_minimize_agg']);

In my case there is a tax rate off 6% for all my products (for now...)
So I have added this amount of tax 'manually'.

14 Oct 2016, 3:06 PM
#11
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Buy one get one free, tax calculation problem

On the surface that appears to address what is seen, but when charged, is the correct amount "taken"? I'm also not familiar with the plugin, but the above code change appears to only address one output characteristic and wouldn't want you to be surprised to be charged more than displayed.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Oct 2016, 5:36 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,515
Plugin Contributions:
176

Re: Buy one get one free, tax calculation problem

Tax is usually done by using zen_add_tax() and passing the relevant tax rates, and then passing that result to the currency->format().

Looks like this particular BOGO module wasn't written with tax in mind?

.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole

Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

18 Oct 2016, 4:04 AM
#13
koen_de_wilde avatar

koen_de_wilde

New Zenner

Join Date:
Oct 2016
Location:
Belgium
Posts:
8
Plugin Contributions:
0

Re: Buy one get one free, tax calculation problem

Dear DrByte,

It's seem that this module isn't write with tax in mind indeed. But for now it works fine the way I have changed the program code.

It looks like this:

function process() {
global $order, $currencies;
$order->info['total'] = $order->info['total'] - $_SESSION['cost_minimize_agg']-($_SESSION['cost_minimize_agg']*0.06);

      if($_SESSION['cost_minimize_agg'] > 0){
          $this->output[] = array('title' => $this->title . ':',
                              'text' => '-' . $currencies->format($_SESSION['cost_minimize_agg']+($_SESSION['cost_minimize_agg']*0.06), true, $order->info['currency'], $order->info['currency_value']),
                              'value' => $_SESSION['cost_minimize_agg']);