Page 5 of 7 FirstFirst ... 34567 LastLast
Results 41 to 50 of 70
  1. #41
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    This IF has no purpose, at this time:
    Code:
    // check total weight
    if (IS_ADMIN_FLAG == false) {
              $chk_weight = $_SESSION['cart']->in_cart_check('products_weight','0');
          }
    global $cart; is needed in each function ... but just 1 time per function ...
    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!

  2. #42
    Join Date
    Apr 2010
    Location
    Albuquerque, NM
    Posts
    198
    Plugin Contributions
    0

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    I sure hope I'm not driving you crazy.....

    Ok, I took that out of usps.php AND flat.php, and for now I'm working on Flat.

    I feel like I'm onto something, but may have the parentheses wrong, something is wrong, but I'm starting to understand this a bit!

    I realized I had to give flat.php more instructions so it will really know when to use it and when to not:

    PHP Code:
    global $cart;

    // check for manufacturer id alchemy
    if (IS_ADMIN_FLAG == false) {
              
    $chk_manufacturer $_SESSION['cart']->in_cart_check('manufacturers_id','1');
          }

    // disable if no alchemy products in cart
          
          
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') == 0)) {
              
    // hide FLAT
              
    $this->enabled false;
          } 

    // disable if there are weighted products
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') > 0)) {
              
    // hide FLAT
              
    $this->enabled false;
          } 

    // enable if total product weight is 0 AND there are alchemy products
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') == 0)) && (('manufacturers_id','1') > 0)) {
              
    // show FLAT
              
    $this->enabled true;
          } 

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

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    This one isn't doing anything and I think there is a unbalanced use of the parens:
    Code:
    // enable if total product weight is 0 AND there are alchemy products
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_weight') == 0)) && (('manufacturers_id','1') > 0)) {
              // show FLAT
              $this->enabled = true;
          }

    But the better way is to clean up all that code and condense it:
    Code:
      global $cart;
    // check for manufacturer id alchemy
      if (IS_ADMIN_FLAG == false) {
        $chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id','1');
        $chk_products_weight = $_SESSION['cart']->show_weight();
      }
    
    // enable if total product weight is 0 AND there are alchemy products
      if (IS_ADMIN_FLAG == false && $chk_products_weight == 0 && $chk_manufacturer > 0) {
        // show FLAT
        $this->enabled = true;
      } else {
        $this->enabled = false;
      }
    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. #44
    Join Date
    Apr 2010
    Location
    Albuquerque, NM
    Posts
    198
    Plugin Contributions
    0

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    I finally made this work and thought I'd update in case others were needing to do the same thing. With what I'd done up to this point it wasn't working correctly, and I finally just simplified it and had both the USPS and FLAT modules check the total cart weight, if it's zero it uses flat, if it's more than zero it uses USPS. If USPS is being used, it checks for Alchemy products, and if there are any it adds my flat rate to the USPS.

    Linda, thank you so much for sticking with me on this and helping me so much! I learned a lot!

    Here's the code in case it helps someone else, my added code is in green...

    In flat.php...
    Code:
     // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    
    // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    
    global $cart;
    
    // check total cart weight
      if (IS_ADMIN_FLAG == false) {  
        $chk_products_weight = $_SESSION['cart']->show_weight();
      }
    
    // enable if total product weight is 0 
      if (IS_ADMIN_FLAG == false && $chk_products_weight == 0) {
        // show FLAT
        $this->enabled = true;
      } else {
        // hide FLAT
        $this->enabled = false;
      }
    In usps.php....
    Code:
    // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_USPS_STATUS == 'True') ? true : false);
        }
    
    global $cart;
    
    // check cart weight
      if (IS_ADMIN_FLAG == false) {  
        $chk_products_weight = $_SESSION['cart']->show_weight();
      }
    
    // enable if total product weight is more than zero
      if (IS_ADMIN_FLAG == false && $chk_products_weight > 0) {
        // show USPS
        $this->enabled = true;
      } else {
        $this->enabled = false;
      }
    
    // BOF: UPS USPS
            $this->quotes = array('id' => $this->code,
            'module' => $this->title . $show_box_weight);
            // EOF: UPS USPS
    
        global $cart;
    
        //check if manufacturer alchemy is in cart 
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('manufacturers_id','1') > 0)); {
            $manufacturer_alchemy = $_SESSION['cart']->in_cart_check('manufacturers_id','1');  
            $drop_ship_extra_charge = $manufacturer_alchemy;
          } 
     
       // charge dropship fee for alchemy 
          if ($drop_ship_extra_charge > 0) { 
            $cat_extra_charge = 10; 
            echo 'An additional $10 shipping fee for Alchemy items has been applied.';
          } else {
            $cat_extra_charge = 0;
          }

  5. #45
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    Hi

    I haven't had any luck posting around elsewhere, so I thought I'd try here.

    I'd like to do something similar to the OP and what's been discussed here...

    I've been playing with the codes on this thread, as you can see below, but haven't had any success getting them to work for me.

    PHP Code:
    global $cart;

        
    //check if manufacturer is in cart 
          
    if ((IS_ADMIN_FLAG == false && 
    $_SESSION['cart']->in_cart_check('manufacturers_id','1','2') > 0)); {
            
    $manufacturer_excalibur$manufacturer_greenpower 
    $_SESSION['cart']->in_cart_check('manufacturers_id','1','2');  
          } 

    // enable if manufacturer is in cart 
      
    if (IS_ADMIN_FLAG == false && $chk_manufacturers_id == 0) {
        
    // show FLAT
        
    $this->enabled true;
      } else {
        
    // hide FLAT
        
    $this->enabled false;
      } 
    I want to get the cart to only show the Flat Rate shipping option when products from the manufacturers Excalibur and Greenpower are in the cart - otherwise show the Per Item option.

    I really have little idea how the coding works, so any help would be much appreciated.

    Thanks in advance,
    Tija

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

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    What happens if I have 1 Product from Excalibur and 2 Products from Greenpower and then 2 Products from other manufacturers_id ...
    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. #47
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    To control the Flat Rate flat shipping module so that it only shows if ALL products in the cart are from manufacturers_id 1 or 2 you can use:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    
        // check if manufacturer 1 or 2 is in cart
          if (IS_ADMIN_FLAG == false) {
            global $cart;
            $chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
            $chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
            $chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
            if ($chk_manufacturers_id > 0) {
              $this->enabled = true;
            } else {
              $this->enabled = false;
          }
    
    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!

  8. #48
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    Quote Originally Posted by Ajeh View Post
    To control the Flat Rate flat shipping module so that it only shows if ALL products in the cart are from manufacturers_id 1 or 2 you can use:
    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);
          }
    
        // check if manufacturer 1 or 2 is in cart
          if (IS_ADMIN_FLAG == false) {
            global $cart;
            $chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
            $chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
            $chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
            if ($chk_manufacturers_id > 0) {
              $this->enabled = true;
            } else {
              $this->enabled = false;
          }
    
    Ah, OK - thanks for the reply and for cleaning that up :)

    Quote Originally Posted by Ajeh View Post
    What happens if I have 1 Product from Excalibur and 2 Products from Greenpower and then 2 Products from other manufacturers_id ...
    Most of my items are drop-shipped and remain a flat rate no matter how many a customer buys, and I subsidise the shipping when a customer buys products combined with drop-shipped products. So the shipping remains $15.

  9. #49
    Join Date
    Jul 2010
    Location
    Australia
    Posts
    131
    Plugin Contributions
    0

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    OK, so I tried the code, Linda... now both the shipping estimator and the admin shipping modules page aren't working.

    I know I'm doing something wrong - I just have no idea what.

    Any suggestions?

    - Tija

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

    Default Re: Can I apply Flat Rate to one Category & Zone, Per Weight for all other Categories

    Yeps ... add the missing closing bracket that I left out:
    Code:
        // check if manufacturer 1 or 2 is in cart
          if (IS_ADMIN_FLAG == false) {
            global $cart;
            $chk_manufacturers_id1 = $_SESSION['cart']->in_cart_check('manufacturers_id', '1');
            $chk_manufacturers_id2 = $_SESSION['cart']->in_cart_check('manufacturers_id', '2');
            $chk_manufacturers_id = $chk_manufacturers_id1 + $chk_manufacturers_id2;
            if ($chk_manufacturers_id > 0) {
              $this->enabled = true;
            } else {
              $this->enabled = false;
            }
          }
    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 5 of 7 FirstFirst ... 34567 LastLast

Similar Threads

  1. How do I use FLAT RATE for one item - and UPS Ship by weight for the other 8 items?
    By MarleneF in forum Built-in Shipping and Payment Modules
    Replies: 36
    Last Post: 31 Aug 2011, 04:15 PM
  2. Flat rate for 1 category, Per Item for all others
    By Znak in forum Built-in Shipping and Payment Modules
    Replies: 19
    Last Post: 18 Aug 2011, 03:09 PM
  3. Multiple zone/flat rate and added cost per pound?
    By AmyCapolupo in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 14 Jul 2011, 09:21 AM
  4. How Can I Set a Flat Rate for shipping on 1 item and rest by weight ?
    By vividbreeze in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 1 Jan 2010, 05:26 AM
  5. Flat Rate for some products, ship by weight for other products
    By caspar in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 28 Mar 2007, 01:12 AM

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