PDA

View Full Version : Default Product Tax Class



michael_s
07-31-2010, 03:00 PM
The idea behind this modification is to allow you to choose the default tax class to use when entering new products. Most physical products sold by online stores are taxable and therefore it makes sense to automatically set the tax class for each new product to the one used by most items sold by the store rather than the osCommerce default of "none". This helps avoid the error of leaving a product as not taxable when it should be taxable and it helps make data entry somewhat faster since most browsers do not allow you to tab into a drop down menu to set a selection.

I discovered that I could simply the install greatly. If you've already installed it there is no need to change. If not, use these instructions to do the install rather than the older ones.

To install the modification:

1) Using phpMyAdmin or similar utility perform the following query on your database:

insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Default Tax Class', 'DEFAULT_PRODUCT_TAX_CLASS', '1', 'Sets the default tax class used for new products.', '1', '22', '', 'tep_cfg_pull_down_tax_classes(', now());


2) Next make the following file modification:

Open /catalog/admin/categories.php and search for the following line around line 360

if ($action == 'new_product') {
$parameters = array('products_name' => '',
'products_description' => '',
'products_url' => '',
'products_id' => '',
'products_quantity' => '',
'products_model' => '',
'products_image' => '',
'products_price' => '',
'products_weight' => '',
'products_date_added' => '',
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
'products_tax_class_id' => '',
'manufacturers_id' => '');

and change the line for products_tax_class_id from null to DEFAULT_PRODUCT_TAX_CLASS so that your new code will look like this:

if ($action == 'new_product') {
$parameters = array('products_name' => '',
'products_description' => '',
'products_url' => '',
'products_id' => '',
'products_quantity' => '',
'products_model' => '',
'products_image' => '',
'products_price' => '',
'products_weight' => '',
'products_date_added' => '',
'products_last_modified' => '',
'products_date_available' => '',
'products_status' => '',
'products_tax_class_id' => DEFAULT_PRODUCT_TAX_CLASS,
'manufacturers_id' => '');

Save your work and you are done with the install.

Once installed go to your admin and access the Configuration for My Store. Select Default Tax Class from the list and edit the value to choose the tax class used by most products in your store. Once you set the default tax class all new products will default to your chosen option.

More... (http://addons.oscommerce.com/info/3556)