Page 1 of 3 123 LastLast
Results 1 to 10 of 23
  1. #1
    Join Date
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    help question Write returned shipping quote vaules to order table

    I'm trying to write the quoted returned values from the following carriers UPS, FedEx, and USPS.

    I just need to write:

    UPS ground
    FedEx Ground
    USPS Priority Mail

    to the below tables I created in the orders database called:

    shipping_rate_ups
    shipping_rate_fedex
    shipping_rate_usps

    I updated the includes/classes/order.php and can write to the new tables using the following code:

    'shipping_rate_ups' => $_SESSION['shipping']['cost'],
    'shipping_rate_fedex' => $_SESSION['shipping']['cost'],
    'shipping_rate_usps' => $_SESSION['shipping']['cost']);

    I used the $_SESSION['shipping']['cost'] just to test the writing of the new tables which worked fine. Now I just need to grab the actual quoted returned values but I'm stuck and have no idea how to do it? Any help would be much appreciated!

  2. #2
    Join Date
    Dec 2011
    Location
    Wisconsin, USA
    Posts
    674
    Plugin Contributions
    21

    Default Re: Write returned shipping quote vaules to order table

    Ok...Can you clarify why you need to record the rates, they changes sometimes on a daily basis and there is virtually an infinite amount of combinations between zip-codes, weights, dimensions and services... Why not just use the live rates?

  3. #3
    Join Date
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    Default Re: Write returned shipping quote vaules to order table

    I'm going to start offering a flat rate (best way) shipping option which will loose me some money per shipment since it will be cheaper then the carriers actual rates. It will be offered alongside those options (UPS ground, Fedex Ground, USPS) by recording the real rates at the time of order I can then reference those rates and see which carrier was the cheapest and use them for that shipment. Doing it this way will guarantee I'm using the cheapest carrier to ship the package.

  4. #4
    Join Date
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    Default Re: Write returned shipping quote vaules to order table

    Just in case I was not clear in the below picture, I'm trying to log the following rates highlighted in yellow in the new tables I created in orders database.Name:  Snap1.png
Views: 158
Size:  22.5 KB

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

    Default Re: Write returned shipping quote vaules to order table

    You appear to want to save the lowest cost of each shipping module to your order ...

    For USPS you could customize the code:
    /includes/modules/shipping/usps.php

    around line 380 to include the code in RED:
    Code:
          // bof: save lowest cost to $_SESSION['shipping_rate_usps']
          $_SESSION['shipping_rate_usps'] == 0;
          // eof: save lowest cost to $_SESSION['shipping_rate_usps']
    
          for ($i=0; $i<$PackageSize; $i++) {
    Then around line 566 include the code in RED:
    Code:
            $cost += (MODULE_SHIPPING_USPS_HANDLING_METHOD == 'Box') ? $usps_handling_fee * $shipping_num_boxes : $usps_handling_fee;
            // bof: save lowest cost to $_SESSION['shipping_rate_usps']
            if ($_SESSION['shipping_rate_usps'] == 0 || $_SESSION['shipping_rate_usps'] > $cost) {
              $_SESSION['shipping_rate_usps'] = $cost;
            }
            // eof: save lowest cost to $_SESSION['shipping_rate_usps']
            // set the output title display name back to correct format
            $title = str_replace(array('RM', 'TM', '**'), array('&reg;', '&trade;', ''), $type_rebuilt);
    Maybe this will help you on the other shipping modules ...

    NOTE: I have not tested this code
    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!]
    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!

  6. #6
    Join Date
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    Default Re: Write returned shipping quote vaules to order table

    Thank you so much I will test later today and report back!!

  7. #7
    Join Date
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    Default Re: Write returned shipping quote vaules to order table

    Ajeh It worked perfect, and I was able to use your code to modify the UPS and FedEx modules as well without issue! Thank you again!

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

    Default Re: Write returned shipping quote vaules to order table

    You are most welcome ... thanks for the update that this worked for you ...
    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!]
    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
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    Default Re: Write returned shipping quote vaules to order table

    Ajeh,

    This has been working great however I'm adding UPS Surepost and need to save that as well as the Ground rate, can the above code be modified to save two/three rates? UPS uses service codes which are:

    Gound: 03
    SurePost: 92 less than 1 lb
    SurePost: 93 greater than 1 lb

    There will on be either a 92 or 93 not both plus code 03

  10. #10
    Join Date
    May 2008
    Location
    United States
    Posts
    490
    Plugin Contributions
    1

    Default Re: Write returned shipping quote vaules to order table

    Sorry there is a typo in my post above I do not need to save the surepost as ground I need to save both surepost and ground rates separately.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. Replies: 15
    Last Post: 1 Feb 2016, 01:36 AM
  2. user is returned to checkout after payment, and cart still holds the order
    By keneso in forum PayPal Express Checkout support
    Replies: 10
    Last Post: 11 Aug 2011, 09:33 AM
  3. How to write in new database table?
    By fawad123 in forum General Questions
    Replies: 2
    Last Post: 27 Sep 2010, 06:58 PM
  4. Shipping address lines missing=returned shipments
    By d0ugparker in forum General Questions
    Replies: 3
    Last Post: 15 Dec 2009, 03:00 AM

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