Page 19 of 56 FirstFirst ... 9171819202129 ... LastLast
Results 181 to 190 of 552
  1. #181
    Join Date
    Jul 2009
    Location
    Crystal Lake, IL
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Alright, so I still need help. I tried modifying the code for checking multiple categories for media mail, and applying that to the flat rate. This is what I tried:
    Code:
    // test contents for Cases
            $skip_free = false;
            $chk_case = 0;
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','56');
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','60');
            if ($chk_case != $_SESSION['cart']->count_contents()) {
              $skip_free = true;
            }
          // disable for one master_categories_id 
          if ((IS_ADMIN_FLAG == false && $skip_free) { 
              $this->enabled = false;
    I know that last label is wrong now, but I forgot to change that. In case you can't tell, I need to check for categories 56 and 60, but in the future that will include more categories as well. What did I do wrong?

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

    Default Re: Different shipping methods for different categories

    If you don't have a line:
    global $cart;

    above that code, that may be all that is missing ...
    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!]
    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. #183
    Join Date
    Jul 2009
    Location
    Crystal Lake, IL
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Here's what I tried
    Code:
     // test contents for Cases
          global $cart;  
            $skip_free = false;
            $chk_case = 0;
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','56');
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','60');
            if ($chk_case != $_SESSION['cart']->count_contents()) {
              $skip_free = true;
            }
          // disable for above categories 
          if ((IS_ADMIN_FLAG == false && $skip_free) { 
              $this->enabled = false;
          }
    and it didn't work. Thanks again for your help on this!
    -Matt

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

    Default Re: Different shipping methods for different categories

    Where in the code did you add this?
    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!]
    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. #185
    Join Date
    Jul 2009
    Location
    Crystal Lake, IL
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    I simply added that code in place of this code
    Code:
    // disable for one master_categories_id 
          if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('master_categories_id','56')) > 0) { 
              $this->enabled = false; 
          }
    It's around line 43 for me.

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

    Default Re: Different shipping methods for different categories

    Let's try this ...

    Can you just post the whole code so there isn't any confusion here ... there are a lot of ways to use this code and it seems to me either you are in the wrong place or the code is off a bit ...
    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!]
    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. #187
    Join Date
    Jul 2009
    Location
    Crystal Lake, IL
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Alright, here is the entire file.
    Code:
    <?php
    //
    // +----------------------------------------------------------------------+
    // |zen-cart Open Source E-commerce                                       |
    // +----------------------------------------------------------------------+
    // | Copyright (c) 2004 The zen-cart developers                           |
    // |                                                                      |
    // | http://www.zen-cart.com/index.php                                    |
    // |                                                                      |
    // | Portions Copyright (c) 2003 osCommerce                               |
    // +----------------------------------------------------------------------+
    // | This source file is subject to version 2.0 of the GPL license,       |
    // | that is bundled with this package in the file LICENSE, and is        |
    // | available through the world-wide-web at the following url:           |
    // | http://www.zen-cart.com/license/2_0.txt.                             |
    // | If you did not receive a copy of the zen-cart license and are unable |
    // | to obtain it through the world-wide-web, please send a note to       |
    // | [email protected] so we can mail you a copy immediately.          |
    // +----------------------------------------------------------------------+
    // $Id: flat.php 1969 2005-09-13 06:57:21Z drbyte $
    //
    
      class flat {
        var $code, $title, $description, $icon, $enabled;
    
    // class constructor
        function flat() {
          global $order, $db;
    
          $this->code = 'flat';
          $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
          $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
          $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
          $this->icon = '';
          $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
          $this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;
    
          // disable only when entire cart is free shipping 
          if (zen_get_shipping_enabled($this->code)) { 
              $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false); 
          } 
          // test contents for Cases
           global $cart;  
            $skip_free = false;
            $chk_case = 0;
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','56');
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','60');
            if ($chk_case != $_SESSION['cart']->count_contents()) {
              $skip_free = true;
            }
          // disable for above categories 
          if ((IS_ADMIN_FLAG == false && $skip_free) { 
              $this->enabled = false;
          }
    
          if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT_ZONE > 0) ) {
            $check_flag = false;
            $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FLAT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
            while (!$check->EOF) {
              if ($check->fields['zone_id'] < 1) {
                $check_flag = true;
                break;
              } elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
                $check_flag = true;
                break;
              }
              $check->MoveNext();
            }
    
            if ($check_flag == false) {
              $this->enabled = false;
            }
          }
        }
    
    // 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;
        }
    
        function check() {
          global $db;
          if (!isset($this->_check)) {
            $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FLAT_STATUS'");
            $this->_check = $check_query->RecordCount();
          }
          return $this->_check;
        }
    
        function install() {
          global $db;
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Flat Shipping', 'MODULE_SHIPPING_FLAT_STATUS', 'True', 'Do you want to offer flat rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_FLAT_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FLAT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FLAT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
          $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
        }
    
        function remove() {
          global $db;
          $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
        }
    
        function keys() {
          return array('MODULE_SHIPPING_FLAT_STATUS', 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_TAX_BASIS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER');
        }
      }
    ?>
    Thanks again for all your help. I would be lost without you!

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

    Default Re: Different shipping methods for different categories

    This line will not work well in the Flat Rate flat shipping module ...
    Code:
              $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
    Try using FLAT instead of ITEM ...
    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!]
    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. #189
    Join Date
    Jul 2009
    Location
    Crystal Lake, IL
    Posts
    50
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    So I tried fixing that, and it still doesn't work. When I try to load the actual shipping page, it just comes up blank. When I load the admin shipping module it says there is an error on this line:
    Code:
    if ((IS_ADMIN_FLAG == false && $skip_free)
    Here is that section of my code:
    Code:
    // class constructor
        function flat() {
          global $order, $db;
    
          $this->code = 'flat';
          $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
          $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
          $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
          $this->icon = '';
          $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
          $this->tax_basis = MODULE_SHIPPING_FLAT_TAX_BASIS;
    
          // disable only when entire cart is free shipping 
          if (zen_get_shipping_enabled($this->code)) { 
              $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false); 
          } 
          // test contents for Cases
           global $cart;  
            $skip_free = false;
            $chk_case = 0;
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','56');
            $chk_case += $_SESSION['cart']->in_cart_check('master_categories_id','60');
            if ($chk_case != $_SESSION['cart']->count_contents()) {
              $skip_free = true;
            }
          // disable for above categories 
          if ((IS_ADMIN_FLAG == false && $skip_free) { 
              $this->enabled = false;
          }

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

    Default Re: Different shipping methods for different categories

    This line:
    Code:
          if ((IS_ADMIN_FLAG == false && $skip_free) {
    is missing a closing paren ...
    Code:
          if ((IS_ADMIN_FLAG == false && $skip_free)) {
    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!]
    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 19 of 56 FirstFirst ... 9171819202129 ... LastLast

Similar Threads

  1. Re: Different shipping methods for different categories
    By kaddie in forum Built-in Shipping and Payment Modules
    Replies: 14
    Last Post: 19 Nov 2010, 04:37 AM
  2. Replies: 2
    Last Post: 27 Oct 2010, 01:45 PM
  3. Different shipping methods for different categories and mixed categories
    By neit in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 10 Aug 2010, 12:20 AM
  4. Separate Shipping Methods for Different Categories
    By MortalWombat in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 28 Jul 2010, 08:57 AM
  5. Different shipping methods for different product types?
    By talisman-studios in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Sep 2008, 04:59 PM

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