Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24
  1. #21
    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.

  2. #22
    Join Date
    May 2010
    Location
    Texas
    Posts
    387
    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?

  3. #23
    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: 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!

  4. #24
    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 ...

 

 
Page 3 of 3 FirstFirst 123

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

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