Jump to content

Set tax class on all products?


StreamAlex
 Share

Recommended Posts

Yes but it has to be done with the "Maintenance" >> "Query Database" tool. Once you know the tax ID number run this query. In this case I assume it is the number 1. 

UPDATE `CubeCart_inventory` SET `tax_type` = 1;

You could also do this with a tool such as phpMyAdmin.

 

Thank you! That worked like a charm. Is it also possible to change the default tax type to always be 1?

Link to comment
Share on other sites

In the file /admin/sources/products.index.inc.php, find near line 1000 (could be a couple dozen lines away in either direction):

// Get tax classes
if (($taxes = $GLOBALS['db']->select('CubeCart_tax_class')) !== false) {
  foreach ($taxes as $tax) {
    $tax['selected'] = (isset($result[0]['tax_type']) && $tax['id'] == $result[0]['tax_type']) ? ' selected="selected"' : '';
    $smarty_data['taxes'][]    = $tax;
  }
  $GLOBALS['smarty']->assign('TAXES', $smarty_data['taxes']);
}

Change to:

 
// Get tax classes
if (($taxes = $GLOBALS['db']->select('CubeCart_tax_class')) !== false) {
  foreach ($taxes as $tax) {
    if(isset($result[0]['tax_type']) && $tax['id'] == $result[0]['tax_type']) { $tax['selected'] = ' selected="selected"'; }
    elseif(empty($result[0]['tax_type']) && $tax['id'] == 1) { $tax['selected'] = ' selected="selected"'; }
    $smarty_data['taxes'][]    = $tax;
  }
  $GLOBALS['smarty']->assign('TAXES', $smarty_data['taxes']);
}

This will make the tax having the ID of 1 be 'selected' as long as the product does not yet have a tax assigned to it.

 

(I haven't tried this myself, but a similar solution was developed for the Google_Category chooser.)
 

Edit: Typos fixed.

Link to comment
Share on other sites

There seems to be several places where this can be forced 'on', but we only want it forced on when adding a new product.

 

Try near line 940, there is this:

// Breadcrumb
$GLOBALS['gui']->addBreadcrumb($lang['catalogue']['product_add'], $_GET);
$result[0] = array(
  'featured' => 1,
  'tax_inclusive' => 0,
  'use_stock_level' => 1,
);

Make it 'tax_inclusive' => 1,

Link to comment
Share on other sites

  • 1 year later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...