Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 22
  1. #11
    Join Date
    Dec 2016
    Location
    San Diego, CA USA
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to add per item fee (based on category) to the ups module

    Hi Linda,

    I'm new to PHP but I was able to modify your code somewhat to my purposes. I'm trying to create 2 additional handling categories in your UPS Module. One for shipping a 4' tube to add an additional $10 to the shipping cost, and one for shipping an 8' tube to add the $10 cost of the tube, plus the mandatory $10.50 addl. handling fee for UPS. Here's my code, but it shows 2 of every shipping option in the cart, and it only takes the 4' option. Any advice is appreciated!
    PHP Code:
    // bof: customize for extra charges
          
    global $cart;
          
    $chk_molding 0;
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','141');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','136');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','137');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','139');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','138');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','140');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','142');
          
    $chk_molding += $_SESSION['cart']->in_cart_check('master_categories_id','171');
          
    $chk_molding4 0;
          
    $chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','164');
          
    $chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','165');
          
    $chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','166');
          
    $chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','167');
          
    $chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','169');
          
    $chk_molding4 += $_SESSION['cart']->in_cart_check('master_categories_id','170');
    // continue adding for more categories
          
    $molding_handling 0;
          if (
    $chk_molding 0) {
            
    // add tube
            
    $molding_handling 10.00;
            
    // add extra handling
            
    $molding_handling += 10.50;
          } 
    $molding4_handling 0;
          if (
    $chk_molding4 0) {
            
    // add tube
            
    $molding_handling 10.00;
          }
    // add $molding_handling to cost
        
    $methods[] = array('id' => $type,
                               
    'title' => $this->types[$type],
                               
    'cost' => ($cost $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' MODULE_SHIPPING_UPS_HANDLING $shipping_num_boxes MODULE_SHIPPING_UPS_HANDLING) + $molding_handling );
    // add $molding4_handling to cost
        
    $methods[] = array('id' => $type,
                               
    'title' => $this->types[$type],
                               
    'cost' => ($cost $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' MODULE_SHIPPING_UPS_HANDLING $shipping_num_boxes MODULE_SHIPPING_UPS_HANDLING) + $molding4_handling );
    // eof: customize for extra charges 
    Thanks in advance!
    Using v1.5.0 - clean install, no upgrades: http://restorationstuff.com/ecommerce
    ~Joe

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

    Default Re: Need to add per item fee (based on category) to the ups module

    You put the building of the cost in twice with:
    Code:
    // add $molding_handling to cost 
        $methods[] = array('id' => $type, 
                               'title' => $this->types[$type], 
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) + $molding_handling ); 
    // add $molding4_handling to cost 
        $methods[] = array('id' => $type, 
                               'title' => $this->types[$type], 
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) + $molding4_handling ); 
    // eof: customize for extra charges  
    
    Change that to:
    Code:
    // add $molding_handling to cost 
    // add $molding4_handling to cost 
        $methods[] = array('id' => $type, 
                               'title' => $this->types[$type], 
                               'cost' => ($cost * $shipping_num_boxes) + (MODULE_SHIPPING_UPS_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_UPS_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_UPS_HANDLING) + $molding_handling + $molding4_handling ); 
    
    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. #13
    Join Date
    Dec 2016
    Location
    San Diego, CA USA
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to add per item fee (based on category) to the ups module

    Oh my goodness, you're a genius. Thank you so much!!! Only one little issue remains: If a customer orders both a 4' stick and an 8' stick of molding, the cart only applies the 4' tube charge. Is there an easy fix for that?

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

    Default Re: Need to add per item fee (based on category) to the ups module

    Are you charge 1 fee for all of the matches or 1 per each match?
    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. #15
    Join Date
    Dec 2016
    Location
    San Diego, CA USA
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to add per item fee (based on category) to the ups module

    Thanks for the prompt responses! Only one fee per shipment; $10 for a 4 foot tube, and $20.50 for an 8 foot tube. But if a customer needs a 4 foot and an 8 foot item we'll obviously ship them both in the 8' tube, that's where the code is only charging $10 instead of $20.50.

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

    Default Re: Need to add per item fee (based on category) to the ups module

    Try changing the code from:
    Code:
    // continue adding for more categories 
          $molding_handling = 0; 
          if ($chk_molding > 0) { 
            // add tube 
            $molding_handling = 10.00; 
            // add extra handling 
            $molding_handling += 10.50; 
          }  
    $molding4_handling = 0; 
          if ($chk_molding4 > 0) { 
            // add tube 
            $molding_handling = 10.00; 
          } 
    
    to be:
    Code:
    // continue adding for more categories 
          $molding_handling = 0; 
          if ($chk_molding > 0) { 
            // add tube 
            $molding_handling = 10.00; 
            // add extra handling 
            $molding_handling += 10.50; 
          }  
    $molding4_handling = 0; 
          if ($chk_molding4 > 0) { 
            // add tube 
            $molding4_handling = 10.00; 
          } 
    
    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!

  7. #17
    Join Date
    Dec 2016
    Location
    San Diego, CA USA
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to add per item fee (based on category) to the ups module

    We're closer, but if now if the customer ordered both an 8 foot and a 4 foot it charges for both instead of just the required 8 foot tube. Seems like I need one of those magical 'else if' statements that I have no idea how to program LOL... You're amazing, coffee and donuts on me!

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

    Default Re: Need to add per item fee (based on category) to the ups module

    Okay let's try this:
    Code:
    // continue adding for more categories 
          $molding_handling = 0; 
          if ($chk_molding > 0) { 
            // add tube 
            $molding_handling = 10.00; 
            // add extra handling 
            $molding_handling += 10.50; 
          }  
    $molding4_handling = 0; 
          if ($chk_molding4 > 0) { 
            // add tube 
            $molding4_handling = 10.00; 
          } 
          if ($chk_molding > 0 && $chk_molding4 > 0) { 
    $molding_handling = 0;
          }
    
    
    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. #19
    Join Date
    Dec 2016
    Location
    San Diego, CA USA
    Posts
    6
    Plugin Contributions
    0

    Default Re: Need to add per item fee (based on category) to the ups module

    This modification only charges for the 4' tube if I include an 8' stick :-(

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

    Default Re: Need to add per item fee (based on category) to the ups module

    Then change this from:
    Code:
          if ($chk_molding > 0 && $chk_molding4 > 0) {  $molding_handling = 0;       }
    
    to read:
    Code:
          if ($chk_molding > 0 && $chk_molding4 > 0) { 
            $molding_handling = 20.50;
            $molding4_handling= 0.00;
          }
    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!

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Shipping Cost Based On Item Category With Discount Per Multiple Items In Category
    By CFen in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 22 Nov 2011, 07:05 PM
  2. New York sales tax on clothing - need to apply tax based on per-item price
    By sugarhill in forum Currencies & Sales Taxes, VAT, GST, etc.
    Replies: 0
    Last Post: 3 Sep 2009, 09:38 PM
  3. Handling Fee per item with zipship module
    By xtracool in forum Addon Shipping Modules
    Replies: 0
    Last Post: 9 May 2009, 04:04 AM
  4. Require UPS 2nd Day Air based on Category of Item
    By alias3729 in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 27 Feb 2009, 06:06 PM
  5. Rush fee per order not per item
    By Blake81 in forum General Questions
    Replies: 3
    Last Post: 16 Jan 2009, 05:02 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