Page 29 of 56 FirstFirst ... 19272829303139 ... LastLast
Results 281 to 290 of 552
  1. #281
    Join Date
    Oct 2010
    Posts
    26
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    It would take quite a bit of customizing to work in a 50% discount ...

    What happens when 3 bagship are in the cart or 4?
    Ok so I have it working with table rate, one table rate for each model that is chosen, I still have the issue as how to combine the shipping at the checkout so I see one line of shipping not two lines for the customer to pick from, different prices depending on what is in the cart. how do I combine this?
    Attached Images Attached Images  

  2. #282
    Join Date
    Oct 2010
    Posts
    26
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Trice View Post
    Ok so I talked the person that I am creating this for into making my life simple. I told her I was gonna lock her in the closet if she didn't cut me a break.....

    Anyway I'm going to work on this later tonight, but will you tell me if this is possible

    Going to use the table rate for both bagship and reg (still basising it on what is entered into the model number)

    Will I be able to combine those into one table shipping module?
    Ok so that was incorrect, I price of shipping is not based on the amount entered into model number. Using the table for both and they both work fine on their own, just not together

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

    Default Re: Different shipping methods for different categories

    If you were to take the calculations that the Table Rate makes for the shipping and add in the total weight of the cart, which is the bagship shipping costs ... wouldn't that give you the total shipping charges ...

    You take the count of the bagship and subtract it from the item count used in the Table Rate to compute the shipping costs for the other products ... then add in the weight ...

    If there is no weight, then the item count works as it is ...

    If there are only bagship then the item count subtracts the item count of the bagship products for 0, then add in the weight for the bagship shipping cost ...

    If there is weight and you subtract the item count of the bagship products from the item count you have just the number of items that are not bagship ... then add in the weight ... and you have both ...

    Doing it this way, it can all be controlled in one shipping module ...
    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!

  4. #284
    Join Date
    Oct 2010
    Posts
    26
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    If you were to take the calculations that the Table Rate makes for the shipping and add in the total weight of the cart, which is the bagship shipping costs ... wouldn't that give you the total shipping charges ...

    You take the count of the bagship and subtract it from the item count used in the Table Rate to compute the shipping costs for the other products ... then add in the weight ...

    If there is no weight, then the item count works as it is ...

    If there are only bagship then the item count subtracts the item count of the bagship products for 0, then add in the weight for the bagship shipping cost ...

    If there is weight and you subtract the item count of the bagship products from the item count you have just the number of items that are not bagship ... then add in the weight ... and you have both ...

    Doing it this way, it can all be controlled in one shipping module ...
    ok so I'm really confused. I tried to put them together and it is only working for the reg I'm so so so confused.

    PHP Code:
    <?php
    /**
     * @package shippingMethod
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: table2.php 6347 2007-05-20 19:46:59Z ajeh $
     */
    /**
     * Enter description here...
     *
     */
    class table2 extends base {
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $code;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $title;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $description;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $icon;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $enabled;
      
    /**
       * Enter description here...
       *
       * @return _2
       */
      
    function table2() {
        global 
    $order$db;

        
    $this->code 'table2';
        
    $this->title MODULE_SHIPPING_TABLE2_TEXT_TITLE;
        
    $this->description MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION;
        
    $this->sort_order MODULE_SHIPPING_TABLE2_SORT_ORDER;
        
    $this->icon '';
        
    $this->tax_class MODULE_SHIPPING_TABLE2_TAX_CLASS;
        
    $this->tax_basis MODULE_SHIPPING_TABLE2_TAX_BASIS;
       
        
    // disable only when entire cart is free shipping 
        
    if (zen_get_shipping_enabled($this->code)) { 
          
    $this->enabled = ((MODULE_SHIPPING_TABLE2_STATUS == 'True') ? true false); 
        } 

          
    // disable for one master_categories_id
        
    if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','reg') < 1)) {
          
    $this->enabled false;
        while ((
    IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') < 1)) 
          
    $this->enabled false;
     }
      
            
        if ( (
    $this->enabled == true) && ((int)MODULE_SHIPPING_TABLE2_ZONE 0) ) {
          
    $check_flag false;
          
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = '" MODULE_SHIPPING_TABLE2_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 (
    zen_get_shipping_enabled($this->code)) { 
              
    $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true false); 
         } 

          
          if (
    $check_flag == false) {
            
    $this->enabled false;
          }
        }
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $method
       * @return unknown
       */
      
    function quote($method '') {
        global 
    $order$shipping_weight$shipping_num_boxes$total_count;

        
    // shipping adjustment
        
    switch (MODULE_SHIPPING_TABLE2_MODE) {
          case (
    'price'):
            
    $order_total $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
            break;
          case (
    'weight'):
            
    $order_total $shipping_weight;
            break;
          case (
    'item'):
            
    $order_total $total_count $_SESSION['cart']->free_shipping_items();
            break;
        }

        
    $order_total_amount $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;

        
    $table2_cost split("[:,]" MODULE_SHIPPING_TABLE2_COST);
        
    $size sizeof($table2_cost);
        for (
    $i=0$n=$size$i<$n$i+=2) {
          if (
    round($order_total,9) <= $table2_cost[$i]) {
            if (
    strstr($table2_cost[$i+1], '%')) {
              
    $shipping = ($table2_cost[$i+1]/100) * $order_total_amount;
            } else {
              
    $shipping $table2_cost[$i+1];
            }
            break;
          }
        }

     

        if (
    MODULE_SHIPPING_TABLE2_MODE == 'weight') {
          
    $shipping $shipping $shipping_num_boxes;
          
    // show boxes if weight
          
    switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
            case (
    0):
            
    $show_box_weight '';
            break;
            case (
    1):
            
    $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';
            break;
            case (
    2):
            
    $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT ')';
            break;
            default:
            
    $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT ')';
            break;
          }
        }

        
    $this->quotes = array('id' => $this->code,
        
    'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE $show_box_weight,
        
    'methods' => array(array('id' => $this->code,
        
    'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
        
    'cost' => $shipping MODULE_SHIPPING_TABLE2_HANDLING)));

        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;
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function check() {
        global 
    $db;
        if (!isset(
    $this->_check)) {
          
    $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_TABLE2_STATUS'");
          
    $this->_check $check_query->RecordCount();
        }
        return 
    $this->_check;
      }
      
    /**
       * Enter description here...
       *
       */
      
    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 Table Method', 'MODULE_SHIPPING_TABLE2_STATUS', 'True', 'Do you want to offer table 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, set_function, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLE2_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc<br />You can end the last amount as 10000:7% to charge 7% of the Order Total', '6', '0', 'zen_cfg_textarea(', 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 ('Table Method', 'MODULE_SHIPPING_TABLE2_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered or the total number of items orderd.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'item\'), ', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLE2_HANDLING', '0', 'Handling fee for 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_TABLE2_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_TABLE2_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_TABLE2_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_TABLE2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
      }
      
    /**
       * Enter description here...
       *
       */
      
    function remove() {
        global 
    $db;
        
    $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function keys() {
        return array(
    'MODULE_SHIPPING_TABLE2_STATUS''MODULE_SHIPPING_TABLE2_COST''MODULE_SHIPPING_TABLE2_MODE''MODULE_SHIPPING_TABLE2_HANDLING''MODULE_SHIPPING_TABLE2_TAX_CLASS''MODULE_SHIPPING_TABLE2_TAX_BASIS''MODULE_SHIPPING_TABLE2_ZONE''MODULE_SHIPPING_TABLE2_SORT_ORDER');
      }
    }
    ?>

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

    Default Re: Different shipping methods for different categories

    Remove this code:
    Code:
          // disable for one master_categories_id
        if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','reg') < 1)) {
          $this->enabled = false;
        while ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') < 1)) 
          $this->enabled = false;
     }
    Add this code down in the function quote:
    Code:
    // bof: remove the bagship item count
    global $cart;
    $chk_bagship = $_SESSION['cart']->in_cart_check('products_model','bagship');
    $order_total = $order_total - $chk_bagship;
    // eof: remove the bagship item count
    
        $order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
    On the actual cost change this code:
    Code:
        $this->quotes = array('id' => $this->code,
        'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE . $show_box_weight,
        'methods' => array(array('id' => $this->code,
        'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
        'cost' => $shipping + MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight * 1.00) )));
    where the 1.00 is how much you need to charge for the shipping weight * unit cost ...

    Now this will calculate the Item Cost based on all items except the bagship and then use the weight that is in the bagship products to add their charge ...

    You may need to edit the Table Rate to start with:
    0:0.00,your rates here

    So that the rate for 0 reg comes out to 0.00 and then the bagship will only be counted ...
    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!

  6. #286
    Join Date
    Oct 2010
    Posts
    26
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    Remove this code:
    Code:
          // disable for one master_categories_id
        if ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','reg') < 1)) {
          $this->enabled = false;
        while ((IS_ADMIN_FLAG == false && $_SESSION['cart']->in_cart_check('products_model','bagship') < 1)) 
          $this->enabled = false;
     }
    Add this code down in the function quote:
    Code:
    // bof: remove the bagship item count
    global $cart;
    $chk_bagship = $_SESSION['cart']->in_cart_check('products_model','bagship');
    $order_total = $order_total - $chk_bagship;
    // eof: remove the bagship item count
    
        $order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
    On the actual cost change this code:
    Code:
        $this->quotes = array('id' => $this->code,
        'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE . $show_box_weight,
        'methods' => array(array('id' => $this->code,
        'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
        'cost' => $shipping + MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight * 1.00) )));
    where the 1.00 is how much you need to charge for the shipping weight * unit cost ...

    Now this will calculate the Item Cost based on all items except the bagship and then use the weight that is in the bagship products to add their charge ...

    You may need to edit the Table Rate to start with:
    0:0.00,your rates here

    So that the rate for 0 reg comes out to 0.00 and then the bagship will only be counted ...
    Ok you don't know how much I really really appreciate all your help. I think I am almost there. As of right now this is what I get

    In shopping cart
    1 reg item shipping cost $7
    2 reg items shipping cost $8
    1 bagship item shipping cost $7
    2 bagship items shipping cost $8
    1 reg item and 1 baship item shipping cost $8

    Somewhere I must have screwed something up because the shipping for bagship is supposed to be 1:8.00, 2:4.00,3:2.00,50:0.00

    and the reg shipping is supposed to be 0:0.00,1:4.00,2:5.00,3:6.00,4:7.00,5:8.00,6:9.00,7:10,8:11.00,9:12.00,10:13.00

    PHP Code:
    <?php 
    /** 
     * @package shippingMethod 
     * @copyright Copyright 2003-2005 Zen Cart Development Team 
     * @copyright Portions Copyright 2003 osCommerce 
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 
     * @version $Id: table2.php 6347 2007-05-20 19:46:59Z ajeh $ 
     */ 
    /** 
     * Enter description here... 
     * 
     */ 
    class table2 extends base 
      
    /** 
       * Enter description here... 
       * 
       * @var unknown_type 
       */ 
      
    var $code
      
    /** 
       * Enter description here... 
       * 
       * @var unknown_type 
       */ 
      
    var $title
      
    /** 
       * Enter description here... 
       * 
       * @var unknown_type 
       */ 
      
    var $description
      
    /** 
       * Enter description here... 
       * 
       * @var unknown_type 
       */ 
      
    var $icon
      
    /** 
       * Enter description here... 
       * 
       * @var unknown_type 
       */ 
      
    var $enabled
      
    /** 
       * Enter description here... 
       * 
       * @return _2 
       */ 
      
    function table2() { 
        global 
    $order$db

        
    $this->code 'table2'
        
    $this->title MODULE_SHIPPING_TABLE2_TEXT_TITLE
        
    $this->description MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION
        
    $this->sort_order MODULE_SHIPPING_TABLE2_SORT_ORDER
        
    $this->icon ''
        
    $this->tax_class MODULE_SHIPPING_TABLE2_TAX_CLASS
        
    $this->tax_basis MODULE_SHIPPING_TABLE2_TAX_BASIS
        
        
    // disable only when entire cart is free shipping  
        
    if (zen_get_shipping_enabled($this->code)) {  
          
    $this->enabled = ((MODULE_SHIPPING_TABLE2_STATUS == 'True') ? true false);  
        }  

                   
        if ( (
    $this->enabled == true) && ((int)MODULE_SHIPPING_TABLE2_ZONE 0) ) { 
          
    $check_flag false
          
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = '" MODULE_SHIPPING_TABLE2_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 (
    zen_get_shipping_enabled($this->code)) {  
              
    $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true false);  
         }  

           
          if (
    $check_flag == false) { 
            
    $this->enabled false
          } 
        } 
      } 
      
    /** 
       * Enter description here... 
       * 
       * @param unknown_type $method 
       * @return unknown 
       */ 
      
    function quote($method '') { 
        global 
    $order$shipping_weight$shipping_num_boxes$total_count

       
        
    // bof: remove the bagship item count
        
    global $cart;
        
    $chk_bagship $_SESSION['cart']->in_cart_check('products_model','bagship');
        
    $order_total $order_total $chk_bagship
        
    // eof: remove the bagship item count

        
    $order_total_amount $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;


       
    // shipping adjustment 
        
    switch (MODULE_SHIPPING_TABLE2_MODE) { 
          case (
    'price'): 
            
    $order_total $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ; 
            break; 
          case (
    'weight'): 
            
    $order_total $shipping_weight
            break; 
          case (
    'item'): 
            
    $order_total $total_count $_SESSION['cart']->free_shipping_items(); 
            break; 
        } 

        
    $order_total_amount $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ; 

        
    $table2_cost split("[:,]" MODULE_SHIPPING_TABLE2_COST); 
        
    $size sizeof($table2_cost); 
        for (
    $i=0$n=$size$i<$n$i+=2) { 
          if (
    round($order_total,9) <= $table2_cost[$i]) { 
            if (
    strstr($table2_cost[$i+1], '%')) { 
              
    $shipping = ($table2_cost[$i+1]/100) * $order_total_amount
            } else { 
              
    $shipping $table2_cost[$i+1]; 
            } 
            break; 
          } 
        } 

      

        if (
    MODULE_SHIPPING_TABLE2_MODE == 'weight') { 
          
    $shipping $shipping $shipping_num_boxes
          
    // show boxes if weight 
          
    switch (SHIPPING_BOX_WEIGHT_DISPLAY) { 
            case (
    0): 
            
    $show_box_weight ''
            break; 
            case (
    1): 
            
    $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')'
            break; 
            case (
    2): 
            
    $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT ')'
            break; 
            default: 
            
    $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT ')'
            break; 
          } 
        } 

        
    $this->quotes = array('id' => $this->code
        
    'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE $show_box_weight
        
    'methods' => array(array('id' => $this->code
        
    'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY
        
    'cost' => $shipping MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight 1.00) ))); 

        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
      } 
      
    /** 
       * Enter description here... 
       * 
       * @return unknown 
       */ 
      
    function check() { 
        global 
    $db
        if (!isset(
    $this->_check)) { 
          
    $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_TABLE2_STATUS'"); 
          
    $this->_check $check_query->RecordCount(); 
        } 
        return 
    $this->_check
      } 
      
    /** 
       * Enter description here... 
       * 
       */ 
      
    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 Table Method', 'MODULE_SHIPPING_TABLE2_STATUS', 'True', 'Do you want to offer table 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, set_function, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLE2_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc<br />You can end the last amount as 10000:7% to charge 7% of the Order Total', '6', '0', 'zen_cfg_textarea(', 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 ('Table Method', 'MODULE_SHIPPING_TABLE2_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered or the total number of items orderd.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'item\'), ', now())"); 
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLE2_HANDLING', '0', 'Handling fee for 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_TABLE2_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_TABLE2_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_TABLE2_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_TABLE2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); 
      } 
      
    /** 
       * Enter description here... 
       * 
       */ 
      
    function remove() { 
        global 
    $db
        
    $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')"); 
      } 
      
    /** 
       * Enter description here... 
       * 
       * @return unknown 
       */ 
      
    function keys() { 
        return array(
    'MODULE_SHIPPING_TABLE2_STATUS''MODULE_SHIPPING_TABLE2_COST''MODULE_SHIPPING_TABLE2_MODE''MODULE_SHIPPING_TABLE2_HANDLING''MODULE_SHIPPING_TABLE2_TAX_CLASS''MODULE_SHIPPING_TABLE2_TAX_BASIS''MODULE_SHIPPING_TABLE2_ZONE''MODULE_SHIPPING_TABLE2_SORT_ORDER'); 
      } 

    ?>
    Attached Images Attached Images  

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

    Default Re: Different shipping methods for different categories

    How about if you use:
    Code:
    <?php
    /**
     * @package shippingMethod
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: table2.php 6347 2007-05-20 19:46:59Z ajeh $
     */
    /**
     * Enter description here...
     *
     */
    class table2 extends base {
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $code;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $title;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $description;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $icon;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $enabled;
      /**
       * Enter description here...
       *
       * @return _2
       */
      function table2() {
        global $order, $db;
    
        $this->code = 'table2';
        $this->title = MODULE_SHIPPING_TABLE2_TEXT_TITLE;
        $this->description = MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION;
        $this->sort_order = MODULE_SHIPPING_TABLE2_SORT_ORDER;
        $this->icon = '';
        $this->tax_class = MODULE_SHIPPING_TABLE2_TAX_CLASS;
        $this->tax_basis = MODULE_SHIPPING_TABLE2_TAX_BASIS;
    
        // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_TABLE2_STATUS == 'True') ? true : false);
        }
    
    
        if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE2_ZONE > 0) ) {
          $check_flag = false;
          $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE2_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 (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
         }
    
    
          if ($check_flag == false) {
            $this->enabled = false;
          }
        }
      }
      /**
       * Enter description here...
       *
       * @param unknown_type $method
       * @return unknown
       */
      function quote($method = '') {
        global $order, $shipping_weight, $shipping_num_boxes, $total_count;
    
       // shipping adjustment
        switch (MODULE_SHIPPING_TABLE2_MODE) {
          case ('price'):
            $order_total = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
            break;
          case ('weight'):
            $order_total = $shipping_weight;
            break;
          case ('item'):
            $order_total = $total_count - $_SESSION['cart']->free_shipping_items();
            break;
        }
    
        $order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
    
        // bof: remove the bagship item count
        global $cart;
        $chk_bagship = $_SESSION['cart']->in_cart_check('products_model','bagship');
        $order_total = $order_total - $chk_bagship;
        // eof: remove the bagship item count
    
    
        $table2_cost = split("[:,]" , MODULE_SHIPPING_TABLE2_COST);
        $size = sizeof($table2_cost);
        for ($i=0, $n=$size; $i<$n; $i+=2) {
          if (round($order_total,9) <= $table2_cost[$i]) {
            if (strstr($table2_cost[$i+1], '%')) {
              $shipping = ($table2_cost[$i+1]/100) * $order_total_amount;
            } else {
              $shipping = $table2_cost[$i+1];
            }
            break;
          }
        }
    
    
    
        if (MODULE_SHIPPING_TABLE2_MODE == 'weight') {
          $shipping = $shipping * $shipping_num_boxes;
          // show boxes if weight
          switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
            case (0):
            $show_box_weight = '';
            break;
            case (1):
            $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
            break;
            case (2):
            $show_box_weight = ' (' . number_format($shipping_weight * $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
            break;
            default:
            $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
            break;
          }
        }
    
        $this->quotes = array('id' => $this->code,
        'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE . $show_box_weight,
        'methods' => array(array('id' => $this->code,
        'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
        'cost' => $shipping + MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight * 1.00) )));
    
        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;
      }
      /**
       * Enter description here...
       *
       * @return unknown
       */
      function check() {
        global $db;
        if (!isset($this->_check)) {
          $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TABLE2_STATUS'");
          $this->_check = $check_query->RecordCount();
        }
        return $this->_check;
      }
      /**
       * Enter description here...
       *
       */
      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 Table Method', 'MODULE_SHIPPING_TABLE2_STATUS', 'True', 'Do you want to offer table 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, set_function, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLE2_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc<br />You can end the last amount as 10000:7% to charge 7% of the Order Total', '6', '0', 'zen_cfg_textarea(', 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 ('Table Method', 'MODULE_SHIPPING_TABLE2_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered or the total number of items orderd.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'item\'), ', now())");
        $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLE2_HANDLING', '0', 'Handling fee for 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_TABLE2_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_TABLE2_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_TABLE2_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_TABLE2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
      }
      /**
       * Enter description here...
       *
       */
      function remove() {
        global $db;
        $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
      }
      /**
       * Enter description here...
       *
       * @return unknown
       */
      function keys() {
        return array('MODULE_SHIPPING_TABLE2_STATUS', 'MODULE_SHIPPING_TABLE2_COST', 'MODULE_SHIPPING_TABLE2_MODE', 'MODULE_SHIPPING_TABLE2_HANDLING', 'MODULE_SHIPPING_TABLE2_TAX_CLASS', 'MODULE_SHIPPING_TABLE2_TAX_BASIS', 'MODULE_SHIPPING_TABLE2_ZONE', 'MODULE_SHIPPING_TABLE2_SORT_ORDER');
      }
    }
    ?>
    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!

  8. #288
    Join Date
    Oct 2010
    Posts
    26
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    How about if you use:
    Code:
    <?php
    /**
     * @package shippingMethod
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: table2.php 6347 2007-05-20 19:46:59Z ajeh $
     */
    /**
     * Enter description here...
     *
     */
    class table2 extends base {
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $code;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $title;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $description;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $icon;
      /**
       * Enter description here...
       *
       * @var unknown_type
       */
      var $enabled;
      /**
       * Enter description here...
       *
       * @return _2
       */
      function table2() {
        global $order, $db;
    
        $this->code = 'table2';
        $this->title = MODULE_SHIPPING_TABLE2_TEXT_TITLE;
        $this->description = MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION;
        $this->sort_order = MODULE_SHIPPING_TABLE2_SORT_ORDER;
        $this->icon = '';
        $this->tax_class = MODULE_SHIPPING_TABLE2_TAX_CLASS;
        $this->tax_basis = MODULE_SHIPPING_TABLE2_TAX_BASIS;
    
        // disable only when entire cart is free shipping
        if (zen_get_shipping_enabled($this->code)) {
          $this->enabled = ((MODULE_SHIPPING_TABLE2_STATUS == 'True') ? true : false);
        }
    
    
        if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE2_ZONE > 0) ) {
          $check_flag = false;
          $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE2_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 (zen_get_shipping_enabled($this->code)) {
              $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true : false);
         }
    
    
          if ($check_flag == false) {
            $this->enabled = false;
          }
        }
      }
      /**
       * Enter description here...
       *
       * @param unknown_type $method
       * @return unknown
       */
      function quote($method = '') {
        global $order, $shipping_weight, $shipping_num_boxes, $total_count;
    
       // shipping adjustment
        switch (MODULE_SHIPPING_TABLE2_MODE) {
          case ('price'):
            $order_total = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
            break;
          case ('weight'):
            $order_total = $shipping_weight;
            break;
          case ('item'):
            $order_total = $total_count - $_SESSION['cart']->free_shipping_items();
            break;
        }
    
        $order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
    
        // bof: remove the bagship item count
        global $cart;
        $chk_bagship = $_SESSION['cart']->in_cart_check('products_model','bagship');
        $order_total = $order_total - $chk_bagship;
        // eof: remove the bagship item count
    
    
        $table2_cost = split("[:,]" , MODULE_SHIPPING_TABLE2_COST);
        $size = sizeof($table2_cost);
        for ($i=0, $n=$size; $i<$n; $i+=2) {
          if (round($order_total,9) <= $table2_cost[$i]) {
            if (strstr($table2_cost[$i+1], '%')) {
              $shipping = ($table2_cost[$i+1]/100) * $order_total_amount;
            } else {
              $shipping = $table2_cost[$i+1];
            }
            break;
          }
        }
    
    
    
        if (MODULE_SHIPPING_TABLE2_MODE == 'weight') {
          $shipping = $shipping * $shipping_num_boxes;
          // show boxes if weight
          switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
            case (0):
            $show_box_weight = '';
            break;
            case (1):
            $show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
            break;
            case (2):
            $show_box_weight = ' (' . number_format($shipping_weight * $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT . ')';
            break;
            default:
            $show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
            break;
          }
        }
    
        $this->quotes = array('id' => $this->code,
        'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE . $show_box_weight,
        'methods' => array(array('id' => $this->code,
        'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
        'cost' => $shipping + MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight * 1.00) )));
    
        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;
      }
      /**
       * Enter description here...
       *
       * @return unknown
       */
      function check() {
        global $db;
        if (!isset($this->_check)) {
          $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TABLE2_STATUS'");
          $this->_check = $check_query->RecordCount();
        }
        return $this->_check;
      }
      /**
       * Enter description here...
       *
       */
      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 Table Method', 'MODULE_SHIPPING_TABLE2_STATUS', 'True', 'Do you want to offer table 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, set_function, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLE2_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc<br />You can end the last amount as 10000:7% to charge 7% of the Order Total', '6', '0', 'zen_cfg_textarea(', 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 ('Table Method', 'MODULE_SHIPPING_TABLE2_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered or the total number of items orderd.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'item\'), ', now())");
        $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLE2_HANDLING', '0', 'Handling fee for 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_TABLE2_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_TABLE2_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_TABLE2_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_TABLE2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
      }
      /**
       * Enter description here...
       *
       */
      function remove() {
        global $db;
        $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
      }
      /**
       * Enter description here...
       *
       * @return unknown
       */
      function keys() {
        return array('MODULE_SHIPPING_TABLE2_STATUS', 'MODULE_SHIPPING_TABLE2_COST', 'MODULE_SHIPPING_TABLE2_MODE', 'MODULE_SHIPPING_TABLE2_HANDLING', 'MODULE_SHIPPING_TABLE2_TAX_CLASS', 'MODULE_SHIPPING_TABLE2_TAX_BASIS', 'MODULE_SHIPPING_TABLE2_ZONE', 'MODULE_SHIPPING_TABLE2_SORT_ORDER');
      }
    }
    ?>
    Oh boy, so I was getting the incorrect amount for reg items. So I changed from 1 to 0 (in red)

    $this->quotes = array('id' => $this->code,
    'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE . $show_box_weight,
    'methods' => array(array('id' => $this->code,
    'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
    'cost' => $shipping + MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight * 0.00) )));


    Now all the reg items are coming up with the correct shipping amounts, but the bagship items are coming up 0, even when I put an amount in the Shipping weight, now that is what I'm supposed to be doing right?


    PHP Code:
    <?php
    /**
     * @package shippingMethod
     * @copyright Copyright 2003-2005 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: table2.php 6347 2007-05-20 19:46:59Z ajeh $
     */
    /**
     * Enter description here...
     *
     */
    class table2 extends base {
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $code;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $title;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $description;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $icon;
      
    /**
       * Enter description here...
       *
       * @var unknown_type
       */
      
    var $enabled;
      
    /**
       * Enter description here...
       *
       * @return _2
       */
      
    function table2() {
        global 
    $order$db;

        
    $this->code 'table2';
        
    $this->title MODULE_SHIPPING_TABLE2_TEXT_TITLE;
        
    $this->description MODULE_SHIPPING_TABLE2_TEXT_DESCRIPTION;
        
    $this->sort_order MODULE_SHIPPING_TABLE2_SORT_ORDER;
        
    $this->icon '';
        
    $this->tax_class MODULE_SHIPPING_TABLE2_TAX_CLASS;
        
    $this->tax_basis MODULE_SHIPPING_TABLE2_TAX_BASIS;

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


        if ( (
    $this->enabled == true) && ((int)MODULE_SHIPPING_TABLE2_ZONE 0) ) {
          
    $check_flag false;
          
    $check $db->Execute("select zone_id from " TABLE_ZONES_TO_GEO_ZONES " where geo_zone_id = '" MODULE_SHIPPING_TABLE2_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 (
    zen_get_shipping_enabled($this->code)) {
              
    $this->enabled = ((MODULE_SHIPPING_ITEM_STATUS == 'True') ? true false);
         }


          if (
    $check_flag == false) {
            
    $this->enabled false;
          }
        }
      }
      
    /**
       * Enter description here...
       *
       * @param unknown_type $method
       * @return unknown
       */
      
    function quote($method '') {
        global 
    $order$shipping_weight$shipping_num_boxes$total_count;

       
    // shipping adjustment
        
    switch (MODULE_SHIPPING_TABLE2_MODE) {
          case (
    'price'):
            
    $order_total $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
            break;
          case (
    'weight'):
            
    $order_total $shipping_weight;
            break;
          case (
    'item'):
            
    $order_total $total_count $_SESSION['cart']->free_shipping_items();
            break;
        }

        
    $order_total_amount $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;

        
    // bof: remove the bagship item count
        
    global $cart;
        
    $chk_bagship $_SESSION['cart']->in_cart_check('products_model','bagship');
        
    $order_total $order_total $chk_bagship;
        
    // eof: remove the bagship item count


        
    $table2_cost split("[:,]" MODULE_SHIPPING_TABLE2_COST);
        
    $size sizeof($table2_cost);
        for (
    $i=0$n=$size$i<$n$i+=2) {
          if (
    round($order_total,9) <= $table2_cost[$i]) {
            if (
    strstr($table2_cost[$i+1], '%')) {
              
    $shipping = ($table2_cost[$i+1]/100) * $order_total_amount;
            } else {
              
    $shipping $table2_cost[$i+1];
            }
            break;
          }
        }



        if (
    MODULE_SHIPPING_TABLE2_MODE == 'weight') {
          
    $shipping $shipping $shipping_num_boxes;
          
    // show boxes if weight
          
    switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
            case (
    0):
            
    $show_box_weight '';
            break;
            case (
    1):
            
    $show_box_weight ' (' $shipping_num_boxes ' ' TEXT_SHIPPING_BOXES ')';
            break;
            case (
    2):
            
    $show_box_weight ' (' number_format($shipping_weight $shipping_num_boxes,2) . TEXT_SHIPPING_WEIGHT ')';
            break;
            default:
            
    $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT ')';
            break;
          }
        }

        
    $this->quotes = array('id' => $this->code,
        
    'module' => MODULE_SHIPPING_TABLE2_TEXT_TITLE $show_box_weight,
        
    'methods' => array(array('id' => $this->code,
        
    'title' => MODULE_SHIPPING_TABLE2_TEXT_WAY,
        
    'cost' => $shipping MODULE_SHIPPING_TABLE2_HANDLING + ($shipping_weight 0.00) )));

        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;
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function check() {
        global 
    $db;
        if (!isset(
    $this->_check)) {
          
    $check_query $db->Execute("select configuration_value from " TABLE_CONFIGURATION " where configuration_key = 'MODULE_SHIPPING_TABLE2_STATUS'");
          
    $this->_check $check_query->RecordCount();
        }
        return 
    $this->_check;
      }
      
    /**
       * Enter description here...
       *
       */
      
    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 Table Method', 'MODULE_SHIPPING_TABLE2_STATUS', 'True', 'Do you want to offer table 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, set_function, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLE2_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc<br />You can end the last amount as 10000:7% to charge 7% of the Order Total', '6', '0', 'zen_cfg_textarea(', 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 ('Table Method', 'MODULE_SHIPPING_TABLE2_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered or the total number of items orderd.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'item\'), ', now())");
        
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLE2_HANDLING', '0', 'Handling fee for 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_TABLE2_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_TABLE2_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_TABLE2_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_TABLE2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
      }
      
    /**
       * Enter description here...
       *
       */
      
    function remove() {
        global 
    $db;
        
    $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");
      }
      
    /**
       * Enter description here...
       *
       * @return unknown
       */
      
    function keys() {
        return array(
    'MODULE_SHIPPING_TABLE2_STATUS''MODULE_SHIPPING_TABLE2_COST''MODULE_SHIPPING_TABLE2_MODE''MODULE_SHIPPING_TABLE2_HANDLING''MODULE_SHIPPING_TABLE2_TAX_CLASS''MODULE_SHIPPING_TABLE2_TAX_BASIS''MODULE_SHIPPING_TABLE2_ZONE''MODULE_SHIPPING_TABLE2_SORT_ORDER');
      }
    }
    ?>

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

    Default Re: Different shipping methods for different categories

    The weight holds the charges for the bagship ... if you multiply the weight by 0 you get 0 ...

    Change that to 1 ...

    If you add 1 bagship to the cart, and it has a weight set, then that will be the shipping charge ...

    If you add 1 reg to the cart then you will be charging the table rate ...

    If you add 1 bagship and 1 reg to the cart you will charge the Table Rate and the weight ...
    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!

  10. #290
    Join Date
    Oct 2010
    Posts
    26
    Plugin Contributions
    0

    Default Re: Different shipping methods for different categories

    Quote Originally Posted by Ajeh View Post
    The weight holds the charges for the bagship ... if you multiply the weight by 0 you get 0 ...

    Change that to 1 ...

    If you add 1 bagship to the cart, and it has a weight set, then that will be the shipping charge ...

    If you add 1 reg to the cart then you will be charging the table rate ...

    If you add 1 bagship and 1 reg to the cart you will charge the Table Rate and the weight ...
    OMG ok so it is working, you know what I had to do? LOL Adjust the Package Tare Added percentage! That is so so so awesome. The only thing is that the bags are not discounted when you purchase more than one. Is that something that is possible to incorporate into this? So they are 1:8.00,2:4.00,3:2.00 and anything after that will be 0

    By the way I think you are awesome! For sticking with me on this and helping me out! Even though I have been tearing my hair out, I really enjoy learning this!

 

 
Page 29 of 56 FirstFirst ... 19272829303139 ... 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