If this is your first visit, check our documentation. To post, register or login.
Forums / Community Contributed Add-Ons / Addon Shipping Modules / Store Pickup by Delivery Postcode

Store Pickup by Delivery Postcode

Started by frank18 on 25 May 2013, 8:59 AM · Views: 2,908

Results 1 to 6 of 6
25 May 2013, 8:59 AM
#1
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Post #1 by frank18

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:

      if ($check_flag == false) { 
        $this->enabled = false; 
      } 
    } 
  } 
  /** 
   * Obtain quote from shipping system/calculations 
   * 

and amend to this:

      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:

  /** 
   * 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:

  /** 
   * 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:

   * @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:

   * @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

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

17 Jun 2013, 11:19 AM
#2
rayo avatar

rayo

New Zenner

Join Date:
Jun 2013
Location:
Sydney
Posts:
25
Plugin Contributions:
0

Post #2 by rayo

Hi, do you know if it is possible to do a similar thing with the standard shipping module? We are planning to do only local (10-20 postcodes around Sydney) delivery for the first few months of our store being up.

17 Jun 2013, 10:37 PM
#3
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Post #3 by frank18

rayo:

Hi, do you know if it is possible to do a similar thing with the standard shipping module? We are planning to do only local (10-20 postcodes around Sydney) delivery for the first few months of our store being up.

Should be possible with some custom coding - or setting up zones for individual postcodes.

The store pickup payment modules is a very simple module, zone rates are a bit more complicated.

I need to mull over this...

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

18 Jun 2013, 6:28 AM
#4
rayo avatar

rayo

New Zenner

Join Date:
Jun 2013
Location:
Sydney
Posts:
25
Plugin Contributions:
0

Post #4 by rayo

Or would it be easier to only offer local pick up but 'mask' it as 'local delivery' ie change the text it displays as. Or would I be heading down a dark tunnel with that approach ):

I am no PHP coder (if that was not already obvious)

18 Jun 2013, 7:25 AM
#5
frank18 avatar

frank18

Deceased

Join Date:
Nov 2007
Location:
Sunny Coast, Australia
Posts:
3,427
Plugin Contributions:
2

Post #5 by frank18

rayo:

Or would it be easier to only offer local pick up but 'mask' it as 'local delivery' ie change the text it displays as. Or would I be heading down a dark tunnel with that approach ):

I am no PHP coder (if that was not already obvious)

The easiest way would be to clone the Store Pickup module, call it something like 'Local Delivery' and then offer this as the only available shipping method.

If you are not a coder you may want to look into employing someone who is au-fait with Zen Cart installations.

Cheers / Frank

NOTE: We are sorry that Frank is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

24 Jun 2013, 9:27 AM
#6
rayo avatar

rayo

New Zenner

Join Date:
Jun 2013
Location:
Sydney
Posts:
25
Plugin Contributions:
0

Post #6 by rayo

Thanks, I will give it a go.