Page 1 of 2 12 LastLast
Results 1 to 10 of 13
  1. #1
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,914
    Plugin Contributions
    74

    Default USPS Shipping Module [Support Thread]


  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,914
    Plugin Contributions
    74

    Default Re: USPS Shipping Module [Support Thread]

    Version 2020-09-24 K11 is now available for download: https://www.zen-cart.com/downloads.php?do=file&id=1292

    Note that this version is not compatible with Zen Cart versions prior to 1.5.2 and is not supported for Zen Cart versions prior to 1.5.4.

    The following changes were made:

    - Restructuring to prevent PHP notices and warnings.
    - Re-factored to use now-current code styling.
    - Includes modifications to use stripos/strpos instead of preg_match for 'simple' string-in-string checks.
    - Use foreach() instead of deprecated each()
    - Use secure (https: //secure.shippingapis.com/ShippingAPI.dll) endpoint for API requests; unsecure endpoint being retired.
    - Simplifies debug handling, 'Screen' and 'Email' no longer supported.
    - Debug filename changed to enable sort-by-name to mimic sort-by-date on the files.
    - Restores the USPS icon to this shipping-method's distribution zip-file.
    - Correct missing constant warning (MODULE_SHIPPING_USPS_REGULATIONS)
    - That 'soft' configuration setting is now available in the usps.php language file.
    - Additional, previously undefined language constants added in support of the display.
    - 'Return Receipt for Merchandise [107]' retired and USPS will return an error if requested.
    - Country name changes:
    - Country ('MK') changed from 'Macedonia, Republic of' to 'North Macedonia, Republic of'.
    - Country ('SZ') changed from 'Swaziland' to 'Eswatini'.
    - Country ('SS') added (South Sudan); note that the country is not currently registered in the countries table.
    - Add 'soft' configuration settings, present in the module's language file (refer to that file for additional information):
    - MODULE_SHIPPING_USPS_SHIPPING_CUTOFF ... the shipping cut-off time, used to determine the delivery date.
    - MODULE_SHIPPING_USPS_GROUNDONLY ... identifies whether the database field 'products::products_groundonly' should be interrogated.
    - MODULE_SHIPPING_USPS_FRAGILE ... identifies whether the database field 'products::products_fragile' should be interrogated.
    - Remove fallback 'plugin_check_for_updates' function. It's now expected to be present as part of the base Zen Cart distribution (zc152+).
    - Auto-disable on the storefront if no shipping services have been selected or if the store's country-of-origin isn't the US (country code 223).

  3. #3
    Join Date
    Nov 2007
    Location
    USA
    Posts
    818
    Plugin Contributions
    5

    Default Re: USPS Shipping Module [Support Thread]

    Thanks lat9 for the refresh and xoxo to Ajeh for all her efforts (past, present, and future), too.

    Where would the 'if clause' be inserted in this update to create a USPS Minimum Shipping Cost? Example $6 for 1st Class.
    USPS_2020_09_24_K11>includes>modules>shipping>usps.php @line 779 ?

    Was using this in previous versions. Thanks in advance.


    $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);

    to now force the amount ...
    Code:

    if ($cost < 6.00) { $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => (6.00 + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);} else { $methods[] = array('id' => $type, 'title' => $this->types[$type], 'cost' => ($cost + MODULE_SHIPPING_USPS_HANDLING) * $shipping_num_boxes);

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,914
    Plugin Contributions
    74

    Default Re: USPS Shipping Module [Support Thread]

    @webskipper, find the following code fragment, starting at line 724:
    Code:
                // add handling for shipping method costs for extra services applied
                $cost_original = $cost;
                $cost = ($cost + $handling + $hiddenCost) * $shipping_num_boxes;
                // add handling fee per Box or per Order
                $cost += (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box') ? $usps_handling_fee * $shipping_num_boxes : $usps_handling_fee;
    and add the highlighted code fragments:
    Code:
                // add handling for shipping method costs for extra services applied
                $cost_original = $cost;
    
    //-bof-Force minimum cost of $6.00
                if ($cost < 6) {
                    $cost = 6;
                }
    //-eof-Force minimum cost
    
                $cost = ($cost + $handling + $hiddenCost) * $shipping_num_boxes;
                // add handling fee per Box or per Order
                $cost += (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box') ? $usps_handling_fee * $shipping_num_boxes : $usps_handling_fee;

  5. #5
    Join Date
    Nov 2007
    Location
    USA
    Posts
    818
    Plugin Contributions
    5

    Default Re: USPS Shipping Module [Support Thread]

    Worked like magic! Thanks.

    Donated a Jackson.

  6. #6
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    7,504
    Plugin Contributions
    102

    Default Re: USPS Shipping Module [Support Thread]

    I will periodically see

    --> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /SITE/includes/modules/shipping/usps.php on line 492. // line 487 in an unmodified file

    where that line is

    $PackageSize = count($uspsQuote['Package']['Service']);

    This is the else branch of $this->is_us_shipment.

    Is it possible this branch needs the same check as the other branch, where we check count($uspsQuote['Package']); (line 480).
    That Software Guy. My Store: Zen Cart Modifications
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.

  7. #7
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,914
    Plugin Contributions
    74

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by swguy View Post
    I will periodically see

    --> PHP Warning: count(): Parameter must be an array or an object that implements Countable in /SITE/includes/modules/shipping/usps.php on line 492. // line 487 in an unmodified file

    where that line is

    $PackageSize = count($uspsQuote['Package']['Service']);

    This is the else branch of $this->is_us_shipment.

    Is it possible this branch needs the same check as the other branch, where we check count($uspsQuote['Package']); (line 480).
    Quite possible!

    What international methods and services does the site offer?
    Do you have any insight into the ship-to country/zone/postcode used when the warning was issued?

  8. #8
    Join Date
    Dec 2017
    Location
    Anderson, IN
    Posts
    26
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    Recently upgraded to 1.5.7 of ZC, but have not been able to import orders to stamps.com since Saturday. Should I have my web person install this module, or is it included in 1.5.7? Trying to figure out why I can't import; I have the updated php file that DrByte wrote, and it was working fine until today.

  9. #9
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    9,914
    Plugin Contributions
    74

    Default Re: USPS Shipping Module [Support Thread]

    Quote Originally Posted by CraftCorner View Post
    Recently upgraded to 1.5.7 of ZC, but have not been able to import orders to stamps.com since Saturday. Should I have my web person install this module, or is it included in 1.5.7? Trying to figure out why I can't import; I have the updated php file that DrByte wrote, and it was working fine until today.
    The USPS shipping module must be installed separately from the 'base' Zen Cart files. Note that the shipping-module has no effect on the ShipStation import; it's only active during a site's checkout.

  10. #10
    Join Date
    Feb 2008
    Posts
    35
    Plugin Contributions
    0

    Default Re: USPS Shipping Module [Support Thread]

    I'm trying to get this working on Zencart 1.5.5f and keep getting an error on the checkout page that says:

    "An error occurred in obtaining USPS shipping quotes.
    If you prefer to use USPS as your shipping method, please try refreshing this page, or contact the store owner."

    I've turned on debugging and the log has the following (I've replaced the username):

    2020-11-12 18:28:26: USPS build: 2020-09-24 K11

    Server: production
    Quote Request Rate Type: Retail
    Quote from main_page: checkout_shipping
    USPS Options (weight, time): --none--
    USPS Domestic Transit Time Calculation Mode: CUSTOM
    Cart Weight: 0.5
    Total Quote Weight: 0.5 Pounds: 0 Ounces: 8
    Maximum: 50 Tare Rates: Small/Medium: 0 Large: 0
    Handling method: Box Handling fee Domestic: $0.00 Handling fee International: $0.00
    Decimals: 3
    Domestic Length: 8.625 Width: 5.375 Height: 1.625
    International Length: 9.50 Width: 1.0 Height: 5.50
    All Packages are Machinable: False
    Enable USPS First-Class filter for US shipping: True
    Sorts the returned quotes: Unsorted

    ZipOrigination: 92065
    ZipDestination: Postcode: 32570 Country: United States City: Milton State: Florida
    Order SubTotal: $34.95
    Order Total: $34.95
    Uninsurable Portion: $0.00
    Insurable Value: $34.95

    2020-11-12 18:28:26: Sending request to USPS

    2020-11-12 18:28:41: ==================================

    SENT TO USPS:

    <RateV4Request USERID="**********"><Revision>2</Revision>
    <Package ID="0"><Service>First Class</Service><FirstClassMailType>FLAT</FirstClassMailType><ZipOrigination>92065</ZipOrigination><ZipDestination>32570</ZipDestination><Pounds>0</Pounds><Ounces>8</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Value>34.95</Value><Machinable>FALSE</Machinable></Package>
    <Package ID="1"><Service>First Class</Service><FirstClassMailType>PARCEL</FirstClassMailType><ZipOrigination>92065</ZipOrigination><ZipDestination>32570</ZipDestination><Pounds>0</Pounds><Ounces>8</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Value>34.95</Value><Machinable>FALSE</Machinable></Package>
    <Package ID="2"><Service>MEDIA</Service><ZipOrigination>92065</ZipOrigination><ZipDestination>32570</ZipDestination><Pounds>0</Pounds><Ounces>8</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Value>34.95</Value><Machinable>FALSE</Machinable></Package>
    <Package ID="3"><Service>PARCEL</Service><ZipOrigination>92065</ZipOrigination><ZipDestination>32570</ZipDestination><Pounds>0</Pounds><Ounces>8</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Value>34.95</Value><Machinable>FALSE</Machinable></Package>
    <Package ID="4"><Service>PRIORITY COMMERCIAL</Service><ZipOrigination>92065</ZipOrigination><ZipDestination>32570</ZipDestination><Pounds>0</Pounds><Ounces>8</Ounces><Container>VARIABLE</Container><Size>REGULAR</Size><Value>34.95</Value><Machinable>FALSE</Machinable></Package>
    </RateV4Request>


    RESPONSE FROM USPS:

    ==================================
    CommErr (should be 0): 28 - connect() timed out!

    ==================================

    USPS Country - $order->delivery[country][iso_code_2]: United States $this->usps_countries: US
    Domestic Services Selected:

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. MultiSite Module Support Thread
    By Gerome in forum All Other Contributions/Addons
    Replies: 2141
    Last Post: 11 Nov 2020, 10:36 PM
  2. Optional Shipping Insurance Module [Support Thread]
    By jettrue in forum Addon Shipping Modules
    Replies: 386
    Last Post: 6 Jan 2020, 11:02 PM
  3. Replies: 29
    Last Post: 24 Sep 2014, 09:59 PM
  4. Replies: 335
    Last Post: 1 Aug 2013, 08:54 PM
  5. PC Configurator Module [Support Thread]
    By lebrand2006 in forum All Other Contributions/Addons
    Replies: 254
    Last Post: 22 Aug 2012, 03:52 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