Problem:
You have the Store Pickup shipping module enabled. Your store is located in the South East of Queensland. A customer from Cairns places an order with you and selects Store Pickup at checkout to *save* postage. Cairns is located in the same state but is about 1700 km north of your store location. It is unlikely that the customer hops in a plane or drives 18-19 hours to your store to *save* the shipping charges.....
This has happened to me a few times on one of my stores.
Solution:
You limit the Store Pickup shipping module to postcodes surrounding your physical store location. If the customer's delivery address is not within the set limits then the Store Pickup option does not appear on the Checkout Shipping page.
To achieve this you
1. uninstall the Store Pickup module in admin
2. backup the includes/modules/shipping/storepickup.php file
3. modify the includes/modules/shipping/storepickup.php file (see below)
4. upload the modified file
5. re-install the Store Pickup module in admin
The modified module now lets you enter an array of delivery postcodes you wish to allow usage of the Store Pickup option. Just enter the allowed postcodes separated by commas (no spaces) eg. 7000,7001,7005 - save and done.
The Hack:
(I have this working on ZC 1.3.9 and ZC 1.5.1)
Open includes/modules/shipping/storepickup.php
Find this:
Code:
if ($check_flag == false) {
$this->enabled = false;
}
}
}
/**
* Obtain quote from shipping system/calculations
*
and amend to this:
Code:
if ($check_flag == false) {
$this->enabled = false;
}
// bof postcodes allowed
if (in_array($order->delivery['postcode'],explode(",", MODULE_SHIPPING_STOREPICKUP_POSTCODE))) {
$this->enabled = true;
} else {
$this->enabled = false;
}
// eof postcodes allowed
}
}
/**
* Obtain quote from shipping system/calculations
*
then find:
Code:
/**
* Install the shipping module and its configuration settings
*
*/
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Store Pickup Shipping', 'MODULE_SHIPPING_STOREPICKUP_STATUS', 'True', 'Do you want to offer In Store rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
and amend to this:
Code:
/**
* Install the shipping module and its configuration settings
*
*/
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Store Pickup Shipping', 'MODULE_SHIPPING_STOREPICKUP_STATUS', 'True', 'Do you want to offer In Store rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Postcodes Allowed', 'MODULE_SHIPPING_STOREPICKUP_POSTCODE', '1000', 'Enter the delivery postcodes allowed to use this shipping method.<br /><br />Enter the allowed postcodes as a comma delimited list - do not use spaces (eg 7000,7001,7005,7010).<br /><br />In this example <b>only</b> orders with delivery postcodes 7000,7001,7005 and 7010 are allowed to use the Store Pickup shipping option.<br /><br />', '6', '0', now())");
lastly - at the end of the file - change this:
Code:
* @return array
*/
function keys() {
return array('MODULE_SHIPPING_STOREPICKUP_STATUS', 'MODULE_SHIPPING_STOREPICKUP_COST', 'MODULE_SHIPPING_STOREPICKUP_TAX_CLASS', 'MODULE_SHIPPING_STOREPICKUP_TAX_BASIS', 'MODULE_SHIPPING_STOREPICKUP_ZONE', 'MODULE_SHIPPING_STOREPICKUP_SORT_ORDER');
}
}
?>
to this:
Code:
* @return array
*/
function keys() {
return array('MODULE_SHIPPING_STOREPICKUP_STATUS', 'MODULE_SHIPPING_STOREPICKUP_POSTCODE', 'MODULE_SHIPPING_STOREPICKUP_COST', 'MODULE_SHIPPING_STOREPICKUP_TAX_CLASS', 'MODULE_SHIPPING_STOREPICKUP_TAX_BASIS', 'MODULE_SHIPPING_STOREPICKUP_ZONE', 'MODULE_SHIPPING_STOREPICKUP_SORT_ORDER');
}
}
?>
Enjoy
Cheers/Frank
Bookmarks