Advertisement
Guest User

osCommerce nouto

a guest
Apr 26th, 2012
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.26 KB | None | 0 0
  1.  
  2.  
  3.  
  4. <?php
  5. /*
  6.   $Id$
  7.  
  8.   osCommerce, Open Source E-Commerce Solutions
  9.   http://www.oscommerce.com
  10.  
  11.   Copyright (c) 2003 osCommerce
  12.  
  13.   Released under the GNU General Public License
  14. */
  15.  
  16.   class flat {
  17.     var $code, $title, $description, $icon, $enabled;
  18.  
  19. // class constructor
  20.     function nouto() {
  21.       global $order;
  22.  
  23.       $this->code = 'nouto';
  24.       $this->title = MODULE_SHIPPING_NOUTO_TEXT_TITLE;
  25.       $this->description = MODULE_SHIPPING_NOUTO_TEXT_DESCRIPTION;
  26.       $this->sort_order = MODULE_SHIPPING_NOUTO_SORT_ORDER;
  27.       $this->icon = '';
  28.       $this->tax_class = MODULE_SHIPPING_NOUTO_TAX_CLASS;
  29.       $this->enabled = ((MODULE_SHIPPING_NOUTO_STATUS == 'True') ? true : false);
  30.  
  31.       if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_NOUTO_ZONE > 0) ) {
  32.         $check_flag = false;
  33.         $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_NOUTO_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
  34.         while ($check = tep_db_fetch_array($check_query)) {
  35.           if ($check['zone_id'] < 1) {
  36.             $check_flag = true;
  37.             break;
  38.           } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
  39.             $check_flag = true;
  40.             break;
  41.           }
  42.         }
  43.  
  44.         if ($check_flag == false) {
  45.           $this->enabled = false;
  46.         }
  47.       }
  48.     }
  49.  
  50. // class methods
  51.     function quote($method = '') {
  52.       global $order;
  53.  
  54.       $this->quotes = array('id' => $this->code,
  55.                             'module' => MODULE_SHIPPING_NOUTO_TEXT_TITLE,
  56.                             'methods' => array(array('id' => $this->code,
  57.                                                      'title' => MODULE_SHIPPING_NOUTO_TEXT_WAY,
  58.                                                      'cost' => MODULE_SHIPPING_NOUTO_COST)));
  59.  
  60.       if ($this->tax_class > 0) {
  61.         $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  62.       }
  63.  
  64.       if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
  65.  
  66.       return $this->quotes;
  67.     }
  68.  
  69.     function check() {
  70.       if (!isset($this->_check)) {
  71.         $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_NOUTO_STATUS'");
  72.         $this->_check = tep_db_num_rows($check_query);
  73.       }
  74.       return $this->_check;
  75.     }
  76.  
  77.     function install() {
  78.       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 Flat Shipping', 'MODULE_SHIPPING_NOUTO_STATUS', 'True', 'Do you want to offer flat rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  79.       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Shipping Cost', 'MODULE_SHIPPING_NOUTO_COST', '5.00', 'The shipping cost for all orders using this shipping method.', '6', '0', now())");
  80.       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_NOUTO_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())");
  81.       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_NOUTO_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())");
  82.       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_NOUTO_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  83.     }
  84.  
  85.     function remove() {
  86.       tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
  87.     }
  88.  
  89.     function keys() {
  90.       return array('MODULE_SHIPPING_NOUTO_STATUS', 'MODULE_SHIPPING_NOUTO_COST', 'MODULE_SHIPPING_NOUTO_TAX_CLASS', 'MODULE_SHIPPING_NOUTO_ZONE', 'MODULE_SHIPPING_NOUTO_SORT_ORDER');
  91.     }
  92.   }
  93. ?>
  94.  
  95. Ja englanninkielinen ja suomenkielinen tältä
  96. <?php
  97. /*
  98.   $Id$
  99.  
  100.   osCommerce, Open Source E-Commerce Solutions
  101.   http://www.oscommerce.com
  102.  
  103.   Copyright (c) 2002 osCommerce
  104.  
  105.   Released under the GNU General Public License
  106. */
  107.  
  108. define('MODULE_SHIPPING_NOUTO_TEXT_TITLE', '');
  109. define('MODULE_SHIPPING_NOUTO_TEXT_DESCRIPTION', '');
  110. define('MODULE_SHIPPING_NOUTO_TEXT_WAY', 'Nouto');
  111. ?>
  112.  
  113.  
  114. Mutta moduuli ei vaan ilmesty admin paneeliin. Apuja?
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement