spu Class Reference

Inherits InterfaceModule, and InterfaceAcaShipping.

List of all members.

Public Member Functions

Public Attributes


Detailed Description

Definition at line 15 of file spu.php.


Constructor & Destructor Documentation

spu::__construct (  ) 

class constructor

Definition at line 26 of file spu.php.

00026                          {
00027     $this->code = __CLASS__;
00028     $this->title = __('Récupération des articles au magasin');
00029     $this->description = __('Récupération des articles au magasin durant les heures ouvrées.');
00030     $this->sort_order = (defined('MODULE_SHIPPING_SPU_SORT_ORDER;')? MODULE_SHIPPING_SPU_SORT_ORDER: 0);
00031     $this->icon = (tep_not_null('MODULE_SHIPPING_SPU_ICON')? MODULE_SHIPPING_SPU_ICON : '');
00032     $this->enabled =  true ;
00033 
00034     global $order;
00035     if (is_object($order)) $this->update_status($order);
00036   }


Member Function Documentation

spu::check (  ) 

Interface InterfaceModule.

Definition at line 85 of file spu.php.

00085                           {
00086     if (!isset($this->_check)) {
00087       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key LIKE 'MODULE_SHIPPING_SPU%' ");
00088       if( tep_db_num_rows($check_query) ==  count($this->keys()) ) $this->_check=true;
00089       else {
00090         $this->remove();
00091         $this->_check=false;
00092       }
00093     }
00094     return $this->_check;
00095   }

spu::install (  ) 

Definition at line 99 of file spu.php.

00099                             {
00100     $DB=Database::getInstance();
00101     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".addslashes(__('Store Pickup Cost'))."', 'MODULE_SHIPPING_SPU_COST', '0.00', '".addslashes(__('Preciser le cout'))."', '6', '0', now())");
00102     $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_SPU_ZONE', '0', '".addslashes(__('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_shipping(', now())");
00103     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('".addslashes(__('Sort order'))."', 'MODULE_SHIPPING_SPU_SORT_ORDER', '0', '".addslashes(__('Preciser un nombre pour le tri'))."', '6', '0', now())");
00104     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added,set_function) values ('choose icon', 'MODULE_SHIPPING_SPU_ICON', '', 'choose icon transporteur', '6', '0', now(),'tep_cfg_choose_img(')");
00105 
00106     // chargée sur demande
00107     $DB->query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added, configuration_type) values ('".addslashes(__('Store Pick Up Zip Code Allowed'))."', 'MODULE_SHIPPING_SPU_ZIP', '01, 07, 26, 38, 42, 69, 74', '".addslashes(__("Departement autorisé pour le retrait magasin ? laisser vide si vous ne l'utilisez pas"))."', '6', '0', now(),0)");
00108   }

spu::keys (  ) 

Definition at line 125 of file spu.php.

Referenced by check(), and remove().

00125                          {
00126     return array( 'MODULE_SHIPPING_SPU_COST', 'MODULE_SHIPPING_SPU_SORT_ORDER', 'MODULE_SHIPPING_SPU_ZONE', 'MODULE_SHIPPING_SPU_ZIP','MODULE_SHIPPING_SPU_ICON');
00127   }

spu::quote ( method = ''  ) 

Interface InterfaceAcaShipping.

Definition at line 43 of file spu.php.

00043                                       {
00044     global $order,$customer_id;
00045 
00046     $codep_query = tep_db_query("select c.configuration_value, ab.entry_postcode from " . TABLE_CONFIGURATION . " c, " . TABLE_ADDRESS_BOOK . " ab where c.configuration_key = 'MODULE_SHIPPING_SPU_ZIP' and ab.customers_id = '" . (int)$customer_id . "'");
00047     $codep = tep_db_fetch_array($codep_query);
00048     $dept_allow = split("[, ]", $codep['configuration_value']);
00049     $cust_cp = substr($codep['entry_postcode'], 0, 2);
00050     if((in_array($cust_cp, $dept_allow))||($codep['configuration_value'] == '')){
00051                   $this->quotes = array('id' => $this->code,
00052                                 'module' => __('Récupération des articles au magasin'),
00053                                 'methods' => array(array('id' => $this->code,
00054                                                           'tax'=>0,
00055                                                           'title' => __("Veuillez nous téléphoner avant de passer afin de confirmer la disponibilité et les horaires d'ouverture. "),
00056                                                           'cost_ht' => MODULE_SHIPPING_SPU_COST,
00057                                                           'cost' =>  MODULE_SHIPPING_SPU_COST
00058                                             ))
00059                                 );
00060     return $this->quotes;
00061     }else{
00062       return $this->quotes=false;
00063     }
00064     if (tep_not_null($this->icon)) $this->quotes['icon'] = shipping::get_icon($this->icon, $this->title);
00065 
00066   }

spu::remove (  ) 

Definition at line 112 of file spu.php.

00112                            {
00113     $keys = '';
00114     $keys_array = $this->keys();
00115     for ($i=0; $i<sizeof($keys_array); $i++) {
00116       $keys .= "'" . $keys_array[$i] . "',";
00117     }
00118     $keys = substr($keys, 0, -1);
00119 
00120     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
00121   }

spu::update_status ( order  ) 

Definition at line 71 of file spu.php.

Referenced by __construct().

00071                                         {
00072     if ($this->enabled == true ) {
00073       $this->enabled = false;
00074       if ( ((int)MODULE_SHIPPING_SPU_ZONE > 0) && ((int)MODULE_SHIPPING_SPU_ZONE == shipping::getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) )
00075         $this->enabled = true;
00076       elseif ((int)MODULE_SHIPPING_SPU_ZONE == 0)
00077         $this->enabled = true;
00078     }
00079   }


Member Data Documentation

spu::$code

Definition at line 17 of file spu.php.

spu::$description

Definition at line 19 of file spu.php.

spu::$enabled

Definition at line 21 of file spu.php.

spu::$icon

Definition at line 20 of file spu.php.

spu::$title

Definition at line 18 of file spu.php.


The documentation for this class was generated from the following file:
  • includes/modules/shipping/spu.php