Product Delivery by Postcode v1.4.0 (PDP)


Purpose & Aim

Product Delivery By Postcode (PDP) allows restricting delivery of certain products to specified (local) postcodes.

How does Product Delivery By Postcode (PDP) work?

PDP relies on two shipping modules:

  • the new shipping module named Local Delivery
  • a modified Store Pickup shipping module

These two modules need to be configured first by specifying delivery postcodes of orders.

If a customer states a delivery address which is within the range of the configured postcodes then these 2 shipping modules will be available during the checkout process. If the delivery address is outside the specified range then the customer can not choose any of the 2 shipping options.

Both shipping modules work independently which means that you can activate one or the other or both.

The real benefit of PDP is realized by configuring some products which can only be delivered locally. This is useful when you have very big and bulky parcels such as bales of hay.

PDP could also be used for a pizza shop that delivers pizzas.

Or, you are selling perishables which can only be delivered locally due to temperature restrictions - eg bags of party ice.

The support thread can be found here.

This plugin has been designed for a ZC 1.5.2 - 1.5.3 installation. It is possible that it MAY work as desired on ZC installations 1.5.0 or 1.5.1 - TEST and use with CAUTION!

!! READ EVERYTHING !!

After following the installation instructions, it is strongly recommended that you read through the ENTIRE "Configuration" & "Functionality" sections of this readme. There you will find out exactly what PDP can do.

Ready to get started? Just follow the installation instructions.

Installation

!!!!! BACKUP YOUR FILES AND DATABASE BEFORE YOU BEGIN !!!!!

BEFORE INSTALLING, you are strongly encouraged to READ ALL OF THE TABS in this readme file. Then follow the installation or upgrade instructions, as appropriate.

BEFORE YOU POST A QUESTION ON THE FORUM - read through this readme again as needed

There are four folders in the package

  • 1_readme_docs
  • 2_sql_files
  • 3_add_to_css
  • 4_Install_Files
New Installation Instructions

Follow these instructions step by step in the listed order!

  1. BACK UP your database & store! (You have been told..)
  2. Unzip the PDP package to a temp folder on your local hard drive, retaining the folder structure.
  3. Open the folder "2_sql_files" and open the file "local_delivery_only_install.sql" with your text editor.
    • Log into your admin
    • Install the included sql patch "local_delivery_only_install.sql" by going to your Admin > Tools > Install SQL Patches.
      Copy and paste the code, do not use the upload function
  4. Still in Admin, go to Modules > Shipping and uninstall (remove) the shipping module Store Pickup
    • take note of the settings of your Store Pickup module before removing it
  5. Rename the folder "YOUR_ADMIN" in the "4_Install_Files" to match the name of your admin folder.
    • Carefully merge the files contained in this folder with your corresponding admin files
    • Upload the merged files to your admin
  6. Rename all of the "YOUR_TEMPLATE" folders in the "4_Install_Files" folders to match the name of your template folder.
    • Carefully merge the files contained in this folder with your corresponding store files
    • Open the "3_add_to_css" folder and add the styling code to your stylesheet.css
  7. Upload the merged files from "4_Install_Files" to your store. (DO NOT upload the "4_Install_Files" folder, just the CONTENTS of this folder - Copy ALL of the add-on files to your store!! Most issues are caused by store owners who decide to NOT load ALL of the module files)
  8. You are now ready to configure PDP

Upgrade Instructions

Upgrading from v1.3.x to v1.4.0

  1. Merge the modified file includes/modules/pages/checkout_shipping/header_php.php with your existing file
  2. Upload the merged file includes/modules/pages/checkout_shipping/header_php.php to your server
  3. Upload the included file includes/functions/extra_functions/functions_product_is_local_delivery.php to your server (the old file will be overwritten)

Done

