Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31
  1. #21
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Hide shipping method when order exceeds certain weight

    You could try using:
    Code:
    // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'True') ? true : false);
          }
    
         if (!IS_ADMIN_FLAG) {
           if ($_SESSION['cart']->weight > 1.91 ) {
             $this->enabled = false;
           }
         }
    
    NOTE: You really need to just post issues in 1 thread rather than multiple threads, it gets confusing to help and follow issues ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  2. #22
    Join Date
    Oct 2008
    Posts
    591
    Plugin Contributions
    0

    Default Re: Hide shipping method when order exceeds certain weight

    Quote Originally Posted by Ajeh View Post
    You could try using:
    Code:
    // disable only when entire cart is free shipping
          if (zen_get_shipping_enabled($this->code)) {
            $this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'True') ? true : false);
          }
    
         if (!IS_ADMIN_FLAG) {
           if ($_SESSION['cart']->weight > 1.91 ) {
             $this->enabled = false;
           }
         }
    
    NOTE: You really need to just post issues in 1 thread rather than multiple threads, it gets confusing to help and follow issues ...
    Where i put this code in my zone2 file ?

    look here:

    PHP Code:
    */
      class 
    zones2 {
        var 
    $code$title$description$enabled$num_zones;
    // class constructor
        
    function zones2() {
          
    $this->code 'zones2';
          
    $this->title MODULE_SHIPPING_ZONES2_TEXT_TITLE;
          
    $this->description MODULE_SHIPPING_ZONES2_TEXT_DESCRIPTION;
          
    $this->sort_order MODULE_SHIPPING_ZONES2_SORT_ORDER;
          
    $this->icon '';
          
    $this->tax_class MODULE_SHIPPING_ZONES2_TAX_CLASS;
          
    $this->tax_basis MODULE_SHIPPING_ZONES2_TAX_BASIS;
          
    // disable only when entire cart is free shipping
          
    if (zen_get_shipping_enabled($this->code)) {
            
    $this->enabled = ((MODULE_SHIPPING_ZONES2_STATUS == 'True') ? true false);
          }

          
    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
          
    $this->num_zones 4;
        }
    // class methods
        
    function quote($method '') {
          global 
    $order$shipping_weight$shipping_num_boxes$total_count;
          
    $dest_country $order->delivery['country']['iso_code_2'];
          
    $dest_zone 0;
          
    $error false;
        
    $order_total_amount $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
          for (
    $i=1$i<=$this->num_zones$i++) {
            
    $countries_table constant('MODULE_SHIPPING_ZONES2_COUNTRIES_' $i);
            
    $countries_table strtoupper(str_replace(' '''$countries_table));
            
    $country_zones split("[,]"$countries_table);
            if (
    in_array($dest_country$country_zones)) {
              
    $dest_zone $i;
              break;
            }
            if (
    in_array('00'$country_zones)) {
              
    $dest_zone $i;
              break;
            }
          }
          if (
    $dest_zone == 0) {
            
    $error true;
          } else {
            
    $shipping = -1;
            
    $zones_cost constant('MODULE_SHIPPING_ZONES2_COST_' $dest_zone);
            
    $zones_table split("[:,]" $zones_cost);
            
    $size sizeof($zones_table);
            
    $done false;
            for (
    $i=0$i<$size$i+=2) {
              switch (
    MODULE_SHIPPING_ZONES2_METHOD) {
               case (
    MODULE_SHIPPING_ZONES2_METHOD == 'Weight'):
                  if (
    round($shipping_weight,9) <= $zones_table[$i]) {
                    
    $shipping $zones_table[$i+1];
                    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) . MODULE_SHIPPING_ZONES2_TEXT_UNITS ')';
                      break;
                    default:
                      
    $show_box_weight ' (' $shipping_num_boxes ' x ' number_format($shipping_weight,2) . MODULE_SHIPPING_ZONES2_TEXT_UNITS ')';
                      break;
                    }
    //                $shipping_method = MODULE_SHIPPING_ZONES2_TEXT_WAY . ' ' . $dest_country . (SHIPPING_BOX_WEIGHT_DISPLAY >= 2 ? ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES2_TEXT_UNITS : '');
                    
    $shipping_method MODULE_SHIPPING_ZONES2_TEXT_WAY ' ' $dest_country $show_box_weight;
                    
    $done true;
            if (
    strstr($zones_table[$i+1], '%')) {
              
    $shipping = ($zones_table[$i+1]/100) * $order_total_amount;
            } else {
              
    $shipping $zones_table[$i+1];
            }
                    break;
                 }
               break;
               case (
    MODULE_SHIPPING_ZONES2_METHOD == 'Price'):
    // shipping adjustment
                  
    if (($_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices()) <= $zones_table[$i]) {
                    
    $shipping $zones_table[$i+1];
                    
    $shipping_method MODULE_SHIPPING_ZONES2_TEXT_WAY ' ' $dest_country;
            if (
    strstr($zones_table[$i+1], '%')) {
              
    $shipping = ($zones_table[$i+1]/100) * $order_total_amount;
            } else {
              
    $shipping $zones_table[$i+1];
            }
                    
    $done true;
                    break;
                 }
               break;
               case (
    MODULE_SHIPPING_ZONES2_METHOD == 'Item'):
    // shipping adjustment
                  
    if (($total_count $_SESSION['cart']->free_shipping_items()) <= $zones_table[$i]) {
                    
    $shipping $zones_table[$i+1];
                    
    $shipping_method MODULE_SHIPPING_ZONES2_TEXT_WAY ' ' $dest_country;
                    
    $done true;
            if (
    strstr($zones_table[$i+1], '%')) {
              
    $shipping = ($zones_table[$i+1]/100) * $order_total_amount;
            } else {
              
    $shipping $zones_table[$i+1];
            }
                    break;
                 }
               break;
              }
              if (
    $done == true) {
                break;
              }
            }
            if (
    $shipping == -1) {
              
    $shipping_cost 0;
              
    $shipping_method MODULE_SHIPPING_ZONES2_UNDEFINED_RATE;
            } else {
              switch (
    MODULE_SHIPPING_ZONES2_METHOD) {
               case (
    MODULE_SHIPPING_ZONES2_METHOD == 'Weight'):
                  
    // charge per box when done by Price
                  
    $shipping_cost = ($shipping $shipping_num_boxes) + constant('MODULE_SHIPPING_ZONES2_HANDLING_' $dest_zone);
                  break;
               case (
    MODULE_SHIPPING_ZONES2_METHOD == 'Price'):
                  
    // don't charge per box when done by Price
                  
    $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_ZONES2_HANDLING_' $dest_zone);
                break;
               case (
    MODULE_SHIPPING_ZONES2_METHOD == 'Item'):
                  
    // don't charge per box when done by Item
                  
    $shipping_cost = ($shipping) + constant('MODULE_SHIPPING_ZONES2_HANDLING_' $dest_zone);
                break;
              }
            }
          }
          
    $this->quotes = array('id' => $this->code,
                                
    'module' => MODULE_SHIPPING_ZONES2_TEXT_TITLE,
                                
    'methods' => array(array('id' => $this->code,
                                                         
    'title' => $shipping_method,
                                                         
    'cost' => $shipping_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);
          if (
    strstr(MODULE_SHIPPING_ZONES2_SKIPPED$dest_country)) {
            
    // don't show anything for this country
            
    $this->quotes = array();
          } else {
            if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_ZONES2_INVALID_ZONE;
          }
          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_ZONES2_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 ZONES2 Method', 'MODULE_SHIPPING_ZONES2_STATUS', 'True', 'Do you want to offer zone 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 ('Calculation Method', 'MODULE_SHIPPING_ZONES2_METHOD', 'Weight', 'Calculate cost based on Weight, Price or Item?', '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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ZONES2_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_ZONES2_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, date_added) values ('Sort Order', 'MODULE_SHIPPING_ZONES2_SORT_ORDER', '0', 'Sort order of display.', '6', '0', 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 ('Skip Countries, use a comma separated list of the two character ISO country codes', 'MODULE_SHIPPING_ZONES2_SKIPPED', '', 'Disable for the following Countries:', '6', '0', 'zen_cfg_textarea(', now())");
          for (
    $i 1$i <= $this->num_zones$i++) {
            
    $default_countries '';
            if (
    $i == 1) {
              
    $default_countries 'US,CA';
            }
            
    $db->Execute("insert into " TABLE_CONFIGURATION " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " $i ." Countries', 'MODULE_SHIPPING_ZONES2_COUNTRIES_" $i ."', '" $default_countries "', 'Comma separated list of two character ISO country codes that are part of Zone " $i ".<br />Set as 00 to indicate all two character ISO country codes that are not specifically defined.', '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 ('Zone " $i ." Shipping Table', 'MODULE_SHIPPING_ZONES2_COST_" $i ."', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone " $i " destinations based on a group of maximum order weights/prices. Example: 3:8.50,7:10.50,... Weight/Price less than or equal to 3 would cost 8.50 for Zone " $i " destinations.<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, date_added) values ('Zone " $i ." Handling Fee', 'MODULE_SHIPPING_ZONES2_HANDLING_" $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");
          }
        }
        function 
    remove() {
          global 
    $db;
          
    $db->Execute("delete from " TABLE_CONFIGURATION " where configuration_key in ('" implode("', '"$this->keys()) . "')");
        }
        function 
    keys() {
          
    $keys = array('MODULE_SHIPPING_ZONES2_STATUS''MODULE_SHIPPING_ZONES2_METHOD''MODULE_SHIPPING_ZONES2_TAX_CLASS''MODULE_SHIPPING_ZONES2_TAX_BASIS''MODULE_SHIPPING_ZONES2_SORT_ORDER''MODULE_SHIPPING_ZONES2_SKIPPED');
          for (
    $i=1$i<=$this->num_zones$i++) {
            
    $keys[] = 'MODULE_SHIPPING_ZONES2_COUNTRIES_' $i;
            
    $keys[] = 'MODULE_SHIPPING_ZONES2_COST_' $i;
            
    $keys[] = 'MODULE_SHIPPING_ZONES2_HANDLING_' $i;
          }
          return 
    $keys;
        }
      }
    ?> 

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

    Default Re: Hide shipping method when order exceeds certain weight

    Find the code in BLACK and put the code in RED under it ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #24
    Join Date
    Oct 2008
    Posts
    591
    Plugin Contributions
    0

    Default Re: Hide shipping method when order exceeds certain weight

    After update this code disable the option anyway . if it's 1 grams or 1000 grams . No see any zone 2 . it's ignore it.

    I don't want disable the option . just disable the checkbox . the the buyer can't choose this .

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

    Default Re: Hide shipping method when order exceeds certain weight

    Try using 1899 rather than 1.91 ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #26
    Join Date
    Oct 2008
    Posts
    591
    Plugin Contributions
    0

    Default Re: Hide shipping method when order exceeds certain weight

    Quote Originally Posted by Ajeh View Post
    Try using 1899 rather than 1.91 ...
    GREAT

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

    Default Re: Hide shipping method when order exceeds certain weight

    Thanks for the update that this is working for you now ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  8. #28
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: Hide shipping method when order exceeds certain weight

    i added this to a module with my changes to turn on when certain manufacturers in cart, it only works with multiple quantities (2+ Quantity) in the cart.
    When it is just one product (1 Quantity) in cart it does not turn on.
    what is wrong?
    From this:
    // check if manufacturers in cart
    if (IS_ADMIN_FLAG == false) {
    global $cart;
    $chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id', '54');
    $chk_manufacturers_id = $chk_manufacturer;
    if ($chk_manufacturers_id > 0) {
    $this->enabled = false;
    } else {
    $this->enabled = true;
    }
    }

    To This:
    // check if manufacturers in cart
    if (IS_ADMIN_FLAG == false) {
    global $cart;
    $chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id', '8');
    $chk_manufacturers_id = $chk_manufacturer;
    if ($chk_manufacturers_id > 8) {
    $this->enabled = true;
    } else {
    $this->enabled = false;

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

    Default Re: Hide shipping method when order exceeds certain weight

    Your code:
    Code:
    if ($chk_manufacturers_id > 8) {
    when the number of Products counted and stored to $chk_manufacturers_id is greater than 8 the module should show ... when the count is less than 8 it should not show ...

    Don't you really want to use 0 so that when the count is greater than 0 the module should show ... when the count is less than or equal to 0 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.5]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  10. #30
    Join Date
    Jan 2013
    Posts
    811
    Plugin Contributions
    0

    Default Re: Hide shipping method when order exceeds certain weight

    i have setup a Freight accessories using staticlist
    only want it to show with a certain Manufacturer only if i put 1 quantity in cart it will not show if i add another,if i make it two quantity it works.
    here is entire code
    class staticlist extends base {

    /**
    * $code determines the internal 'code' name used to designate "this" payment module
    *
    * @var string
    */
    var $code;

    /**
    * $title is the displayed name for this payment method
    *
    * @var string
    */
    var $title;

    /**
    * $description is a soft name for this payment method
    *
    * @var string
    */
    var $description;

    /**
    * module's icon
    *
    * @var string
    */
    var $icon;

    /**
    * $enabled determines whether this module shows or not during checkout
    *
    * @var boolean
    */
    var $enabled;

    /**
    * User configurable setting for the number of options that will be displayed under this shipping method.
    *
    * @var integer
    */
    var $num_options;


    function staticlist() {
    global $order, $db;

    $this->code = 'staticlist';
    $this->title = MODULE_SHIPPING_STATICLIST_TEXT_TITLE;
    $this->description = MODULE_SHIPPING_STATICLIST_TEXT_DESCRIPTION;
    $this->sort_order = MODULE_SHIPPING_STATICLIST_SORT_ORDER;
    $this->icon = '';
    $this->tax_class = MODULE_SHIPPING_STATICLIST_TAX_CLASS;
    $this->tax_basis = MODULE_SHIPPING_STATICLIST_TAX_BASIS;

    // CUSTOMIZE THIS SETTING FOR THE NUMBER OF OPTIONS NEEDED!!
    $this->num_options = 5;

    // disable only when entire cart is free shipping
    if (zen_get_shipping_enabled($this->code)) {
    $this->enabled = ((MODULE_SHIPPING_STATICLIST_STATUS == 'true') ? true : false);
    }
    // check if manufacturers in cart
    if (IS_ADMIN_FLAG == false) {
    global $cart;
    $chk_manufacturer = $_SESSION['cart']->in_cart_check('manufacturers_id', '8');
    $chk_manufacturers_id = $chk_manufacturer;
    if ($chk_manufacturers_id > 8) {
    $this->enabled = false;
    } else {
    $this->enabled = false;
    }
    }
    if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_STATICLIST_ZONE > 0) ) {
    $check_flag = false;
    $check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . "
    where geo_zone_id = '" . MODULE_SHIPPING_STATICLIST_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;
    }
    }
    }


    /**
    * Load descriptions and costs from language template file
    * ~/includes/languages/english/modules/shipping/staticlist.php
    *
    * @param string $method
    * @return array
    */
    function quote($method = '') {
    global $order;

    $this->quotes = array('id' => $this->code,
    'module' => $this->title,
    'methods' => array());

    $fee = zen_get_configuration_key_value('MODULE_SHIPPING_STATICLIST_FEE');

    /*
    * When the system calls a shipping module's quote() function with a non-null value for $method, it does not want a fully
    * populated array of shipping methods; rather, it is only interested in the value of $this->quotes['methods'][0], that
    * is, it is only interested in the value of the first element of the methods array. Under this condition, $method should
    * be used to determine which of the available options is to be reported back via $this->quotes['methods'][0] and the
    * rest of the methods array (namely $this->quotes['methods'][1] and $this->quotes['methods'][2] and so on) is irrelevant.
    */

    if ( zen_not_null($method) ) {
    $this->quotes['methods'][0] = array( 'id' => $method,
    'title' => zen_get_configuration_key_value('MODULE_SHIPPING_STATICLIST_OPT_' . $method),
    'cost' => zen_get_configuration_key_value('MODULE_SHIPPING_STATICLIST_COST_' . $method) + $fee );
    } else {
    for ($i=0; $i<$this->num_options; $i++) {
    $this->quotes['methods'][$i] = array( 'id' => $i,
    'title' => zen_get_configuration_key_value('MODULE_SHIPPING_STATICLIST_OPT_' . $i),
    'cost' => zen_get_configuration_key_value('MODULE_SHIPPING_STATICLIST_COST_' . $i) + $fee );
    }
    }

    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;
    }


    /**
    * Check to see whether module is installed
    *
    * @return boolean
    */
    function check() {
    global $db;
    if (!isset($this->_check)) {
    $check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_STATICLIST_STATUS'");
    $this->_check = $check_query->RecordCount();
    }
    return $this->_check;
    }


    /**
    * Install the staticlist module and its configuration settings
    *
    */
    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 Static List', 'MODULE_SHIPPING_STATICLIST_STATUS', 'True', 'Do you want to offer a static list of shipping options? Note: to change the number of options available through this shipping module, modify the value of num_options in includes/modules/shipping/staticlist.php, and then remove and re-install this module via Admin -> Modules -> 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 ('Fee', 'MODULE_SHIPPING_STATICLIST_FEE', '0.00', 'A handling or processing fee that is added to each option.', '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_STATICLIST_TAX_CLASS', '0', 'Use the following tax class on the 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_STATICLIST_TAX_BASIS', 'Shipping', 'On what basis is tax calculated? Options are:<br />Shipping - Based on the delivery address of the customer.<br />Billing - Based on billing address of the customer.<br />Store - Based on the store address if the billing/shipping zone is the same as the 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_STATICLIST_ZONE', '0', 'If a zone is selected, enable the static list for that zone only.', '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_STATICLIST_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
    for ($i=0; $i < $this->num_options; $i++) {
    $db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Option " . $i . " Description', 'MODULE_SHIPPING_STATICLIST_OPT_" . $i ."', 'This is the text the customer will see for option " . $i . "', 'Description of option " . $i . "', '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, date_added) values ('Option " . $i . " Cost', 'MODULE_SHIPPING_STATICLIST_COST_" . $i . "', '" . $i . ".00', 'Shipping rate for option " . $i . "', '6', '0', now())");
    }
    }


    /**
    * Remove the module and all its settings
    *
    */
    function remove() {
    global $db;
    $db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
    }


    /**
    * Internal list of configuration keys used for configuration of the module
    *
    * @return array
    */
    function keys() {
    $keys = array('MODULE_SHIPPING_STATICLIST_STATUS', 'MODULE_SHIPPING_STATICLIST_FEE', 'MODULE_SHIPPING_STATICLIST_TAX_CLASS', 'MODULE_SHIPPING_STATICLIST_TAX_BASIS', 'MODULE_SHIPPING_STATICLIST_ZONE', 'MODULE_SHIPPING_STATICLIST_SORT_ORDER');

    for ($i=0; $i < $this->num_options; $i++) {
    $keys[] = 'MODULE_SHIPPING_STATICLIST_OPT_' . $i;
    $keys[] = 'MODULE_SHIPPING_STATICLIST_COST_' . $i;
    }

    return $keys;
    }
    }
    ?>
    Last edited by jimmie; 7 Apr 2014 at 11:26 PM.

 

 
Page 3 of 4 FirstFirst 1234 LastLast

Similar Threads

  1. Hide table rate shipping under a certain weight
    By Kcin in forum Built-in Shipping and Payment Modules
    Replies: 10
    Last Post: 20 Jul 2020, 04:45 PM
  2. v139h Hide COD payment method from certain customers?
    By TroyC in forum General Questions
    Replies: 3
    Last Post: 5 Apr 2013, 04:19 PM
  3. v138a Hide shipping method when order exceeds certain value of order
    By staudrak in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 17 Jun 2012, 05:22 PM
  4. Shipping charges to change when a certain weight is reached
    By Llamatron77 in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 20 Feb 2011, 01:10 PM
  5. Hide shipping method if order is over a certain weight?
    By Danielle in forum Built-in Shipping and Payment Modules
    Replies: 1
    Last Post: 10 Jul 2007, 06:24 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR