Post by daysgonebyantiques » Sun Dec 20, 2009 10:05 pm

These will always be the same for my store (I created a dummy code for model since I couldn't figure out how to make the model number not required). Is there a file somewhere that I can edit so I won't have to pick this information each time? That'd sure speed things up trying to move items over from my other store!

Days Gone By Antiques & Collectibles
FREE Continental US Shipping! Great gift ideas for ANY time of year!


Active Member

Posts

Joined
Sun Dec 13, 2009 10:02 pm


Post by fido-x » Sun Dec 20, 2009 11:19 pm


Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by daysgonebyantiques » Sat Jun 26, 2010 8:11 pm

Fido, I need you again, buddy. I went here admin/view/template/catalog/product_form.tpl to try and hardwire my tax rate but I didn't have any luck. I tried entering the number 1 because my tax rate is the 2nd choice in the list (and I think the way the numbering would go is 0 and then 1). But I must have been in the wrong file? I'm not sure....

Days Gone By Antiques & Collectibles
FREE Continental US Shipping! Great gift ideas for ANY time of year!


Active Member

Posts

Joined
Sun Dec 13, 2009 10:02 pm


Post by fido-x » Sat Jun 26, 2010 8:41 pm

You can't actually hardwire a "tax rate", as these are applied to customers based on their address. You could, however, hardwire the "tax class", as this is what is applied to the product anyway. The best way to do this, would be to add an extra entry in your settings, to include an option to select a tax class to hardwire to your products. Then, in the product controller (in the getForm() function), you could check if a tax class is hardwired and, if so, automatically apply it.

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by daysgonebyantiques » Sat Jun 26, 2010 8:48 pm

Found it!

/admin/controller/catalog/product.php

Then change this:

$this->load->model('localisation/tax_class');

$this->data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();

if (isset($this->request->post['tax_class_id'])) {
$this->data['tax_class_id'] = $this->request->post['tax_class_id'];
} else if (isset($product_info)) {
$this->data['tax_class_id'] = $product_info['tax_class_id'];
} else {
$this->data['tax_class_id'] = 0;
It worked when I changed to 0, I'm guessing because my only tax rate was the first selection in the drop down and the numbering starts with 0. The default 'select tax rate' or 'selection' text isn't considered numbered as a selection???

Days Gone By Antiques & Collectibles
FREE Continental US Shipping! Great gift ideas for ANY time of year!


Active Member

Posts

Joined
Sun Dec 13, 2009 10:02 pm


Post by daysgonebyantiques » Sat Jun 26, 2010 9:06 pm

Well boo...I don't know now, it's still not working. I must have selected the tax rate and didn't realize it. So I still need help on this.
:(

I really thought I had it!

Days Gone By Antiques & Collectibles
FREE Continental US Shipping! Great gift ideas for ANY time of year!


Active Member

Posts

Joined
Sun Dec 13, 2009 10:02 pm


Post by fido-x » Sun Jun 27, 2010 11:11 am

Like I said:
fido-x wrote:The best way to do this, would be to add an extra entry in your settings, to include an option to select a tax class to hardwire to your products. Then, in the product controller (in the getForm() function), you could check if a tax class is hardwired and, if so, automatically apply it.
Here's how to do it.

In "admin/controller/setting/setting.php", insert the following at around line 797 (before the $ignore array):

Code: Select all

$this->load->model('localisation/tax_class');
$this->data['tax_classes'] = $this->model_localisation_tax_class->getTaxClasses();
$this->data['entry_tax_class'] = $this->language->get('entry_tax_class');
if (isset($this->request->post['config_default_tax_class'])) {
    $this->data['config_default_tax_class'] = $this->request->post['config_default_tax_class'];
} else {
    $this->data['config_default_tax_class'] = $this->config->get('config_default_tax_class');
} 
In "admin/language/english/setting/setting.php", insert:

Code: Select all

$_['entry_tax_class']         = 'Default Tax Class:'; 
In "admin/view/template/setting/setting.tpl", insert the following at line 246:

Code: Select all

<tr>
  <td><?php echo $entry_tax_class; ?></td>
  <td><select name="config_default_tax_class">
      <option value="0"><?php echo $text_none; ?></option>
      <?php foreach ($tax_classes as $tax_class) { ?>
      <?php if ($tax_class['tax_class_id'] == $config_default_tax_class) { ?>
      <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 the product controller (admin/controller/catalog/product.php), find the following (line 814):

Code: Select all

if (isset($this->request->post['tax_class_id'])) {
    $this->data['tax_class_id'] = $this->request->post['tax_class_id'];
} else if (isset($product_info)) {
    $this->data['tax_class_id'] = $product_info['tax_class_id'];
} else {
    $this->data['tax_class_id'] = 0;
} 
and replace with:

Code: Select all

if (isset($this->request->post['tax_class_id'])) {
    $this->data['tax_class_id'] = $this->request->post['tax_class_id'];
} else if (isset($product_info)) {
    $this->data['tax_class_id'] = $product_info['tax_class_id'];
} else if ($this->config->get('config_default_tax_class')) {
    $this->data['tax_class_id'] = $this->config->get('config_default_tax_class');
} else {
    $this->data['tax_class_id'] = 0;
} 

Image
Modules for OpenCart 2.3.0.2
Homepage Module [Free - since OpenCart 0.7.7]
Multistore Extensions
Store Manager Multi-Vendor/Multi-Store management tool

If you're not living on the edge ... you're taking up too much space!


User avatar
Expert Member

Posts

Joined
Sat Jun 28, 2008 1:09 am
Location - Tasmania, Australia

Post by Karen » Fri Jul 23, 2010 5:10 am

Wow...a nice solution, but that's a hell of a lot of code-tinkering just to set the primary tax class automatically.

Is it realistic to hope that this will be coded into future releases??

Using OC version 1.4.8b
http://catandcaboodle.com/


User avatar
Active Member

Posts

Joined
Thu Jun 10, 2010 2:51 pm
Location - WA State, USA
Who is online

Users browsing this forum: No registered users and 43 guests