Results 1 to 10 of 24

Hybrid View

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

    Default Re: Display Total weight in Admin/orders

    You need to add a new field, such as:
    shipping_weight_total

    to the table:
    orders

    use the sql:
    Code:
    alter table orders add shipping_weight_total decimal(14,5);
    which you can run in the Tools ... Install SQL Patches ...

    or, use phpMyAdmin, as be sure to address the table prefix if you use them ...

    Then, you need to save the weight to a session variable, in the shipping class:
    Code:
          switch (true) {
            // large box add padding
            case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
              break;
            default:
            // add tare weight < large
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
              break;
          }
    
    // bof: save weight for later use
      $_SESSION['total_order_weight'] = $shipping_weight;
    // eof: save weight for later use
    Next, you need to customize the order class to add the weight to the table:
    orders

    with:
    Code:
                                'order_total' => $this->info['total'],
                                'order_tax' => $this->info['tax'],
                                'currency' => $this->info['currency'],
                                'currency_value' => $this->info['currency_value'],
                              'shipping_weight' => $_SESSION['total_order_weight'],
                                'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                );
    and that should work with most shipping modules ...

    NOTE: be careful of shipping modules where there are other weight calculations in it that may be different than the weight calculation of shipping class and will need to be addressed differently ...
    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!

  2. #2
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    I am loosing it. I have one site where I always see the total weight of an order (in Adming - Customers - Orders) just below the purchased products it shows:
    Total Weight is 12 lbs. 0 oz.
    Sub-Total: $135.00
    Free Shipping Options (Free Shipping): $0.00
    Sales Tax: $0.00
    Total: $135.00

    On all my other up to date 1.5.1 sites it does not show a Total Weight line with Free Shipping Options used. If UPS and USPS shipping options were used to complete the order, shipping weight shows on the order detail in admin. I don't believe I've done any of the above mentioned modifications on this particular site. If, then it was many years ago on an very old Zen version. I've been upgrading this site from 1.3.0 on to today so it is possible that an add on executed some sql in the past that added the needed stuff. How do I go about to have this Total Weight show on my order detail page that I need to process the orders. I need the weight calculation on Free Shipping as well. Not sure why this is not standard anyway. If I need to ship goods, it has a weight even if customer does not pay for it.
    Live and learn... the Zen way.

  3. #3
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    Would the USPS.com Click-n-Ship AutoFill Button module return total weight on the order detail in admin for ALL order no matter if free shipping? Maybe just installing this module could do the trick or one could implement some of the code just for weight display purpose. Just a thought...

    I would rather just fix it without needing to install/merge this whole add on.
    Live and learn... the Zen way.

  4. #4
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    Quote Originally Posted by Ajeh View Post
    You need to add a new field, such as:
    shipping_weight_total

    to the table:
    orders

    use the sql:
    Code:
    alter table orders add shipping_weight_total decimal(14,5);
    which you can run in the Tools ... Install SQL Patches ...

    or, use phpMyAdmin, as be sure to address the table prefix if you use them ...

    Then, you need to save the weight to a session variable, in the shipping class:
    Code:
          switch (true) {
            // large box add padding
            case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
              break;
            default:
            // add tare weight < large
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
              break;
          }
    
    // bof: save weight for later use
      $_SESSION['total_order_weight'] = $shipping_weight;
    // eof: save weight for later use
    Next, you need to customize the order class to add the weight to the table:
    orders

    with:
    Code:
                                'order_total' => $this->info['total'],
                                'order_tax' => $this->info['tax'],
                                'currency' => $this->info['currency'],
                                'currency_value' => $this->info['currency_value'],
                              'shipping_weight' => $_SESSION['total_order_weight'],
                                'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                );
    and that should work with most shipping modules ...

    NOTE: be careful of shipping modules where there are other weight calculations in it that may be different than the weight calculation of shipping class and will need to be addressed differently ...
    Tried this too and I get a "WARNING: An Error occurred, please refresh the page and try again. " at the last step of checkout where the order confirmation should display. If I remove the line "'shipping_weight' => $_SESSION['total_order_weight']," again, then I can checkout. I must say I use COWOA, maybe that makes it fail?
    Live and learn... the Zen way.

  5. #5
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    I notice that my orders table has the field total_weight stored in the 1.3.9a installation where the weight displays correctly. I think this is from the USPS auto fill mod.

    How do other store users get to display total weight of an order with free shipping? We all need to ship the products even if we grant free shipping to our customers. I don't understand that this is not a present and ready function of core install. Did I miss something?
    Live and learn... the Zen way.

  6. #6
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    Well, as nobody joins in I keep posting my progress. I have now installed the newest USPS Auto fill 1.6 and this does give me the order total weight even on older existing orders. Kind of overkill as I don't want the USPS autofill anymore on my newest installs. If somebody has another working solutions it would be much appreciated.
    Live and learn... the Zen way.

  7. #7
    Join Date
    Dec 2004
    Posts
    1,031
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    Looked at the USPS mod a bit closer and stripped out what is not needed to just give me the total weight on the order page. Works like a charm. Hit me up if you want to do the same thing.
    Modified my orders.php with just this code from the USPS mod orders.php

    <?php // ====> BOF: USPS.com AutoFill <==== ?>
    <?php require(DIR_WS_MODULES . 'usps_autofill_button.php'); ?>
    <tr><td align="right" colspan="2"><?php echo "Total Weight is $lbsval lbs. $ozval oz."; ?></td></tr>
    <?php // ====> EOF: USPS.com AutoFill <==== ?>

    Uploaded the two needed files in corresponding directory
    functions_ordertotalweight.php
    usps_autofill_button.php

    Executed the following SQL:
    SET @gid=0;
    SELECT @gid:=configuration_group_id
    FROM configuration_group
    WHERE configuration_group_title LIKE '%USPS Auto-Fill Config%'
    LIMIT 1;
    DELETE FROM configuration_group WHERE configuration_group_title LIKE '%USPS Auto-Fill Config%';
    DELETE FROM configuration_group WHERE configuration_group_title LIKE '%USPS AutoFill%';
    DELETE FROM configuration_group WHERE configuration_group_title LIKE '%USPS AutoFill Config%';
    DELETE FROM admin_pages WHERE page_key='uspsautofill';
    DELETE FROM configuration WHERE configuration_key LIKE 'USPS_RETURN%' LIMIT 8;
    DELETE FROM configuration WHERE configuration_key LIKE 'USPS_DELIVERY%' LIMIT 9;

    #ok until here 8 statements processed

    # Insert New USPS AutoFill Configuration Group
    INSERT INTO configuration_group VALUES ('', 'USPS AutoFill', 'USPS AutoFill Config', '1', '1');
    SET @gid=last_insert_id();
    UPDATE configuration_group SET sort_order = @gid WHERE configuration_group_id = @gid;
    #ok until here 3 statements processed

    INSERT INTO configuration VALUES (NULL, 'Delivery: Default Weight (Pounds)', 'USPS_DELIVERY_DEFAULT_WEIGHTS_POUNDS', '', 'Set this to the default weight in pounds. Useful if you sell only one type of item. Leave blank if using the order total weight', @gid, '55', now(), now(), NULL, NULL),
    (NULL, 'Delivery: Default Weight (Ounces)', 'USPS_DELIVERY_DEFAULT_WEIGHTS_OUNCES', '', 'Set this to the default weight in ounces. Useful if you sell only one type of item. Leave blank if using the order total weight', @gid, '60', now(), now(), NULL, NULL),
    (NULL, 'Delivery: Default Shipping from Same ZipCode (Radio Button)', 'USPS_DELIVERY_SAME_ZIPCODE', 'same', 'Set this to same if you want to have your Return Address Zipcode as the default Ship-From zipcode. If set to Other, then enter in your default Ship-From zipcode in the next setting', @gid, '65', now(), now(), NULL, "zen_cfg_select_option(array('same', 'other'),"),
    (NULL, 'Delivery: Default Shipping from Other ZipCode (If Radio Button set to Other)', 'USPS_DELIVERY_OTHER_ZIPCODE', '', 'Set the default ZipCode you would like as your Ship-From zipcode. Only if the above setting is set to Other', @gid, '70', now(), now(), NULL, NULL),
    (NULL, 'Delivery: Default Insurance Value', 'USPS_DELIVERY_INSURANCE_VALUE', '', 'Set to total or subtotal if you want to use that order value for the insurance value, or set to a price (i.e. 5.25) if you want to use a preset price. Or leave blank to not use it', @gid, '75', now(), now(), NULL, NULL);
    ALTER TABLE orders DROP total_weight;
    ALTER TABLE orders ADD total_weight FLOAT NOT NULL DEFAULT '-1';

    #Below seems not needed for my weight total mod only
    # Register the pages for Admin Access Control
    #DELETE FROM admin_pages WHERE page_key='uspsautofill';
    #INSERT INTO admin_pages (page_key,language_key,main_page,page_params,menu_key,display_on_menu,sort_order ) VALUES ('uspsautofill','BOX_CONFIGURATION_USPS_AUTOFILL','FILENAME_CONFIGURATION','1',' configuration','Y','1');
    #UPDATE admin_pages SET sort_order = (SELECT configuration_group_id FROM configuration_group WHERE configuration_group_title = 'USPS AutoFill') WHERE page_key = 'uspsautofill';
    #UPDATE admin_pages SET page_params = CONCAT('gID=',(SELECT configuration_group_id FROM configuration_group WHERE configuration_group_title = 'USPS AutoFill')) WHERE page_key = 'uspsautofill';


    That was it. Maybe not an elegant solution but it works for me.
    Live and learn... the Zen way.

  8. #8
    Join Date
    May 2010
    Location
    Texas
    Posts
    508
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    Quote Originally Posted by Ajeh View Post
    You need to add a new field, such as:
    shipping_weight_total

    to the table:
    orders
    Ajeh,

    Was "shipping_weight_total" added to any of the 1.5x releases?

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

    Default Re: Display Total weight in Admin/orders

    Afraid not ...

    In v1.6 there will be a new field for the Order's total weight in the table:
    orders

    called:
    order_weight
    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!

  10. #10
    Join Date
    May 2004
    Location
    UK
    Posts
    478
    Plugin Contributions
    0

    Default Re: Display Total weight in Admin/orders

    I am aware that this is a very old post however I needed to get the value of the WEIGHT of the order and as it looks like 1.5.x versions still are not saving the shipping weight, so I used Ajeh helpful post. But people were getting errors when using this - the error on the text below is the column name inserted into the table doesn't match what you insert via the orders class.. once they match up this works for me

    So
    edit table
    Code:
    alter table orders add shipping_weight_total decimal(14,5);
    classes/shipping.php
    Code:
          switch (true) {
            // large box add padding
            case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
              break;
            default:
            // add tare weight < large
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
              break;
          }
    
    // bof: save weight for later use
      $_SESSION['total_order_weight'] = $shipping_weight;
    // eof: save weight for later use
    then classes/orders.php
    Code:
                                'order_total' => $this->info['total'],
                                'order_tax' => $this->info['tax'],
                                'currency' => $this->info['currency'],
                                'currency_value' => $this->info['currency_value'],
                              'shipping_weight_total' => $_SESSION['total_order_weight'],
                                'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                );
    and that works for me

    Thanks
    Sarah

    Quote Originally Posted by Ajeh View Post
    You need to add a new field, such as:
    shipping_weight_total

    to the table:
    orders

    use the sql:
    Code:
    alter table orders add shipping_weight_total decimal(14,5);
    which you can run in the Tools ... Install SQL Patches ...

    or, use phpMyAdmin, as be sure to address the table prefix if you use them ...

    Then, you need to save the weight to a session variable, in the shipping class:
    Code:
          switch (true) {
            // large box add padding
            case(SHIPPING_MAX_WEIGHT <= $shipping_weight):
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_large_percent/100)) + $zc_large_weight;
              break;
            default:
            // add tare weight < large
              $shipping_weight = $shipping_weight + ($shipping_weight*($zc_tare_percent/100)) + $zc_tare_weight;
              break;
          }
    
    // bof: save weight for later use
      $_SESSION['total_order_weight'] = $shipping_weight;
    // eof: save weight for later use
    Next, you need to customize the order class to add the weight to the table:
    orders

    with:
    Code:
                                'order_total' => $this->info['total'],
                                'order_tax' => $this->info['tax'],
                                'currency' => $this->info['currency'],
                                'currency_value' => $this->info['currency_value'],
                              'shipping_weight' => $_SESSION['total_order_weight'],
                                'ip_address' => $_SESSION['customers_ip_address'] . ' - ' . $_SERVER['REMOTE_ADDR']
                                );
    and that should work with most shipping modules ...

    NOTE: be careful of shipping modules where there are other weight calculations in it that may be different than the weight calculation of shipping class and will need to be addressed differently ...

 

 

Similar Threads

  1. v139h Total weight on orders.php
    By wirefram in forum Managing Customers and Orders
    Replies: 6
    Last Post: 23 Jul 2012, 05:21 PM
  2. Total Weight on Admin - Orders not showing
    By mydanilo in forum Customization from the Admin
    Replies: 20
    Last Post: 30 Sep 2011, 08:14 AM
  3. display the total weight In admin
    By dmagic in forum Managing Customers and Orders
    Replies: 4
    Last Post: 3 May 2011, 02:28 PM
  4. Replies: 1
    Last Post: 9 Sep 2009, 12:11 PM
  5. Replies: 1
    Last Post: 24 Aug 2009, 07:53 PM

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