Community Forums

[MOD] Default Tax class

Free manual modifications can be contributed here. Modifications are manual snippets of code that are pasted into the forums for others to use.

[MOD] Default Tax class

Postby bcfl » Sat Sep 11, 2010 10:27 am

I am setting up a new store and will have customers picking up product as well as shipping across the US.
When I add product, under the data tab, how do I change the tax class from the default (---None---) to the tax rate I have setup, (the tax is already set up and is in the dropdown).
Thanks, bob
Last edited by i2Paq on Tue Sep 14, 2010 4:39 pm, edited 1 time in total.
Reason: Title adjusted + Topic moved
bcfl
 
Posts: 60
Joined: Mon Jan 25, 2010 9:34 pm

Re: Change Default

Postby i2Paq » Sat Sep 11, 2010 11:45 am

I'm not sure if I understand your question but you can change it per product...
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend & betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 9857
Joined: Mon Nov 09, 2009 11:00 am
Location: Winkel - The Netherlands

Re: Change Default

Postby bcfl » Sat Sep 11, 2010 1:59 pm

That I understand, but if you are entering a large number of items sometimes you forget to make the selection, so I would like the default to be (in my case) FL tax 6% as the default and the None choice as an option. In the Tax Class drop down.
does that help, thanks bob
bcfl
 
Posts: 60
Joined: Mon Jan 25, 2010 9:34 pm

Re: Change Default

Postby i2Paq » Sat Sep 11, 2010 3:34 pm

So you want to set a default tax-class for products.

This is not possible atm.
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend & betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 9857
Joined: Mon Nov 09, 2009 11:00 am
Location: Winkel - The Netherlands

Re: Change Default

Postby bcfl » Sat Sep 11, 2010 11:22 pm

Yes, I understand, should I submit a feature request?
bcfl
 
Posts: 60
Joined: Mon Jan 25, 2010 9:34 pm

Re: Change Default

Postby i2Paq » Sun Sep 12, 2010 9:29 am

bcfl wrote:Yes, I understand, should I submit a feature request?


I think you have a legit feature request here ;)
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend & betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 9857
Joined: Mon Nov 09, 2009 11:00 am
Location: Winkel - The Netherlands

Re: Change Default

Postby fido-x » Sun Sep 12, 2010 10:37 am

i2Paq wrote:So you want to set a default tax-class for products.

This is not possible atm.

Yes it is!

Try this.
In "admin/controller/setting/setting.php" (before the $ignore array), insert the following:
Code: Select all
// Default tax class
$this->data['entry_tax_class'] = $this->language->get('entry_tax_class');
$this->load->model('localisation/tax_class');
$this->data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
if (isset($this->request->post['config_tax_class_id'])) {
    $this->data['config_tax_class_id'] = $this->request->post['config_tax_class_id'];
}
 else {
    $this->data['config_tax_class_id'] = $this->config->get('config_tax_class_id');
}
// End default tax class    

In the language file (admin/language/english/setting/setting.php), insert the following:
Code: Select all
// Default tax class
$_['entry_tax_class']         = 'Default Tax Class:'; 

And the template file (admin/view/template/setting/setting.tpl), insert the following at around line 214:
Code: Select all
<tr>
  <td><?php echo $entry_tax_class; ?></td>
  <td><select name="config_tax_class_id">
      <option value="0"><?php echo $text_none; ?></option>
      <?php foreach ($tax_classes as $tax_class) { ?>
      <?php if ($tax_class['tax_class_id'] == $config_tax_class_id) { ?>
      <option value="<?php echo $tax_class['tax_class_id']; ?>" selected="selected"><?php echo $tax_class['title']; ?></option>
      <?php } else { ?>
      <option value="<?php echo $tax_class['tax_class_id']; ?>"><?php echo $tax_class['title']; ?></option>
      <?php } ?>
      <?php } ?>
    </select></td>
</tr>

Then, in "admin/controller/catalog/product.php", change line 821 from:
Code: Select all
$this->data['tax_class_id'] = 0; 

to:
Code: Select all
$this->data['tax_class_id'] = $this->config->get('config_tax_class_id'); 

You should then be able to set the default tax class under the "Local" tab in your settings.
Image
If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: Change Default

Postby bcfl » Tue Sep 14, 2010 12:43 pm

Thank you very much, I will give this a shot and let you know.
Thanks Again bob
bcfl
 
Posts: 60
Joined: Mon Jan 25, 2010 9:34 pm

Re: Change Default

Postby bcfl » Tue Sep 14, 2010 1:14 pm

Awesome - works like a charm THANK YOU,

Thanks Again, bob
bcfl
 
Posts: 60
Joined: Mon Jan 25, 2010 9:34 pm

Re: Change Default

