item Class Reference

Inherits InterfaceModule, and InterfaceAcaShipping.

List of all members.

Public Member Functions

Public Attributes


Detailed Description

Definition at line 11 of file item.php.


Constructor & Destructor Documentation

item::__construct (  ) 

Definition at line 16 of file item.php.

00016                                 {
00017     $this->code = 'item';
00018     $this->title = __('module shipping item text title');
00019     $this->description = __('module shipping item text description');
00020     $this->sort_order = (defined('MODULE_SHIPPING_ITEM_SORT_ORDER;')? MODULE_SHIPPING_ITEM_SORT_ORDER: 0);
00021     $this->icon = (tep_not_null('MODULE_SHIPPING_ITEM_ICON')? substr(MODULE_SHIPPING_ITEM_ICON,strlen(DIR_WS_CATALOG)) : '');
00022     $this->tax_class = MODULE_SHIPPING_ITEM_TAX_CLASS;
00023     $this->enabled =  true ;
00024 
00025     global $order;
00026     if (is_object($order)) $this->update_status($order);
00027   }


Member Function Documentation

item::check (  ) 

Interface InterfaceModule.

Definition at line 66 of file item.php.

00066                           {
00067     $DB=Database::getInstance();
00068     if (!isset($this->_check)) {
00069       $check_query = $DB->query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE_SHIPPING_ITEM%' ");
00070       if( $check_query->__get('numRows') ==  count($this->keys()) ) $this->_check=true;
00071       else {
00072         $this->remove();
00073         $this->_check=false;
00074       }
00075     }
00076     return $this->_check;
00077   }

item::install (  ) 

Definition at line 79 of file item.php.

00079                             {
00080     $DB=Database::getInstance();
00081     $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_ITEM_COST', '2.50', 'Le coût de livraison sera multiplié par le nombre d\'articles dans la commande employant cette méthode.', '6', '0', now())");
00082     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Coûts de manutention', 'MODULE_SHIPPING_ITEM_HANDLING', '0', 'Les coûts de manutention pour cette méthode de livraison.', '6', '0', now())");
00083     $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_ITEM_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())");
00084     $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_ITEM_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())");
00085     $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_ITEM_SORT_ORDER', '0', 'Ordre de tri pour l\'affichage (Le plus petit nombre est montré en premier).', '6', '0', now())");
00086 
00087     $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_ITEM_ICON', '', '".addslashes(__("Choix d'un icone"))."', '6', '0', now(),'tep_cfg_choose_img(')");
00088   }

item::keys (  ) 

Definition at line 95 of file item.php.

Referenced by check(), and remove().

00095                          {
00096     return array( 'MODULE_SHIPPING_ITEM_COST', 'MODULE_SHIPPING_ITEM_HANDLING', 'MODULE_SHIPPING_ITEM_TAX_CLASS', 'MODULE_SHIPPING_ITEM_ZONE', 'MODULE_SHIPPING_ITEM_SORT_ORDER','MODULE_SHIPPING_ITEM_ICON');
00097   }

item::quote ( method = ''  ) 

Interface InterfaceAcaShipping.

Definition at line 30 of file item.php.

00030                                       {
00031     global $order, $total_count;
00032 
00033     $this->quotes = array('id' => $this->code,
00034                           'module' => __('module shipping item text title in shipping'),
00035                           'methods' => array(array('id' => $this->code,
00036                                             'tax'=>0,
00037                                             'title' => __('module shipping item text way'),
00038                                             'cost_ht' => ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING),
00039                                             'cost' => ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING) ))
00040                             );
00041     /* Si taxe, on refefini */
00042     if ($this->tax_class > 0) {
00043       $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
00044       $this->quotes['methods'][0]['cost'] = tep_add_tax(((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING), $this->quotes['tax']);
00045       $this->quotes['methods'][0]['cost_ht'] = ((MODULE_SHIPPING_ITEM_COST * $total_count) + MODULE_SHIPPING_ITEM_HANDLING);
00046     }
00047     if (tep_not_null($this->icon)) $this->quotes['icon'] = shipping::get_icon($this->icon, $this->title);
00048 
00049     return $this->quotes;
00050   }

item::remove (  ) 

Definition at line 90 of file item.php.

00090                            {
00091     $DB=Database::getInstance();
00092     $DB->query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
00093   }

item::update_status ( order  ) 

Definition at line 53 of file item.php.

Referenced by __construct().

00053                                         {
00054     if ($this->enabled == true ) {
00055       $this->enabled = false;
00056       if ( ((int)MODULE_SHIPPING_ITEM_ZONE > 0) && ((int)MODULE_SHIPPING_ITEM_ZONE == shipping::getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) )
00057         $this->enabled = true;
00058       elseif ((int)MODULE_SHIPPING_ITEM_ZONE == 0)
00059         $this->enabled = true;
00060     }
00061   }


Member Data Documentation

item::$code

Definition at line 13 of file item.php.

item::$description

Definition at line 13 of file item.php.

item::$enabled

Definition at line 13 of file item.php.

item::$icon

Definition at line 13 of file item.php.

item::$title

Definition at line 13 of file item.php.


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