Forums / General Questions / Where is Tax / Product-Price-calculation php file ?

Where is Tax / Product-Price-calculation php file ?

Views: 2,277

Results 1 to 14 of 14
15 Jan 2014, 1:32 PM
#1
akasashasha avatar

akasashasha

Zen Follower

Join Date:
Mar 2009
Location:
France
Posts:
158
Plugin Contributions:
0

Where is Tax / Product-Price-calculation php file ?

Hello,

on a product when we change the "Tax Class" the "Product price gross" is automatically re-calculated based on "Product price net" + new "Tax Class" ...
I would like to modify this feature so that when I change a tax, the "Product price gross" stay the same and the "Product price net" change ... there have been a recent up in the French taxes but I want to keep the same selling prices for my customers.
problem is that I still didn't found in which php file all this is located ...

thanks for your help

15 Jan 2014, 1:36 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Where is Tax / Product-Price-calculation php file ?

Akasashasha:

problem is that I still didn't found in which php file all this is located ...

This is performed by a little bit of Javascript.
sorry, but I don't know if this javascript is embeded in one (or more) of the .php files, or if it is a separate javascript file that gets loaded by the php files.

Hope this is of some help until/unless someone gives a more definitive answer.

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

15 Jan 2014, 1:42 PM
#3
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Where is Tax / Product-Price-calculation php file ?

Akasashasha:

Hello,

on a product when we change the "Tax Class" the "Product price gross" is automatically re-calculated based on "Product price net" + new "Tax Class" ...
I would like to modify this feature so that when I change a tax, the "Product price gross" stay the same and the "Product price net" change ... there have been a recent up in the French taxes but I want to keep the same selling prices for my customers.
problem is that I still didn't found in which php file all this is located ...

thanks for your help

We had the same problem in The Netherladns last year. I have a sql script somewhere that keeps the Product price gross the original one, but updates all Net prices in the database.
Give me some time this afternoon so I can find it for you

15 Jan 2014, 1:54 PM
#4
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Where is Tax / Product-Price-calculation php file ?

Design75:

We had the same problem in The Netherladns last year. I have a sql script somewhere that keeps the Product price gross the original one, but updates all Net prices in the database.
Give me some time this afternoon so I can find it for you

found it! BACKUP BEFORE YOU USE THIS !!!

UPDATE products
SET products_price = products_price * 0.9835,
products_price_sorter = products_price_sorter * 0.9835,
products_last_modified = NOW()
WHERE products_tax_class_id = 1;

I which 0.9835 = 119/121
119= old tax ->100%(net price) + 19%(tax)
121= new tax ->100%(net price) + 21%(tax)

Also check your products_tax_class_id, this will prevent products with another tax class id to be updated to

For specials:

UPDATE specials
SET specials_new_products_price = specials_new_products_price * 0.9835,
specials_last_modified = NOW();

for attributes

UPDATE  products_attributes
SET options_values_price = options_values_price * 0.9835
15 Jan 2014, 2:07 PM
#5
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Where is Tax / Product-Price-calculation php file ?

Design75:

I have a sql script somewhere that keeps the Product price gross the original one, but updates all Net prices in the database.

I guess we had a different take on the question. I was thinking the 'real time' recalculations that take place, whereas your solution is a global 'post change' adjustment.

Oh well, one is sure to be helpful :) :)

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.

15 Jan 2014, 2:16 PM
#6
akasashasha avatar

akasashasha

Zen Follower

Join Date:
Mar 2009
Location:
France
Posts:
158
Plugin Contributions:
0

Re: Where is Tax / Product-Price-calculation php file ?

RodG:

I guess we had a different take on the question. I was thinking the 'real time' recalculations that take place, whereas your solution is a global 'post change' adjustment.

actually I would be interested in both solutions ...

Design 75 :
if I understood properly I would have to do this :
So if I understood properly here is the sql I should use :

UPDATE products
SET products_price = products_price * 0.9966,
products_price_sorter = products_price_sorter * 0.9966,
products_last_modified = NOW()
WHERE products_tax_class_id = 2;
UPDATE specials
SET specials_new_products_price = specials_new_products_price * 0.9966,
specials_last_modified = NOW()
WHERE products_tax_class_id = 2;
UPDATE  products_attributes
SET options_values_price = options_values_price * 0.9966,
products_last_modified = NOW()
WHERE products_tax_class_id = 2;

0.9966 = 1.196/1.20
1.196= old tax ->100%(net price) + 19.6%(tax)
1.20= new tax ->100%(net price) + 20%(tax)

tax class id 2 is the old tax 19,6% …

nother point : is there a missing , after "NOW()" ?