Postby i2Paq » Tue Sep 14, 2010 4:39 pm

Yep, Thanks!
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend & betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 9857
Joined: Mon Nov 09, 2009 11:00 am
Location: Winkel - The Netherlands

Re: Change Default

Postby cantykiwi » Thu Sep 16, 2010 6:55 am

Exxxxxxxxxxcellent code mod fido-x!!! ;D
cantykiwi
 
Posts: 63
Joined: Mon Sep 13, 2010 4:37 am

Re: [MOD] Default Tax class

Postby tommyla » Thu Jan 27, 2011 11:02 am

this should be added in offical version, its super useful
btw this mod works for 1.4.9.3
tommyla
 
Posts: 144
Joined: Wed Jul 22, 2009 1:49 pm
Location: Norway

Re: [MOD] Default Tax class

Postby fido-x » Thu Jan 27, 2011 2:22 pm

And here's the vQmod file.

default_tax_class.xml
(2.53 KiB) Downloaded 280 times
Image
If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: [MOD] Default Tax class

Postby i2Paq » Sat Jul 23, 2011 9:40 am

Could you update this to work with 1.5.x please?

Thanks! :yahoo:
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend & betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 9857
Joined: Mon Nov 09, 2009 11:00 am
Location: Winkel - The Netherlands

Re: [MOD] Default Tax class

Postby tommyla » Sat Jul 23, 2011 9:48 am

i2Paq wrote:Could you update this to work with 1.5.x please?

Thanks! :yahoo:

i just +1 ed this one on google+ :p
tommyla
 
Posts: 144
Joined: Wed Jul 22, 2009 1:49 pm
Location: Norway

Re: [MOD] Default Tax class

Postby fido-x » Sat Jul 23, 2011 12:03 pm

OK, you asked for it, so here it is.

Default Tax Class for OpenCart 1.5.1 (should work for 1.5.0.x as well).

default_tax_class_15x.xml
(2.57 KiB) Downloaded 305 times
Image
If you're not living on the edge ... you're taking up too much space!
Multi-Vendor Plugin for OpenCart 1.5.1.x
Have I helped you?
User avatar
fido-x
 
Posts: 1960
Joined: Fri Jun 27, 2008 5:09 pm
Location: Tasmania, Australia

Re: [MOD] Default Tax class

Postby tommyla » Sat Jul 23, 2011 12:12 pm

fido-x wrote:OK, you asked for it, so here it is.

Default Tax Class for OpenCart 1.5.1 (should work for 1.5.0.x as well).

default_tax_class_15x.xml

boooja! :crazy:
tommyla
 
Posts: 144
Joined: Wed Jul 22, 2009 1:49 pm
Location: Norway

Re: [MOD] Default Tax class

Postby i2Paq » Sun Jul 24, 2011 9:21 am

I see entry_tax_class, I have Dutch and English set-up.
In English it is OK, do I need anything to get it also in Dutch?

Edit:

I see, I needed to add the Dutch related settings in the xml.
Norman in 't Veldt
Moderator OpenCart Forums

_________________ READ and Search BEFORE POSTING _________________
Our FREE search: Find your answer FAST!.

FREE manuals: ShowMe Guides OpenCart, Opencart Check List and Our Documentation section.

BUGs?: Known BUGS for All OC Versions.

[How to] BTW + Verzend & betaalmethodes.
User avatar
i2Paq
Global Moderator
 
Posts: 9857
Joined: Mon Nov 09, 2009 11:00 am
Location: Winkel - The Netherlands

Re: [MOD] Default Tax class

Postby webbert » Mon Oct 10, 2011 6:51 am

where to install the "default_tax_class_15x.xml"?
webbert
 
Posts: 6
Joined: Tue Dec 29, 2009 9:07 pm

Re: [MOD] Default Tax class

Postby haydent » Wed Nov 09, 2011 3:53 am

ok here's my quick and dirty hard coded approach for Version 1.5.1.3 (thoery will work with other versions if my example doesnt)

open "admin/controller/catalog/product.php" go to line 832 or where you find:

Code: Select all
$this->data['tax_class_id'] = 0;


and change it to equal the id for your tax class you want default, this can be found in the url of the edit page for that class

ie: admin/index.php?route=localisation/tax_class/update&token=cb9c3c67af54oueu440d7efe8983257&tax_class_id=9

So in my case i change it to:

Code: Select all
$this->data['tax_class_id'] = 9;


that is it. :crazy:

but keep in mind it wont adapt if you delete that tax class and recreate it...
User avatar
haydent
 
Posts: 53
Joined: Wed Nov 09, 2011 1:50 am
Location: Sydney, Australia

Next

Return to Modifications

Who is online

Users browsing this forum: No registered users and 4 guests

Hosted by Arvixe Web Hosting