[ Index ]

PHP Cross Reference of osCMax 2.0.4

title

Body

[close]

/includes/modules/shipping/ -> indvship.php (source)

   1  <?php
   2  /*

   3  $Id: indvship.php 3 2006-05-27 04:59:07Z user $

   4    by D. M. Gremlin

   5  

   6    osCMax Power E-Commerce

   7    http://oscdox.com

   8  

   9    Copyright 2006 osCMax

  10  

  11    Released under the GNU General Public License

  12  */
  13  
  14    class indvship {
  15      var $code, $title, $description, $icon, $enabled;
  16  
  17  // class constructor

  18      function indvship() {
  19        global $order;
  20        $this->code = 'indvship';
  21        $this->title = MODULE_SHIPPING_INDVSHIP_TEXT_TITLE;
  22        $this->description = MODULE_SHIPPING_INDVSHIP_TEXT_DESCRIPTION;
  23        $this->sort_order = MODULE_SHIPPING_INDVSHIP_SORT_ORDER;
  24        $this->icon = '';
  25        $this->tax_class = MODULE_SHIPPING_INDVSHIP_TAX_CLASS;
  26        $this->enabled = ((MODULE_SHIPPING_INDVSHIP_STATUS == 'True') ? true : false);
  27  
  28  // Enable Individual Shipping Module

  29        $this->enabled = MODULE_SHIPPING_INDVSHIP_STATUS;
  30        if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_INDVSHIP_ZONE > 0) ) {
  31          $check_flag = false;
  32          $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_INDVSHIP_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
  33          while ($check = tep_db_fetch_array($check_query)) {
  34            if ($check['zone_id'] < 1) {
  35              $check_flag = true;
  36              break;
  37            } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
  38              $check_flag = true;
  39              break;
  40            }
  41          }
  42  
  43          if ($check_flag == false) {
  44            $this->enabled = false;
  45          }
  46        }
  47      }
  48  
  49  // class methods

  50  
  51     function quote($method = '') {
  52        global $order, $cart;
  53     $shiptotal = $cart->get_shiptotal();
  54  
  55        $this->quotes = array('id' => $this->code,
  56                              'module' => MODULE_SHIPPING_INDVSHIP_TEXT_TITLE,
  57                              'methods' => array(array('id' => $this->code,
  58                                                       'title' => MODULE_SHIPPING_INDVSHIP_TEXT_WAY,
  59                                                       'cost' => $shiptotal)));
  60  
  61        if ($this->tax_class > 0) {
  62          $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  63        }
  64  
  65        if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
  66  
  67        return $this->quotes;
  68      }
  69      
  70    
  71  
  72      function check() {
  73        if (!isset($this->_check)) {
  74          $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_INDVSHIP_STATUS'");
  75          $this->_check = tep_db_num_rows($check_query);
  76        }
  77        return $this->_check;
  78      }
  79  
  80      function install() {
  81       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Individual Shipping Prices', 'MODULE_SHIPPING_INDVSHIP_STATUS', 'True', 'Do you want to offer individual shipping prices?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  82       tep_db_query("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_INDVSHIP_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
  83       tep_db_query("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_INDVSHIP_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  84       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  85      }
  86  
  87      function remove() {
  88        
  89        tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  90      }
  91  
  92      function keys() {
  93        return array('MODULE_SHIPPING_INDVSHIP_STATUS', 'MODULE_SHIPPING_INDVSHIP_TAX_CLASS', 'MODULE_SHIPPING_INDVSHIP_ZONE', 'MODULE_SHIPPING_INDVSHIP_SORT_ORDER');
  94      }
  95    }
  96  ?>


Generated: Fri Jan 1 13:43:16 2010 Cross-referenced by PHPXref 0.7