StreamAlex Posted November 20, 2013 Share Posted November 20, 2013 Is it possible to change tax class for all products at once? Right now I have about 300 products in my store and it will take a lot of time to change them all individually. Also, is it possible to change default tax class when adding new products? Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted November 20, 2013 Share Posted November 20, 2013 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. Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 20, 2013 Author Share Posted November 20, 2013 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? Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted November 20, 2013 Share Posted November 20, 2013 You could try this: ALTER TABLE `CubeCart_inventory` CHANGE `tax_type` `tax_type` INT( 10 ) UNSIGNED NULL DEFAULT '1' COMMENT 'Tax Type’; Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 20, 2013 Author Share Posted November 20, 2013 Don't seem to work sorry. When I enter that it says that 0 rows was affected. Quote Link to comment Share on other sites More sharing options...
Al Brookbanks Posted November 20, 2013 Share Posted November 20, 2013 Well thats correct. 0 rows will have been affected. Future additions will be however. Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 20, 2013 Author Share Posted November 20, 2013 Sorry, but it didn't work anyway. When I add a new product you still have to choose tax class. But it's that important, if it's now possible to achive it. We just have to remember to change that when we add a product Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 20, 2013 Share Posted November 20, 2013 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. Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 22, 2013 Author Share Posted November 22, 2013 Thank you for your solution but that didn't work unfortunately. When I change the code and upload the file the site goes blank. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 22, 2013 Share Posted November 22, 2013 Sorry, one too many closing parens: elseif(empty($result[0]['tax_type'])) && $tax['id'] == 1) Should be: elseif(empty($result[0]['tax_type']) && $tax['id'] == 1) Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 22, 2013 Author Share Posted November 22, 2013 Sorry, one too many closing parens: elseif(empty($result[0]['tax_type'])) && $tax['id'] == 1) Should be: elseif(empty($result[0]['tax_type']) && $tax['id'] == 1) Fixed that but I still get a blank page when I try to access the products page in admin. Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 22, 2013 Share Posted November 22, 2013 Wow. I must have not had my three cups of coffee when I posted this: Missing the semi-colon that finishes a PHP statement. Change: { $tax['selected'] = ' selected="selected"' } To: { $tax['selected'] = ' selected="selected"'; } in two places. Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 25, 2013 Author Share Posted November 25, 2013 Success! Thank you! One last question. Is it possible to change "Tax included" to always be activated? Quote Link to comment Share on other sites More sharing options...
bsmither Posted November 25, 2013 Share Posted November 25, 2013 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, Quote Link to comment Share on other sites More sharing options...
StreamAlex Posted November 26, 2013 Author Share Posted November 26, 2013 That worked perfectly! Now I'm happy, everything works as I want it to. Thank you so much for all your help, you guys are awesome. Quote Link to comment Share on other sites More sharing options...
GeorgeBlackman Posted March 31, 2015 Share Posted March 31, 2015 Is it possible to set the default tax setting to a tax class that I have made? I've made a 'standard tax' option of 20% for VAT but didn't know whether or not I could set this to be on by default. Thanks! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.