Jump to content

Way to set default "tax rule" on product in BO scroll down?


Recommended Posts

I am in the US, and use the same tax rate for all of my products. All products, except for a few downloads, have the same tax rate. As it is now, I have to change the scroll down from 'no tax' to US-AL Rate (6%) for each product that I add. Is there a way to have the scroll down set to US-AL Rate (6%) default, then scroll down for No Tax? Can someone help this non coder change this default? It would sure same me a lot of time in building my website.

 

I have PS 1.4.7 and am using the new template.

 

Thanks!

Dixie

Link to comment
Share on other sites

  • 2 weeks later...

Line numbers might be wrong since I run 1.4.4.1 with mods and patched updates..

 

Use phpmyadmin and view browse ps_tax_rules_group and find the 'id_tax_rules_group' value for your tax rule.

 

Note that number and now open up /admin/tabs/AdminProducts.php

 

On line 2543 (?) you'll find:

 

echo '<option value="'.$tax_rules_group['id_tax_rules_group'].'" '.(($this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group']) ? ' selected="selected"' : '').'>'.Tools::htmlentitiesUTF8($tax_rules_group['name']).'</option>';

 

change

$this->getFieldValue($obj, 'id_tax_rules_group') == $tax_rules_group['id_tax_rules_group']

 

to

 

$tax_rules_group['id_tax_rules_group'] == #

 

# being the id number you took from the database

 

now it will default to that #

Link to comment
Share on other sites

  • 6 months later...
  • 2 weeks later...

Any solution here? I need to make the same mod.

 

I found a file called AdminProductsController.php in /controllers/admin/ and it has this line:

 

$this->object->id_tax_rules_group = (int)Tools::getValue('id_tax_rules_group');

 

 

Would this be the line to adjust and if so, how?

 

Many thanks for any help.

Edited by betyonfire (see edit history)
Link to comment
Share on other sites

  • 1 month later...

For 1.5.2

PLEASE NOTE THIS WILL CHANGE ALL YOUR EXISTING PRODUCTS TAX RATES TO THE DEFAULT RATE.

This means you're retail prices will change if they are not at the default rate. Only use it if you have only one tax rate.

 

Use phpmyadmin and view browse ps_tax_rules_group and find the 'id_tax_rules_group' value for your tax rule.

 

Note that number and now open up \admin\themes\default\template\controllers\products\prices.tpl

On line 165

 

Replace the # below with the 'id_tax_rules_group' value for your tax rule.

 

 

Replace

<option value="{$tax_rules_group.id_tax_rules_group}" {if $product->getIdTaxRulesGroup() == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >

 

With

<option value="{$tax_rules_group.id_tax_rules_group}" $tax_rules_group['id_tax_rules_group'] == # selected="selected">

Edited by stevell (see edit history)
Link to comment
Share on other sites

Tried the above but doesn't work.

No tax is replaced with 6% (id_tax_rules_group 3) as default when I use id_tax_rules_group 7 (25%). Actually I get 6% no matter which id_tax_rules_group number I use.

 

Edit: Another thing: All existing products still have 25% VAT after the change, BUT if I edit them, VAT is changed to 6%

 

/Mats

Edited by mohsart (see edit history)
Link to comment
Share on other sites

  • 3 years later...

ok, solution in prestashop 1.6

 

go to Control Panel and note the "id" tax rule you want to make the default.

Now go to the file \admin\themes\default\template\controllers\products\prices.tpl line 161

 

you see: <option value="{$tax_rules_group.id_tax_rules_group}" {if $product->getIdTaxRulesGroup() == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >

 

then change $product->getIdTaxRulesGroup() and instead put the desired id tax group.

 

example: <option value="{$tax_rules_group.id_tax_rules_group}" {if 5 == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >

 

Now that rule is the tax that is default

 

But...... to not overwrite the original file must use the override folder the root of prestashop to overwrite the file.

 

then, copy the file prices.tpl and paste it in /override/controllers/admin/templates/products (create the folder products)

now you can chage de prices.tpl file without change the original file.

Link to comment
Share on other sites

  • 4 years later...
  • 2 years later...
On 1/30/2016 at 10:23 AM, codigoworkshop said:

ok, solution in prestashop 1.6

 

go to Control Panel and note the "id" tax rule you want to make the default.

Now go to the file \admin\themes\default\template\controllers\products\prices.tpl line 161

 

you see: <option value="{$tax_rules_group.id_tax_rules_group}" {if $product->getIdTaxRulesGroup() == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >

 

then change $product->getIdTaxRulesGroup() and instead put the desired id tax group.

 

example: <option value="{$tax_rules_group.id_tax_rules_group}" {if 5 == $tax_rules_group.id_tax_rules_group}selected="selected"{/if} >

 

Now that rule is the tax that is default

 

But...... to not overwrite the original file must use the override folder the root of prestashop to overwrite the file.

 

then, copy the file prices.tpl and paste it in /override/controllers/admin/templates/products (create the folder products)

now you can chage de prices.tpl file without change the original file.

Hi, does anyone know how to do the exact same thing in the Carrier Wizard? Thank you!

Link to comment
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
×
×
  • Create New...