Shipping modules
Store Pick Up Shipping Module – adding tax.
Jan 20th
Recently looked at http://www.oscommerce.com/community/contributions,164 for a store pickup option – once installed this allows you to add an option to the checkout_shipping page so that customers can collect direct. You can add a fee for this but this cannot be made taxable. Here’s a little fix for this based on spu.php
1. Backup your original file in case of ‘ooops!’
2. Find this code near the head of the file:
$this->icon = ''; $this->enabled = ((MODULE_SHIPPING_SPU_STATUS == 'True') ? true : false);
and add this extra line:
$this->icon = ''; $this->tax_class = MODULE_SHIPPING_SPU_TAX_CLASS; //2012 get tax rate $this->enabled = ((MODULE_SHIPPING_SPU_STATUS == 'True') ? true : false);
3. Look down through the code until you then find this (about line 73 in my file):
'cost' => MODULE_SHIPPING_SPU_COST)));
add below this line:
if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
4. now scoot to the bottom of the file and find function install () {. Add an extra configuration key to it so:
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_SPU_TAX_CLASS', '0', 'Use the following tax class on the shipping/delivery fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
5. Add the new key MODULE_SHIPPING_SPU_TAX_CLASS to the function keys() below this – you should end up with something like the following – just make sure that you don’t leave a trailing comma:
function keys() {
return array('MODULE_SHIPPING_SPU_STATUS', 'MODULE_SHIPPING_SPU_COST', 'MODULE_SHIPPING_SPU_SORT_ORDER', 'MODULE_SHIPPING_SPU_ZONE', 'MODULE_SHIPPING_SPU_ZIP', 'MODULE_SHIPPING_SPU_TEXT_WAY', 'MODULE_SHIPPING_SPU_TEXT_TITLE', 'MODULE_SHIPPING_SPU_TAX_CLASS');//2012 added MODULE_SHIPPING_SPU_TAX_CLASS
}
6. To install an update to any shipping module you should do the following – you can skip a couple of these steps if performing a simple edit like this but practice makes perfect.
- Go to your store admin > modules > shipping and highlight the current Store Pickup Module. Make a note of the settings you can see
- Now remove the module (uninstall)
- Upload the newly edited spu.php file to your catalog/shipping/modules/ folder
- Go back to the store admin and reinstall the module adding the appropriate tax class
7. If you find that your shipping amount is now skewed remember that you need to input the net amount to the module and the store will apply the tax – so if, for example, you want the front end to show shipping at £20 and your tax rate is 20% then your input amount = gross shipping /1.2 (16.6667 in this case)