Upgrading from v1.1 to v1.4.0 (Note: PDP v1.2 was an unoffical version hence the jump of version numbers)

  1. Upload the included file includes/functions/extra_functions/functions_product_is_local_delivery.php to your server (the old file will be overwritten)
  2. Merge the modified file includes/modules/pages/checkout_shipping/header_php.php with your existing file
  3. Upload the merged file includes/modules/pages/checkout_shipping/header_php.php to your server
  4. Upload the included file includes/modules/shipping/storepickup.php to your server (the old file will be overwritten by the Zen Cart v1.5.3 stock file thus returning this file back to a stock installation)
  5. Upload the included file includes/modules/shipping/localdelivery.php to your server (the old file will be overwritten)

Done


Un-Install Instructions
  1. BACK UP your database & store to a separate folder (just in case!)
  2. Delete the following files from your current install:
    • includes/functions/extra_functions/functions_product_is_local_delivery.php
    • includes/languages/english/modules/shipping/localdelivery.php
    • includes/languages/english/extra_definitions/YOUR_TEMPLATE/product_local_delivery.php
    • includes/modules/shipping/localdelivery.php
  3. Replace the following files with the files from your original backup - you DID backup before installing, DID YOU?:
    • includes/functions/functions_general.php
    • includes/languages/english/YOUR_TEMPLATE/shopping_cart.php
    • includes/modules/shipping/storepickup.php
    • includes/modules/pages/checkout_shipping/header_php.php
    • includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_shipping_default.php
    • includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php
    • includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php

    • YOUR_ADMIN/includes/languages/english/product.php
    • YOUR_ADMIN/includes/modules/product/collect_info.php
    • YOUR_ADMIN/includes/modules/product/preview_info.php
    • YOUR_ADMIN/includes/modules/prod_cat_header_code.php
    • YOUR_ADMIN/includes/modules/update_product.php
  4. Run the uninstall_local_delivery_only.sql from the "2_sql_files" folder

Configuration

  1. Go to Modules > Shipping in the admin panel.

    • Install the shipping module 'Store Pickup'

      Enter a comma separated list of postcodes you want to allow this module to be used for

      Configure the rest of the module as required. Use the recorded configuration when you previously uninstalled this shipping module

      Installation and configuration of this shipping module is optional

    • Install the shipping module 'Local Delivery'

      Enter a comma separated list of postcodes you want to allow this module to be used for

      Configure the rest of the module the same way as you configured 'Store Pickup'

      Installation and configuration of this shipping module is MANDATORY for PDP to work

  2. Go to Catalog > Categories/Products

    • Open/edit the product(s) you want to deliver ONLY to the postcodes you have specified above.
    • Below 'Always Free Shipping:' you will find a new option called 'Product is Local Delivery Only:' with 2 radio buttons
    • Click the button 'Yes, Product is Local Delivery Only' (the default is 'No, Normal Shipping Rules')
    • Update the product and done
    • repeat these steps for every product you want to restrict to local delivery only.

  3. UK Postcodes

  4. The UK postcode format is in one of these combinations: AN NAA | ANN NAA | AAN NAA | AANN NAA | ANA NAA | AANA NAA where A is a letter and N is a number. The last 3 digits are always in the format NAA. To reduce the number of characters to be entered into the database, PDP automatically strips the last 3 characters. The administrator only needs to enter the letters and numbers of the first part (without the space) when configuring the shipping module(s).

    As an example, the postcodes CM0 7AA,CM0 7AB,CM0 7AD,CM0 7AE,CM0 7AF,CM16 5AL,CM16 5AP,CM16 5AR,CM16 5AS,CM16 5AT,SS99 9DA,SS99 9DB,SS99 9DE,SS99 9DF,SS99 9DG only require the entries CM0,CM16,SS99 - not the full hog!



Functionality

General
  • Products marked 'Local Delivery Only' are identified on the product info page as 'Local Delivery Only'
  • The customer is alerted about the restriction but they can still add the product to the cart (they may elect to change the delivery address later)
Scenario 1
  • The cart contains no products marked 'Local Delivery Only'
  • The delivery address is within the range specified in the shipping modules
  • ALL activated shipping options are available
Scenario 2
  • The cart contains no products marked 'Local Delivery Only'
  • The delivery address is outside the range specified in the shipping modules
  • Local delivery and Store Pickup are NOT available, all other shipping options (Zones, Table Rates) are available
Scenario 3
  • The cart contains one or more products marked 'Local Delivery Only'
  • The delivery address is within the range specified in the shipping modules
  • The Shopping Cart page displays the message 'One or more products in your cart can only be delivered to certain local destinations' and the restricted product is identified in the cart
  • ONLY Local delivery and Store Pickup are available
Scenario 4
  • The cart contains one or more products marked 'Local Delivery Only'
  • The delivery address is outside the range specified in the shipping modules
  • The Shopping Cart page displays the message 'One or more products in your cart can only be delivered to certain local destinations' and the restricted product is identified in the cart
  • No shipping module is available and the messages 'Sorry, we are not shipping to your region at this time' and 'Local Delivery Only!' are displayed

Credits & History

Orginal author: Frank Riegel (frank18) - http://isonetwork.net.au

  • Version 1.4.0 released Aug 2014
  • Version 1.3.0 released July 2014 (version number 1.2 was an unofficial clone hence the jump in version numbers)
  • Version 1.1 released Aug 2013
  • First release July 2013 - version 1.0

Change Log

Version 1.3.1 to version 1.4.0

  • added function to strip last 3 characters of UK postcodes to enable entering a larger number of postcodes without reaching database field limits

Version 1.3 to version 1.3.1

  • fixed naming errors of folders (YOUR_ADMIN and YOUR_TEMPLATE)

Version 1.1 to version 1.3

  • modified the file includes/modules/pages/checkout_shipping/header_php.php to deal with changed function calls in relevant shipping modules.
  • replaced previously modified (v1.1) shipping module files with current stock shipping module files.

Version 1.0 to version 1.1

  • added missing language file for new shipping module 'Local delivery'
  • modified includes/functions/functions_general.php to enable de-activation of any other shipping module if a product marked for local delivery is added to the cart. This means that you don't have to worry about other shipping modules such as USPS, Royal Mail, Ozpost etc which you may have installed and activated. In other words: there is nothing else to do in this file should you decide to install another shipping module.

Troubleshooting

Basics

BEFORE you post your 'issue' in the support thread:

Make sure your custom template is active. (Admin > Tools > Template Selection)

If PDP does not work or gives you errors:

  • Make sure all files are in the correct location
  • Make sure you merged all files as per instructions
  • Make sure you uploaded ALL the PDP files
  • Make sure the files are not corrupted from bad FTP transfers
  • MAKE SURE YOU RE-READ THE INSTALLATION AND CONFIGURATION!!!

Please Note:

There are modifications to some core Zen Cart files! Merge carefully!

Files

includes/functions/functions_general.php

includes/functions/extra_functions/functions_product_is_local_delivery.php (new file)

includes/languages/english/extra_definitions/YOUR_TEMPLATE/product_local_delivery.php (new file)

includes/languages/english/modules/shipping/localdelivery.php (new file)

includes/languages/english/YOUR_TEMPLATE/shopping_cart.php

includes/modules/pages/checkout_shipping/header_php.php

includes/modules/shipping/localdelivery.php (new file)

includes/modules/shipping/storepickup.php

includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_shipping_default.php

includes/templates/YOUR_TEMPLATE/templates/tpl_product_info_display.php

includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart_default.php


YOUR_ADMIN/includes/languages/english/product.php

YOUR_ADMIN/includes/modules/product/collect_info.php

YOUR_ADMIN/includes/modules/product/preview_info.php

YOUR_ADMIN/includes/modules/prod_cat_header_code.php

YOUR_ADMIN/includes/modules/update_product.php

MISC

If you are happy with this mod you are cordially invited to make a small donation (PayPal to service@frnt.org) towards the power consumption of my computer which has helped me to make this contribution workable.

Other than that: Enjoy!

Cheers from frank18

LICENSE

PDP is released under the General Public License (see LICENSE.txt)

This script is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Always backup your shop and database before making changes.