Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Sep 2006
    Posts
    42
    Plugin Contributions
    0

    Default Error cloning a shipping module

    I followed the instructions here:

    http://www.zen-cart.com/forum/showth...hipping+module

    for cloning a module. I clone the UPS module, and renamed the 2 files to ups-canada.php

    I renamed the class from ups to ups-canada and the SHIPPING_MODULE_UPS_ to SHIPPING_MODULE_UPS-CANADA in both file.

    When I try to load up the shipping modules, I get the following error:

    Fatal error: Cannot redeclare class ups in C:\Program Files\xampp\htdocs\connequestrian\store\includes\modules\shipping\ups.php

    Line 447, btw, is a comment line.


    Anyone got any clues???

    Thanks,

    Brain21

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Error cloning a shipping module

    The naming is crossing on UPS vs UPS-blah in the keys ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Sep 2006
    Posts
    42
    Plugin Contributions
    0

    Default Re: Error cloning a shipping module

    What keys, where? You just spoke greek to me. :-)


    Is there a specific line of code that you are talking about???

    Thanks,

    Brain21

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Error cloning a shipping module

    Change the UPS-CANADA to UPSCANADA and change ups-canada to upscanada and be sure to change the two filenames to upscanada.php as well ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Sep 2006
    Posts
    42
    Plugin Contributions
    0

    Default Re: Error cloning a shipping module

    Did that. Still getting the same error. It is now loading the ups module, but the error is EXACTLY like it was before, only now the module is upscanada.php rather than ups.php. Same line and everything.

    Here is the line its crapping out on (this time line 447 isn't a comment line):

    $body_array = explode("\n", $body);

    The php file itself can be gotten from my server:

    ftp turdferguson.kicks-***.org

    UID: guest
    Passwd: guest

    upscanada.php is the only file there

    And since this site is censoring bad words, the site is not
    .kicks-***.org
    but
    . k i c k s - a s s . o r g

    Thanks,

    Alex F

  6. #6
    Join Date
    Sep 2006
    Posts
    42
    Plugin Contributions
    0

    Default Re: Error cloning a shipping module

    OK, so I think maybe the error is actually on line 13 where the class ups is being called:

    class ups extends base {

    So I change it to this:

    class upscanada extends base {

    Save and reload the shipping module.

    Well, now I am not getting those errors anymore. There is a new shipping module now showing.

    The module title is blank. I click on it. The little window to the right has no title or text of any kind, but it does have an install button. I click on install.

    Now I am getting the following error:

    Warning: reset() [function.reset]: Passed variable is not an array or object in C:\Program Files\xampp\htdocs\connequestrian\store\admin\modules.php on line 279

    Warning: Variable passed to each() is not an array or object in C:\Program Files\xampp\htdocs\connequestrian\store\admin\modules.php on line 280


    Out of the fryingpan and into the fire.

    I just don't get why this isn't easy. It is NOT uncommon for people to use different shipping rates to different countries for a single shipping method. In fact, when I was searching the forums I saw a number of posts from 2004 asking for this capability. If it's not built-in and we have to resort to manually cloning a module and then running into all sorts of cryptic errors & problems, and basically NO documentation in this crap, then why didn't the devs simply create a script & button. "Click here to clone a shipping module". Then it presents you w/ a drop down list of all of the installed modules. You select the one you want and enter in a new name for it, and viola! Done. Very frustrating....

    Thanks for any help!

    Brain21

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Error cloning a shipping module

    This is my upscanada.php ...

    Note: there is a change on weight so there is no conflict with clones or other modules:
    PHP Code:
    <?php
    /**
     * @package shippingMethod
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: ups.php 4633 2006-09-30 14:53:59Z ajeh $
     */
    /**
     * Enter description here...
     *
     */
    class upscanada extends base {
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $code;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $title;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $description;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $icon;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $enabled;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $types;
      
    /**
       * Enter description here...
       *
       * @return upscanada
       */
      
    function upscanada() {
        global 
    $order$db$template;

        
    $this->code 'upscanada';
        
    $this->title MODULE_SHIPPING_UPSCANADA_TEXT_TITLE;
        
    $this->description MODULE_SHIPPING_UPSCANADA_TEXT_DESCRIPTION;
        
    $this->sort_order MODULE_SHIPPING_UPSCANADA_SORT_ORDER;
        
    $this->icon $template->get_template_dir('shipping_ups.gif'DIR_WS_TEMPLATE$current_page_base,'images/icons'). '/' 'shipping_ups.gif';
        
    $this->tax_class MODULE_SHIPPING_UPSCANADA_TAX_CLASS;
        
    $this->tax_basis MODULE_SHIPPING_UPSCANADA_TAX_BASIS;

        
    // disable only when entire cart is free shipping
        
    if (zen_get_shipping_enabled($this->code)) {
          
    $this->enabled = ((MODULE_SHIPPING_UPSCANADA_STATUS == 'True') ? true false);
        }

        if ( (
    $this->enabled == true) && ((int)MODULE_SHIPPING_UPSCANADA_ZONE 0) ) {
          
    $check_flag false;
          
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = '" MODULE_SHIPPING_UPSCANADA_ZONE "' and zone_country_id = '" $order->delivery['country']['id'] . "' order by zone_id");
          while (!
    $check->EOF) {
            if (
    $check->fields['zone_id'] < 1) {
              
    $check_flag true;
              break;
            } elseif (
    $check->fields['zone_id'] == $order->delivery['zone_id']) {
              
    $check_flag true;
              break;
            }
            
    $check->MoveNext();
          }

          if (
    $check_flag == false) {
            
    $this->enabled false;
          }
        }

        
    $this->types = array('1DM' => 'Next Day Air Early AM',
        
    '1DML' => 'Next Day Air Early AM Letter',
        
    '1DA' => 'Next Day Air',
        
    '1DAL' => 'Next Day Air Letter',
        
    '1DAPI' => 'Next Day Air Intra (Puerto Rico)',
        
    '1DP' => 'Next Day Air Saver',
        
    '1DPL' => 'Next Day Air Saver Letter',
        
    '2DM' => '2nd Day Air AM',
        
    '2DML' => '2nd Day Air AM Letter',
        
    '2DA' => '2nd Day Air',
        
    '2DAL' => '2nd Day Air Letter',
        
    '3DS' => '3 Day Select',
        
    'GND' => 'Ground',
        
    'GNDCOM' => 'Ground Commercial',
        
    'GNDRES' => 'Ground Residential',
        
    'STD' => 'Canada Standard',
        
    'XPR' => 'Worldwide Express',
        
    'XPRL' => 'worldwide Express Letter',
        
    'XDM' => 'Worldwide Express Plus',
        
    'XDML' => 'Worldwide Express Plus Letter',
        
    'XPD' => 'Worldwide Expedited');
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $method
       * @return unknown
       */
      
    function quote($method '') {
        global 
    $_POST$order$shipping_weight$shipping_num_boxes;

        if ( (
    zen_not_null($method)) && (isset($this->types[$method])) ) {
          
    $prod $method;
          
    // BOF: UPS USPS
        
    } else if ($order->delivery['country']['iso_code_2'] == 'CA') {
          
    $prod 'STD';
          
    // EOF: UPS USPS
        
    } else {
          
    $prod 'GNDRES';
        }

        if (
    $method$this->_upsAction('3'); // return a single quote

        
    $this->_upsProduct($prod);

        
    $ups_shipping_weight = ($shipping_weight 0.1 0.1 $shipping_weight);

        
    $country_name zen_get_countries(SHIPPING_ORIGIN_COUNTRYtrue);
        
    $this->_upsOrigin(SHIPPING_ORIGIN_ZIP$country_name['countries_iso_code_2']);
        
    $this->_upsDest($order->delivery['postcode'], $order->delivery['country']['iso_code_2']);
        
    $this->_upsRate(MODULE_SHIPPING_UPSCANADA_PICKUP);
        
    $this->_upsContainer(MODULE_SHIPPING_UPSCANADA_PACKAGE);
        
    $this->_upsWeight($ups_shipping_weight);
        
    $this->_upsRescom(MODULE_SHIPPING_UPSCANADA_RES);
        
    $upsQuote $this->_upsGetQuote();

        if ( (
    is_array($upsQuote)) && (sizeof($upsQuote) > 0) ) {
          switch (
    SHIPPING_BOX_WEIGHT_DISPLAY) {
            case (
    0):
            
    $show_box_weight '';
            break;
            case (
    1):
            
    $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';
            break;
            case (
    2):
            
    $show_box_weight ' (' number_format($ups_shipping_weight $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT ')';
            break;
            default:
            
    $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($ups_shipping_weight,2) . TEXT_SHIPPING_WEIGHT ')';
            break;
          }
          
    $this->quotes = array('id' => $this->code,
          
    'module' => $this->title $show_box_weight);

          
    $methods = array();
          
    // BOF: UPS USPS
          
    $allowed_methods explode(", "MODULE_SHIPPING_UPSCANADA_TYPES);
          
    $std_rcd false;
          
    // EOF: UPS USPS
          
    $qsize sizeof($upsQuote);
          for (
    $i=0$i<$qsize$i++) {
            list(
    $type$cost) = each($upsQuote[$i]);
            
    // BOF: UPS USPS
            
    if ($type=='STD') {
              if (
    $std_rcd) continue;
              else 
    $std_rcd true;
            }
            if (!
    in_array($type$allowed_methods)) continue;
            
    // EOF: UPS USPS
            
    $methods[] = array('id' => $type,
            
    'title' => $this->types[$type],
            
    'cost' => ($cost MODULE_SHIPPING_UPSCANADA_HANDLING) * $shipping_num_boxes);
          }

          
    $this->quotes['methods'] = $methods;

          if (
    $this->tax_class 0) {
            
    $this->quotes['tax'] = zen_get_tax_rate($this->tax_class$order->delivery['country']['id'], $order->delivery['zone_id']);
          }
        } else {
          
    /* ORIGINAL
          $this->quotes = array('module' => $this->title,
          'error' => 'An error occurred with the UPS shipping calculations.<br />' . $upsQuote . '<br />If you prefer to use UPS as your shipping method, please contact the store owner.');
          */
          // BOF: UPS USPS
          
    $this->quotes = array('module' => $this->title,
          
    'error' => 'We are unable to obtain a rate quote for UPS shipping.<br />Please contact the store if no other alternative is shown.');
          
    // EOF: UPS USPS
        
    }

        if (
    zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);

        return 
    $this->quotes;
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function check() {
        global 
    $db;
        if (!isset(
    $this->_check)) {
          
    $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_UPSCANADA_STATUS'");
          
    $this->_check $check_query->RecordCount();
        }
        return 
    $this->_check;
      }
      
    /**
       * Enter description here...
       *
       */
      
    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 UPSCANADA Shipping', 'MODULE_SHIPPING_UPSCANADA_STATUS', 'True', 'Do you want to offer UPSCANADA 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 ('UPSCANADA Pickup Method', 'MODULE_SHIPPING_UPSCANADA_PICKUP', 'CC', 'How do you give packages to UPS? CC - Customer Counter, RDP - Daily Pickup, OTP - One Time Pickup, LC - Letter Center, OCA - On Call Air', '6', '0', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('UPS Packaging?', 'MODULE_SHIPPING_UPSCANADA_PACKAGE', 'CP', 'CP - Your Packaging, ULE - UPS Letter, UT - UPS Tube, UBE - UPS Express Box', '6', '0', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Residential Delivery?', 'MODULE_SHIPPING_UPSCANADA_RES', 'RES', 'Quote for Residential (RES) or Commercial Delivery (COM)', '6', '0', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_UPSCANADA_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");
        
    $db->Execute("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_UPSCANADA_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_UPSCANADA_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_UPSCANADA_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_SHIPPING_UPSCANADA_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
        
    // BOF: UPS USPS
        //      $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ( 'Shipping Methods', 'MODULE_SHIPPING_UPSCANADA_TYPES', 'Nxt AM,Nxt AM Ltr,Nxt,Nxt Ltr,Nxt PR,Nxt Save,Nxt Save Ltr,2nd AM,2nd AM Ltr,2nd,2nd Ltr,3 Day Select,Ground,Canada,World Xp,World Xp Ltr, World Xp Plus,World Xp Plus Ltr,World Expedite', 'Select the USPS services to be offered.', '6', '13', 'zen_cfg_select_multioption(array(\'1DM\',\'1DML\', \'1DA\', \'1DAL\', \'1DAPI\', \'1DP\', \'1DPL\', \'2DM\', \'2DML\', \'2DA\', \'2DAL\', \'3DS\',\'GND\', \'STD\', \'XPR\', \'XPRL\', \'XDM\', \'XDML\', \'XPD\'), ', now() )");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ( 'Shipping Methods: <br />Nxt AM, Nxt AM Ltr, Nxt, Nxt Ltr, Nxt PR, Nxt Save, Nxt Save Ltr, 2nd AM, 2nd AM Ltr, 2nd, 2nd Ltr, 3 Day Select, Ground, Canada,World Xp, World Xp Ltr, World Xp Plus, World Xp Plus Ltr, World Expedite', 'MODULE_SHIPPING_UPSCANADA_TYPES', '1DM, 1DML, 1DA, 1DAL, 1DAPI, 1DP, 1DPL, 2DM, 2DML, 2DA, 2DAL, 3DS, GND, STD, XPR, XPRL, XDM, XDML, XPD', 'Select the UPS services to be offered.', '6', '13', 'zen_cfg_select_multioption(array(\'1DM\',\'1DML\', \'1DA\', \'1DAL\', \'1DAPI\', \'1DP\', \'1DPL\', \'2DM\', \'2DML\', \'2DA\', \'2DAL\', \'3DS\',\'GND\', \'STD\', \'XPR\', \'XPRL\', \'XDM\', \'XDML\', \'XPD\'), ', now() )");
        
    // EOF: UPS USPS
      
    }
      
    /**
       * Enter description here...
       *
       */
      
    function remove() {
        global 
    $db;
        
    $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function keys() {
        return array(
    'MODULE_SHIPPING_UPSCANADA_STATUS''MODULE_SHIPPING_UPSCANADA_PICKUP''MODULE_SHIPPING_UPSCANADA_PACKAGE''MODULE_SHIPPING_UPSCANADA_RES''MODULE_SHIPPING_UPSCANADA_HANDLING''MODULE_SHIPPING_UPSCANADA_TAX_CLASS''MODULE_SHIPPING_UPSCANADA_TAX_BASIS''MODULE_SHIPPING_UPSCANADA_ZONE''MODULE_SHIPPING_UPSCANADA_SORT_ORDER''MODULE_SHIPPING_UPSCANADA_TYPES');
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $prod
       */
      
    function _upsProduct($prod){
        
    $this->_upsProductCode $prod;
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $postal
       * @param unknown_type $country
       */
      
    function _upsOrigin($postal$country){
        
    $this->_upsOriginPostalCode $postal;
        
    $this->_upsOriginCountryCode $country;
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $postal
       * @param unknown_type $country
       */
      
    function _upsDest($postal$country){
        
    $postal str_replace(' '''$postal);

        if (
    $country == 'US') {
          
    $this->_upsDestPostalCode substr($postal05);
        } else {
          
    $this->_upsDestPostalCode $postal;
        }

        
    $this->_upsDestCountryCode $country;
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $foo
       */
      
    function _upsRate($foo) {
        switch (
    $foo) {
          case 
    'RDP':
          
    $this->_upsRateCode 'Regular+Daily+Pickup';
          break;
          case 
    'OCA':
          
    $this->_upsRateCode 'On+Call+Air';
          break;
          case 
    'OTP':
          
    $this->_upsRateCode 'One+Time+Pickup';
          break;
          case 
    'LC':
          
    $this->_upsRateCode 'Letter+Center';
          break;
          case 
    'CC':
          
    $this->_upsRateCode 'Customer+Counter';
          break;
        }
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $foo
       */
      
    function _upsContainer($foo) {
        switch (
    $foo) {
          case 
    'CP'// Customer Packaging
          
    $this->_upsContainerCode '00';
          break;
          case 
    'ULE'// UPS Letter Envelope
          
    $this->_upsContainerCode '01';
          break;
          case 
    'UT'// UPS Tube
          
    $this->_upsContainerCode '03';
          break;
          case 
    'UEB'// UPS Express Box
          
    $this->_upsContainerCode '21';
          break;
          case 
    'UW25'// UPS Worldwide 25 kilo
          
    $this->_upsContainerCode '24';
          break;
          case 
    'UW10'// UPS Worldwide 10 kilo
          
    $this->_upsContainerCode '25';
          break;
        }
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $foo
       */
      
    function _upsWeight($foo) {
        
    $this->_upsPackageWeight $foo;
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $foo
       */
      
    function _upsRescom($foo) {
        switch (
    $foo) {
          case 
    'RES'// Residential Address
          
    $this->_upsResComCode '1';
          break;
          case 
    'COM'// Commercial Address
          
    $this->_upsResComCode '0';
          break;
        }
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $action
       */
      
    function _upsAction($action) {
        
    /* 3 - Single Quote
        4 - All Available Quotes */

        
    $this->_upsActionCode $action;
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function _upsGetQuote() {
        if (!isset(
    $this->_upsActionCode)) $this->_upsActionCode '4';

        
    $request join('&', array('accept_UPS_license_agreement=yes',
        
    '10_action=' $this->_upsActionCode,
        
    '13_product=' $this->_upsProductCode,
        
    '14_origCountry=' $this->_upsOriginCountryCode,
        
    '15_origPostal=' $this->_upsOriginPostalCode,
        
    '19_destPostal=' $this->_upsDestPostalCode,
        
    '22_destCountry=' $this->_upsDestCountryCode,
        
    '23_weight=' $this->_upsPackageWeight,
        
    '47_rate_chart=' $this->_upsRateCode,
        
    '48_container=' $this->_upsContainerCode,
        
    '49_residential=' $this->_upsResComCode));
        
    $http = new httpClient();
        if (
    $http->Connect('www.ups.com'80)) {
          
    $http->addHeader('Host''www.ups.com');
          
    $http->addHeader('User-Agent''Zen Cart');
          
    $http->addHeader('Connection''Close');

          if (
    $http->Get('/using/services/rave/qcostcgi.cgi?' $request)) $body $http->getBody();

          
    $http->Disconnect();
        } else {
          return 
    'error';
        }

        
    // BOF: UPS USPS
        /*
        TEST by checking out in the catalog; try a variety of shipping destinations to be sure
        your customers will be properly served.  If you are not getting any quotes, try enabling
        more alternatives in admin. Make sure your store's postal code is set in Admin ->
        Configuration -> Shipping/Packaging, since you won't get any quotes unless there is
        a origin that UPS recognizes.

        If you STILL don't get any quotes, here is a way to find out exactly what UPS is sending
        back in response to rate quote request.  At line 278, you will find this statement in a
        comment block:

        mail('[email protected]','UPS response',$body,'From: <[email protected]>');
        */
        // EOF: UPS USPS

        
    $body_array explode("\n"$body);

        
    $returnval = array();
        
    $errorret 'error'// only return error if NO rates returned

        
    $n sizeof($body_array);
        for (
    $i=0$i<$n$i++) {
          
    $result explode('%'$body_array[$i]);
    //print_r($result);
    //die();
          
    $errcode substr($result[0], -1);
          switch (
    $errcode) {
            case 
    3:
            if (
    is_array($returnval)) $returnval[] = array($result[1] => $result[8]);
            break;
            case 
    4:
            if (
    is_array($returnval)) $returnval[] = array($result[1] => $result[8]);
            break;
            case 
    5:
            
    $errorret $result[1];
            break;
            case 
    6:
            if (
    is_array($returnval)) $returnval[] = array($result[3] => $result[10]);
            break;
          }
        }
        if (empty(
    $returnval)) $returnval $errorret;

        return 
    $returnval;
      }
    }
    ?>
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #8
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Error cloning a shipping module

    This is the language file ...

    Note: may need to tidy up these two files I just did them quick ...
    PHP Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2003 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: ups.php 1969 2005-09-13 06:57:21Z drbyte $
    //

    define('MODULE_SHIPPING_UPSCANADA_TEXT_TITLE''United Parcel Service');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_DESCRIPTION''United Parcel Service');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_GND''UPSCANADA Ground');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_1DM''Next Day Air Early AM');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_1DA''Next Day Air');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_1DP''Next Day Air Saver');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_2DM''2nd Day Air Early AM');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_3DS''3 Day Select');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_STD''Canada Standard');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_XPR''Worldwide Express');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_XDM''Worldwide Express Plus');
    define('MODULE_SHIPPING_UPSCANADA_TEXT_OPT_XPD''Worldwide Expedited');
    ?>
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  9. #9
    Join Date
    Sep 2006
    Posts
    42
    Plugin Contributions
    0

    Default Re: Error cloning a shipping module

    Thanks for the files. OK, so I figured out from your files what my problem was. I had

    function ups()

    instead of

    function upscanada()

    THANK YOU!

    OK, so now they both show up. I click on install for the Canada one.

    Set up the shipping methods. For the Zone I select the one that I created:

    Shp:CA. When I click on update I get the orange circle. I also get the orange circle next to the regular old UPS one as well.

    I created the Shp: CA by:

    Admin->Zones Definitions
    insert
    Zone name = Shp: CA
    Descriptions = shipping to Canada
    insert
    Select Shp: CA
    Details
    Insert
    Country: = Canada
    Zones: = All Zones

    So I save this all up. Did I do this right?

    Now I searched the forums and found someone else having the same problem with the USPS module. They were told that this means that the module is installed, but it's status is set to "false" and that they should set

    Enable USPS Shipping = True

    ummmm... Where? IF this means when you click on "Edit" both modules are already set to True. I don't think that this is because of a conflict either because the regular OLD ups gave me the same thing when I had the UPSCanada stuff removed (& renamed the files too).

    I looked through all of the .php files that I could find and the UPS and UPSCANADA statuses were all set to true. So is there somewhere else in the admin interface where I need to set this, cause I have looked and looked and not found anything.

    If I set the shipping zone to Shp: The rest of the world

    Then all of a sudden the status circle is green

    Thanks,

    Brain21
    Last edited by brain21; 1 Oct 2006 at 09:36 PM.

  10. #10
    Join Date
    Sep 2006
    Posts
    42
    Plugin Contributions
    0

    Default Re: Error cloning a shipping module

    OK, the problem seems to not be with the shipping modules, but rather the zone definitions (?) If I select "none" for the shipping zone it works. If I select "The rest of the world" for the shipping zone it works. Same behavior with the other modules.

    I described in my last post the manner in which I set up the shipping modules.

    Also, I now have UPS and Flat Rate shipping enabled for this testing. Only the Flat Rate shipping numbers are showing.

    I get "We are unable to obtain a rate quote for UPS shipping.
    Please contact the store if no other alternative is shown"

    on the shipping screen. :-(

    My parents have a UPS account. Is there something more that needs to be done? There seems to be no way to enter in the rates (my parents wish to do it by price - is this something that is NOT possible with the UPS shipping module?).

    I was thinking about using the MZMT module, but I run into the same problems in the zones...

    Thanks,

    Brain21

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Shipping module cloning
    By jmp04 in forum Built-in Shipping and Payment Modules
    Replies: 21
    Last Post: 11 Dec 2010, 02:36 PM
  2. Cloning USPS Shipping Module
    By elgrcg in forum Addon Shipping Modules
    Replies: 3
    Last Post: 3 Dec 2010, 10:52 PM
  3. Cloning the Flat Rate Shipping Module
    By jo_h1971 in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 16 Oct 2009, 12:11 PM
  4. cloning the shipping module - table
    By drmad in forum Built-in Shipping and Payment Modules
    Replies: 5
    Last Post: 20 Oct 2006, 08:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR