ot_shipping Class Reference

List of all members.

Public Member Functions

Public Attributes


Detailed Description

Definition at line 12 of file ot_shipping.php.


Member Function Documentation

ot_shipping::check (  ) 

Definition at line 79 of file ot_shipping.php.

00079                    {
00080     if (!isset($this->_check)) {
00081       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER'");
00082       $this->_check = tep_db_num_rows($check_query);
00083     }
00084 
00085     return $this->_check;
00086   }

ot_shipping::install (  ) 

Definition at line 92 of file ot_shipping.php.

00092                        {
00093 
00094       tep_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_ORDER_TOTAL_SHIPPING_SORT_ORDER', '2', 'Ordre de tri pour l\'affichage (Le plus petit nombre est montré en premier).', '6', '2', now())");
00095       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 ('Permettre la livraison gratuite', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'false', 'Voulez vous accepter les livraisons gratuites en fonction du montant ?', '6', '3', 'tep_cfg_select_option(array(\'true\', \'false\'), ', now())");
00096 
00097       tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, date_added) values ('Livraison gratuite pour commande au dessus', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', '50', 'Permettre la livraison gratuite pour les commandes au dessus du montant suivant.', '6', '4', 'currencies->format', now())");
00098 
00099       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 ('Attacher livraison gratuite pour les destinations', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION', 'national', 'Livraison gratuite pour des commandes envoy&eacute;s &agrave; l\'ensemble des destinations.<br />(both=tous les deux)', '6', '5', 'tep_cfg_select_option(array(\'national\', \'international\', \'both\',\'none\'), ', now())");
00100     }

ot_shipping::keys (  ) 

Definition at line 88 of file ot_shipping.php.

00088                   {
00089     return array( 'MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING', 'MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER', 'MODULE_ORDER_TOTAL_SHIPPING_DESTINATION');
00090   }

ot_shipping::ot_shipping (  ) 

Definition at line 16 of file ot_shipping.php.

00016                          {
00017     $this->code = 'ot_shipping';
00018     $this->title = MODULE_ORDER_TOTAL_SHIPPING_TITLE;
00019     $this->description = MODULE_ORDER_TOTAL_SHIPPING_DESCRIPTION;
00020     $this->sort_order = (defined('MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER')) ? MODULE_ORDER_TOTAL_SHIPPING_SORT_ORDER : 3 ;
00021     $this->enabled = true;
00022 
00023     $this->output = array();
00024   }

ot_shipping::process (  ) 

Definition at line 26 of file ot_shipping.php.

00026                      {
00027     global $order, $currencies;
00028 
00029     $shipping_cost_ht=0;
00030 
00031     if (_cst_bool('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING')) {
00032       switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) {
00033         case 'national':
00034           if ($order->delivery['country_id'] == STORE_COUNTRY) $pass = true; break;
00035         case 'international':
00036           if ($order->delivery['country_id'] != STORE_COUNTRY) $pass = true; break;
00037         case 'both':
00038           $pass = true; break;
00039         default:
00040           $pass = false; break;
00041       }
00042 
00043       if ( ($pass == true) && ( ($order->info['total'] - $order->info['shipping_cost']) >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) {
00044         $order->info['shipping_method'] = FREE_SHIPPING_TITLE;
00045         $order->info['total'] -= $order->info['shipping_cost'];
00046         $order->info['shipping_cost'] = $order->info['shipping_cost_ht'] =  0;
00047       }
00048     }
00049 
00050     $module = substr($GLOBALS['shipping']['id'], 0, strpos($GLOBALS['shipping']['id'], '_'));
00051 
00052 
00053     if (tep_not_null($order->info['shipping_method'])) {
00054       if ( !_cst_bool('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING')){
00055         $shipping_tax = tep_get_tax_rate($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
00056         $shipping_tax_description = tep_get_tax_description($GLOBALS[$module]->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
00057       } else {
00058         $shipping_tax=0;
00059         $shipping_tax_description='';
00060       }
00061         $order->info['tax'] += ($order->info['shipping_cost']-$order->info['shipping_cost_ht']);
00062         @$order->info['tax_groups']["$shipping_tax_description"] += ($order->info['shipping_cost']-$order->info['shipping_cost_ht']);
00063         $order->info['total'] += $order->info['shipping_cost'];
00064 
00065         $shipping_cost_ht +=$order->info['shipping_cost_ht'];
00066 
00067         $order->info['subtotal_ht'] += $order->info['shipping_cost_ht'];
00068 
00069       $this->output[] = $b=array('title' => $order->info['shipping_method'] . ':',
00070                               'text_ht' => $currencies->format($shipping_cost_ht, true, $order->info['currency'], $order->info['currency_value']),
00071                               'text' => $currencies->format($order->info['shipping_cost'], true, $order->info['currency'], $order->info['currency_value']),
00072                               'value_ht' => $order->info['shipping_cost_ht'],
00073                               'value' => $order->info['shipping_cost'],
00074                                 );
00075 
00076     }
00077   }

ot_shipping::remove (  ) 

Definition at line 102 of file ot_shipping.php.

00102 { return false;}


Member Data Documentation

ot_shipping::$output

Definition at line 14 of file ot_shipping.php.

ot_shipping::$title

Definition at line 13 of file ot_shipping.php.


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