15 Jan 2014, 2:40 PM
#7
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Where is Tax / Product-Price-calculation php file ?

Akasashasha:

actually I would be interested in both solutions ...

Design 75 :
if I understood properly I would have to do this :
So if I understood properly here is the sql I should use :

UPDATE products
SET products_price = products_price * 0.9966,
products_price_sorter = products_price_sorter * 0.9966,
products_last_modified = NOW()
WHERE products_tax_class_id = 2;

> 
> ```
UPDATE specials
SET specials_new_products_price = specials_new_products_price * 0.9966,
specials_last_modified = NOW()
WHERE products_tax_class_id = 2;

UPDATE products_attributes
SET options_values_price = options_values_price * 0.9966,
products_last_modified = NOW()
WHERE products_tax_class_id = 2;

> 
> 0.9966 = 1.196/1.20
> 1.196= old tax ->100%(net price) + 19.6%(tax)
> 1.20= new tax ->100%(net price) + 20%(tax) 
> 
> tax class id 2 is the old tax 19,6% … 
> 
> nother point : is there a missing , after "NOW()" ?

That seems to be okay. Technically it should be 0.9967, according to the math rules 119,6/120=0,9966666666666667 

There is no , missing after "NOW()".
15 Jan 2014, 2:50 PM
#8
akasashasha avatar

akasashasha

Zen Follower

Join Date:
Mar 2009
Location:
France
Posts:
158
Plugin Contributions:
0

Re: Where is Tax / Product-Price-calculation php file ?

last question : on the admin / catalog /products page, will this solution set the "tax class" to the new one (for me from 19,6% to 20%) ? or are we just changing the prices without touching to the products "tax class" (in which case the "tax class" dropdown will still diplay 19,6% ?

15 Jan 2014, 2:53 PM
#9
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Where is Tax / Product-Price-calculation php file ?

Akasashasha:

last question : on the admin / catalog /products page, will this solution set the "tax class" to the new one (for me from 19,6% to 20%) ? or are we just changing the prices without touching to the products "tax class" (in which case the "tax class" dropdown will still diplay 19,6% ?

Are you still using products with 19.6% tax? Otherwise just update the clas to 20% then you will not have to change the class on all your products

15 Jan 2014, 2:56 PM
#10
akasashasha avatar

akasashasha

Zen Follower

Join Date:
Mar 2009
Location:
France
Posts:
158
Plugin Contributions:
0

Re: Where is Tax / Product-Price-calculation php file ?

but if I update the class to 20% then the gross price will change which is the thing i want to avoid ...

15 Jan 2014, 3:38 PM
#11
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Where is Tax / Product-Price-calculation php file ?

Akasashasha:

but if I update the class to 20% then the gross price will change which is the thing i want to avoid ...

not in combination wit the SQL,

The SQL lowers the net price according to the new tax value, so when you change the tax class to 20% it will still show the right gross price.
the net price is stored in the database, and the gross price is always calculated

20 Jan 2014, 1:10 PM
#12
akasashasha avatar

akasashasha

Zen Follower

Join Date:
Mar 2009
Location:
France
Posts:
158
Plugin Contributions:
0

Re: Where is Tax / Product-Price-calculation php file ?

Design75:

not in combination wit the SQL,

The SQL lowers the net price according to the new tax value, so when you change the tax class to 20% it will still show the right gross price.
the net price is stored in the database, and the gross price is always calculated

thanks a lot ! that worked perfectly ... tried it on test site and went live.

In case other people use it, one more detail : you need to first change the VAT (for me I updated the VAT from 19,6% to 20%) and THEN apply the SQL via the Admin / Tools / Install SQL Patches ....

21 Jan 2014, 9:38 AM
#13
akasashasha avatar

akasashasha

Zen Follower

Join Date:
Mar 2009
Location:
France
Posts:
158
Plugin Contributions:
0

Re: Where is Tax / Product-Price-calculation php file ?

one last question : I'm getting the following message when trying to update the attributes :

Failed: 1
Error ERROR: Cannot execute because table does not exist. CHECK PREFIXES!
Warning Note: 1 statements ignored. See "upgrade_exceptions" table for additional details.

We've been checking the prefixes and re-tryed with and without the prefixes but got the same error message ...

21 Jan 2014, 9:58 AM
#14
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: Where is Tax / Product-Price-calculation php file ?

Akasashasha:

one last question : I'm getting the following message when trying to update the attributes :
See "upgrade_exceptions" table for additional details.

Perhaps those 'additional details' will be useful to know?

Cheers
RodG

NOTE: We are sorry that Rod is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

Ozpost - The Ultimate Shipping module for Australian Merchants. Click these links for its Homepage, or Download from Zen-Cart.com.