Page 15 of 53 FirstFirst ... 5131415161725 ... LastLast
Results 141 to 150 of 522
  1. #141
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default Re: Different shipping methods for different categories

    You could test the cart for how many products are in a given master_categories_id and if there is 1 or more from the aerosols category then it raises the rate being charged in the Flat Rate flat shipping module ...

    In the shopping_cart class is this function:
    Code:
      /**
       * Method to calculate the number of items in a cart based on an abitrary property
       *
       * $check_what is the fieldname example: 'products_is_free'
       * $check_value is the value being tested for - default is 1
       * Syntax: $_SESSION['cart']->in_cart_check('product_is_free','1');
       *
       * @param string product field to check
       * @param mixed value to check for
       * @return integer number of items matching restraint
       */
      function in_cart_check($check_what, $check_value='1') {
    it can be used to test how many products are in the master_categories_id for this category using:
    $_SESSION['cart']->in_cart_check('master_categories_id','27')

    where 27 is the master_categories_id for the aerosols ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  2. #142
    Join Date
    Jul 2009
    Posts
    468
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    ok stupid question from me, how do i find my master category for "aerosols"
    manufacturer ambersil
    i may not know how yet, but i soon will....i hope :)

  3. #143
    Join Date
    Jul 2009
    Posts
    468
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    ok so im a bit lost, well alot...

    where do i enter that code, and how does it affect the flat.php shipping rate??

    im a total noob to this...sorry
    i may not know how yet, but i soon will....i hope :)

  4. #144
    Join Date
    Jun 2007
    Posts
    271
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    I have been playing around with this code attempting to turn off free shipping for certain categories, but so far have had no luck. I think because free shpping seems to flow in from multiple places.

    Any advice on how to accomplish this? Or am I being an idiot and just need to find hte right file.

    The other problem is that when I add the code the admin section gets screwy. No errors, but the right secion of the shipping admin where there are buttons and options dissapears.

    -lindasdd

  5. #145
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default Re: Different shipping methods for different categories

    Okay ... let's first break down what you are trying to do ...

    It sounds like you want a Flat Rate flat shipping module to run for the rate of 6.95 ... unless there is 1 or more Products from the aerosols category ... then the Flat Rate flat shipping module should be, for the whole order, set to 15.00 ...

    Now the trick is to test the shopping cart for 1 or more Products from the aerosols category ...

    Let's assume the aerosols category is categories_id 27 ... if that is the case, when you edit a Product from there, it should list the Master Category ...
    Product Master Category:

    this will either tell you the ID and Name of the Category or there will be a dropdown list, if this is a Linked Product ...

    The "Master Category" is the "Main Category" of a Product, as in the Category that "owns" the Product and is used for other things like Sales, setting the products_price_sorter, etc. etc. where a Master Category has to be known ...

    To control the Flat Rate flat shipping module for the amount to charge, we need to test if 1 or more Products are in the aerosols category, which we are using as categories_id 27 ... which would be set in the products table for the master_categories_id 27 ...

    To use this to change the Cost of the Flat Rate flat shipping module, you need to test and adjust the rate based on the results ...

    Editing the file:
    /includes/modules/shipping/flat.php

    There is a section of code that generates the quote or the cost:
    Code:
    // class methods
        function quote($method = '') {
          global $order;
    
          $this->quotes = array('id' => $this->code,
                                'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                                'methods' => array(array('id' => $this->code,
                                                         'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                         'cost' => MODULE_SHIPPING_FLAT_COST)));
          if ($this->tax_class > 0) {
            $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
          }
    
          if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
    
          return $this->quotes;
        }
    This needs to be changed ...
    Code:
    // class methods
        function quote($method = '') {
          global $order;
    
    // check for number of aerosols in cart and change rate if 1 or more are in the cart
      global $cart;
      $cnt_aerosols = $_SESSION['cart']->in_cart_check('master_categories_id','27');
      if ($cnt_aerosols > 0) {
        $flat_aerosols = 15.00;
      } else {
        $flat_aerosols = 0.00;
      }
          $this->quotes = array('id' => $this->code,
                                'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE,
                                'methods' => array(array('id' => $this->code,
                                                         'title' => MODULE_SHIPPING_FLAT_TEXT_WAY,
                                                         'cost' => ($flat_aerosols > 0 ? $flat_aerosols : MODULE_SHIPPING_FLAT_COST))));
          if ($this->tax_class > 0) {
            $this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
          }
    
          if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon, $this->title);
    
          return $this->quotes;
        }
    Now when products from categories_id 27, based on master_categories_id 27 in the products table are in the cart the rate will be 15.00 rather than what is set in the Flat Rate flat shipping module ...

    Easy Smeazy, eh?
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  6. #146
    Join Date
    Jun 2007
    Posts
    271
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by lindasdd View Post
    I have been playing around with this code attempting to turn off free shipping for certain categories, but so far have had no luck. I think because free shpping seems to flow in from multiple places.

    Any advice on how to accomplish this? Or am I being an idiot and just need to find hte right file.

    The other problem is that when I add the code the admin section gets screwy. No errors, but the right secion of the shipping admin where there are buttons and options dissapears.

    -lindasdd
    Just in case someone stumbles upon this later, I wanted to include my solution for my problem.

    1) Go to Admin>Modules>Order Total . Click on ot_shipping. Turn off the " allow free shipping" otherwise this overwrites everything else
    2) Install the Free Options Shipping module and configure
    3) Open the includes/modules/shipping/freeoptions.php file and adjust using Ajeh's code:

    right below this:

    Code:
          // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_FREEOPTIONS_STATUS == 'True') ? true : false);
    }

    add this:
    Code:
        // disable for one master_categories_id
        if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','66') > 0)) {
            $this->enabled = false;
        }
    But of course change the category id.

    Now if only I could get my Admin>Modules>Shipping screen to look normal.

  7. #147
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default Re: Different shipping methods for different categories

    What does not look normal on the Admin for the Modules ... Shipping ...

    Check that you do not have a bak file in there or extra shipping modules copies as that is a self loading directory and it will load files that it should not ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  8. #148
    Join Date
    Jun 2007
    Posts
    271
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    What does not look normal on the Admin for the Modules ... Shipping ...
    Well before the change the Module>Shipping screen had all the shipping methods ont he left and then the options for the highlighted shipping method on the right.

    Now the "options" portion on the right is no longer existent.

    No bak files and the shipping works, it is just that the Admin is screwy now.

    Also I'm using 1.3.7
    -lindasdd

  9. #149
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    64,726
    Plugin Contributions
    6

    Default Re: Different shipping methods for different categories

    If you do not have the right screen then there is either an error in one of the shipping modules or there is an extra file in the:
    /includes/modules/shipping directory that does not belong or there is a language file in the directory that should be fixed with the proper code file ...

    Check the files on the server in:
    /includes/modules/shipping

    and make sure that they are all the code files and that none are duplicates of one another ...

    If you have any new/customized files there could be an error in it that the Admin is detecting that the shop is not ...
    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.1]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...

  10. #150
    Join Date
    Jun 2007
    Posts
    271
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Awesome!

    I had renamed my old shipping file as freeoptions1 instead of freeoptions. I do this when making changes so that I can easily switch back if need be. Normally it doesn't create issues, but I guess in this case it was.

    Thanks for all your help.

    lindasdd

 

 
Page 15 of 53 FirstFirst ... 5131415161725 ... LastLast

Similar Threads

  1. Need Help with Shipping Methods
    By bigcaat in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Jul 2007, 04:35 PM
  2. Selecting Shipping Methods with free shipping
    By pasi in forum Built-in Shipping and Payment Modules
    Replies: 15
    Last Post: 15 Apr 2007, 05:28 PM
  3. Shipping Estimator Sort Shipping Methods
    By sitehatchery in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 15 Apr 2007, 05:34 AM
  4. List shipping methods automatically on Shipping and Return Page
    By gems14k in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 16 Jul 2006, 12:00 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
  •