Page 1 of 2 12 LastLast
Results 1 to 10 of 19
  1. #1
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Flat rate shipping based on master category ID?

    Hello all,

    I'm trying to sort out shipping within my development site.

    I need 3 types of flat rate shipping.

    1 ) Livestock, ( eg, cat ID's 1, 4 & 5 )
    2 ) Drystock ( eg, cat ID's 2 & 6 )
    3 ) Mix of both (eg, Cat ID's 1, 4 & 6 )

    I *think* I need to duplicate the flat rate shipping module twice ( giving me 3 flat rates ), then have them check the basket for items within selected categories and then estimate shipping based on that?

    1 would be £8.00
    2 would be £5
    3 would be £10

    My PHP knowledge isn't the best so I was hoping someone might be able to help with my query?

    Jake

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

    Default Re: Flat rate shipping based on master category ID?

    I buy 12 Products from master_categories_id 1, 4 and 5 and pay just £8.00, correct?

    I buy 12 Products from master_categories_id 2 and 6 and pay just £5, correct?

    I buy 12 Products from master_categories_id 1, 2, 4, 5 and 6 and pay just £10, correct?
    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. #3
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Flat rate shipping based on master category ID?

    Yes that is correct :) Prices stay the same regardless of quantities purchased :)

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

    Default Re: Flat rate shipping based on master category ID?

    The cloning the Flat Rate flat module would be the best choice and then customize when each of the modules show based on the content of the shopping cart ...
    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. #5
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Flat rate shipping based on master category ID?

    Quote Originally Posted by Ajeh View Post
    The cloning the Flat Rate flat module would be the best choice and then customize when each of the modules show based on the content of the shopping cart ...
    Thanks that is what I was thinking.

    Any idea of the codes needed for each module in order for them to check the cart contents?

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

    Default Re: Flat rate shipping based on master category ID?

    You can use the code in RED and adapt it as needed:
    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);
          }
    
    // bof: only show for category 1, 4 and 5
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','1');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','5');
          if ($chk_cat != $_SESSION['cart']->show_total()) {
            $this->enabled = false;
          }
    // eof: only show for category 1, 4 and 5
    
    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. #7
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Flat rate shipping based on master category ID?

    Quote Originally Posted by Ajeh View Post
    You can use the code in RED and adapt it as needed:
    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);
          }
    
    // bof: only show for category 1, 4 and 5
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','1');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','5');
          if ($chk_cat != $_SESSION['cart']->show_total()) {
            $this->enabled = false;
          }
    // eof: only show for category 1, 4 and 5
    
    Thanks very much for that :)

  8. #8
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Flat rate shipping based on master category ID?

    I've managed to clone the shipping module and update them for Livestock & Drystock, but I can't work out the third one for "mixed" orders containing both.

    Does it actually need it's own code adding, or not due to the other codes using single category ID's ( i.e, if two different ID's were used ( 2 & 6 ), would the standard flat rate shipping come into play?

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

    Default Re: Flat rate shipping based on master category ID?

    Also, you need to add for the Admin an IF around the new code:
    Code:
    if (!IS_ADMIN_FLAG) {
    // new code here
    }
    For checking it is a mixed cart try:
    Code:
    // bof: only show for mixed cart category 1, 4 and 5 & category 2 and 6
    if (!IS_ADMIN_FLAG) {
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','1');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','5');
    
          $chk_cat2 = 0;
          $chk_cat2 += $_SESSION['cart']->in_cart_check('master_categories_id','2');
          $chk_cat2 += $_SESSION['cart']->in_cart_check('master_categories_id','6');
    
    //echo 'Flat sees $chk_cat: ' . $chk_cat . ' $chk_cat2: ' . $chk_cat2 . '<br>';
    
          if ($this->enabled && ($chk_cat > 0 && $chk_cat2 > 0)) {
            $this->enabled = true;
          } else {
            $this->enabled = false;
          }
    }
    // eof: only show for mixed cart category 1, 4 and 5 & category 2 and 6
    That echo can be uncommented for testing purposes ...
    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!

  10. #10
    Join Date
    Jul 2011
    Posts
    21
    Plugin Contributions
    0

    Default Re: Flat rate shipping based on master category ID?

    Quote Originally Posted by Ajeh View Post
    Also, you need to add for the Admin an IF around the new code:
    Code:
    if (!IS_ADMIN_FLAG) {
    // new code here
    }
    For checking it is a mixed cart try:
    Code:
    // bof: only show for mixed cart category 1, 4 and 5 & category 2 and 6
    if (!IS_ADMIN_FLAG) {
          $chk_cat = 0;
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','1');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','4');
          $chk_cat += $_SESSION['cart']->in_cart_check('master_categories_id','5');
    
          $chk_cat2 = 0;
          $chk_cat2 += $_SESSION['cart']->in_cart_check('master_categories_id','2');
          $chk_cat2 += $_SESSION['cart']->in_cart_check('master_categories_id','6');
    
    //echo 'Flat sees $chk_cat: ' . $chk_cat . ' $chk_cat2: ' . $chk_cat2 . '<br>';
    
          if ($this->enabled && ($chk_cat > 0 && $chk_cat2 > 0)) {
            $this->enabled = true;
          } else {
            $this->enabled = false;
          }
    }
    // eof: only show for mixed cart category 1, 4 and 5 & category 2 and 6
    That echo can be uncommented for testing purposes ...
    I've implemented the above but it doesn't seem to work.

    I've got the flat rate shippings to display, but the cheapest shipping option comes up bold on checkout and allows checkout regardless of category number.

    I need it to automatically select shipping based on category ID or even automatically add the correct shipping to customer total at checkout?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 16
    Last Post: 29 Jan 2013, 06:03 PM
  2. Flat rate shipping based on location
    By ztotheetothen in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 10 Feb 2011, 08:21 PM
  3. Shipping mods based on flat rate
    By delia in forum Contribution-Writing Guidelines
    Replies: 9
    Last Post: 16 Apr 2010, 02:24 PM
  4. Flat Rate Shipping based on Product
    By Tihumatech in forum Addon Shipping Modules
    Replies: 1
    Last Post: 12 Dec 2008, 08:40 PM
  5. Flat Rate Shipping based on UK/EU and ROW and product category?
    By HeathenMagic in forum Addon Shipping Modules
    Replies: 0
    Last Post: 24 Jul 2007, 07:44 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