flat Class Reference

Inherits InterfaceModule, and InterfaceAcaShipping.

List of all members.

Public Member Functions

Public Attributes


Detailed Description

Definition at line 12 of file flat.php.


Constructor & Destructor Documentation

flat::__construct (  ) 

Definition at line 20 of file flat.php.

00020                          {
00021     $this->code =__CLASS__;
00022     $this->title = __('module shipping flat text title');
00023     $this->description = __('module shipping flat text description');
00024     $this->sort_order = (defined('MODULE_SHIPPING_FLAT_SORT_ORDER')? MODULE_SHIPPING_FLAT_SORT_ORDER : 0) ;
00025     $this->icon = (tep_not_null('MODULE_SHIPPING_FLAT_ICON')? MODULE_SHIPPING_FLAT_ICON : '');
00026     $this->tax_class = (defined('MODULE_SHIPPING_FLAT_TAX_CLASS')?MODULE_SHIPPING_FLAT_TAX_CLASS: 0);
00027     $this->enabled = true;
00028 
00029 
00030     global $order;
00031     if (is_object($order)) $this->update_status($order);
00032   }


Member Function Documentation

flat::check (  ) 

Interface InterfaceModule.

Definition at line 73 of file flat.php.

00073                           {
00074     if (!isset($this->_check)) {
00075       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE_SHIPPING_FLAT%' ");
00076         if( tep_db_num_rows($check_query) ==  count($this->keys()) ) $this->_check=true;
00077         else {
00078         $this->remove();
00079         $this->_check=false;
00080       }
00081     }
00082     return $this->_check;
00083   }

flat::install (  ) 

Definition at line 85 of file flat.php.

00085                             {
00086     $DB=Database::getInstance();
00087     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Coût de livraison', 'MODULE_SHIPPING_FLAT_COST', '5.00', 'Coût de livraison pour tous les commandes en utilisant cette méthode.', '6', '0', now())");
00088     $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 ('Type de taxe', 'MODULE_SHIPPING_FLAT_TAX_CLASS', '0', 'Employez la classe suivante de taxe sur les coûts de livraison.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
00089     $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 ('Zone de livraison', 'MODULE_SHIPPING_FLAT_ZONE', '0', 'Permettre seulement cette méthode de livraison pour la zone choisie.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_shipping(', now())");
00090     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Ordre de tri', 'MODULE_SHIPPING_FLAT_SORT_ORDER', '0', 'Ordre de tri pour l\'affichage (Le plus petit nombre est montré en premier).', '6', '0', now())");
00091 
00092     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added,set_function) values ('".addslashes(__("Icone"))."', 'MODULE_SHIPPING_FLAT_ICON', '', '".addslashes(__("Choix d'un icone"))."', '6', '0', now(),'tep_cfg_choose_img(')");
00093   }

flat::keys (  ) 

Definition at line 99 of file flat.php.

Referenced by check(), and remove().

00099                          {
00100     return array( 'MODULE_SHIPPING_FLAT_COST', 'MODULE_SHIPPING_FLAT_TAX_CLASS', 'MODULE_SHIPPING_FLAT_ZONE', 'MODULE_SHIPPING_FLAT_SORT_ORDER','MODULE_SHIPPING_FLAT_ICON');
00101   }

flat::quote ( method = ''  ) 

Interface InterfaceAcaShipping.

Definition at line 35 of file flat.php.

00035                                       {
00036     global $order;
00037 
00038 
00039     $this->quotes = array('id' => $this->code,
00040                           'module' => __('module shipping flat text title in shipping'),
00041                           'methods' => array(array('id' => $this->code,
00042                                              'tax'=>0,
00043                                             'title' => __('module shipping flat text way'),
00044                                             'cost_ht' => MODULE_SHIPPING_FLAT_COST,
00045                                             'cost' => MODULE_SHIPPING_FLAT_COST))
00046                             );
00047     /* Si taxe, on refefini */
00048     if ($this->tax_class > 0) {
00049       $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
00050       $this->quotes['methods'][0]['cost'] = tep_add_tax(MODULE_SHIPPING_FLAT_COST, $this->quotes['tax']);
00051       $this->quotes['methods'][0]['cost_ht'] = MODULE_SHIPPING_FLAT_COST;
00052     }
00053 
00054     if (tep_not_null($this->icon)) $this->quotes['icon'] = shipping::get_icon($this->icon, $this->title);
00055 
00056     return $this->quotes;
00057   }

flat::remove (  ) 

Definition at line 95 of file flat.php.

00095                            {
00096     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
00097   }

flat::update_status ( order  ) 

Definition at line 61 of file flat.php.

Referenced by __construct().

00061                                         {
00062     if ($this->enabled == true ) {
00063       $this->enabled = false;
00064       if ( ((int)MODULE_SHIPPING_FLAT_ZONE > 0) && ((int)MODULE_SHIPPING_FLAT_ZONE == shipping::getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) )
00065         $this->enabled = true;
00066       elseif ((int)MODULE_SHIPPING_FLAT_ZONE == 0)
00067         $this->enabled = true;
00068     }
00069   }


Member Data Documentation

flat::$code

Definition at line 14 of file flat.php.

flat::$description

Definition at line 16 of file flat.php.

flat::$enabled

Definition at line 18 of file flat.php.

flat::$icon

Definition at line 17 of file flat.php.

flat::$title

Definition at line 15 of file flat.php.


The documentation for this class was generated from the following file: