User Tools

Site Tools


tutorials:zencartmods:usps_300.html

This is an old revision of the document!


For orders over $200, we force domestic customers to use UPS as opposed to USPS. Here's how to set an arbitrary limit on the usps shipping module.

includes/languages/english/modules/shipping/usps.php

add these lines

define('MODULE_SHIPPING_USPS_LIMIT_ERROR', 'For packages over $200 we require shipment via UPS');
define('MODULE_SHIPPING_USPS_LIMIT', 200);

Change 200 to whatever you want the limit to be!

includes/modules/shipping/usps.xml

Find line 188

    if (is_array($uspsQuote)) {

and replace with

if (is_array($uspsQuote) && $_SESSION['cart']->total < MODULE_SHIPPING_USPS_LIMIT) {

Find line 281

elseif ($uspsQuote == -1) {
      $this->quotes = array('module' => $this->title,
                            'error' => MODULE_SHIPPING_USPS_TEXT_SERVER_ERROR . (MODULE_SHIPPING_USPS_SERVER=='test' ? MODULE_SHIPPING_USPS_TEXT_TEST_MODE_NOTICE : ''));
    } 

and replace with

elseif ($uspsQuote == -1) {
      $this->quotes = array('module' => $this->title,
                            'error' => MODULE_SHIPPING_USPS_TEXT_SERVER_ERROR . (MODULE_SHIPPING_USPS_SERVER=='test' ? MODULE_SHIPPING_USPS_TEXT_TEST_MODE_NOTICE : ''));
    } elseif ($_SESSION['cart']->total > MODULE_SHIPPING_USPS_LIMIT) {
      $this->quotes = array('module' => $this->title,
                            'error' => MODULE_SHIPPING_USPS_LIMIT_ERROR);
    }
/home/ladyada/public_html/wiki/data/attic/tutorials/zencartmods/usps_300.html.1310069791.txt.gz · Last modified: 2016/01/28 18:05 (external edit)