price Class Reference

List of all members.

Public Member Functions

  • __construct ()
  • get_round ($process)
    Fonction public.
  • get_decimal_places ($code=DEFAULT_CURRENCY)
  • is_set ($code)
  • get_value ($code)
  • view_price_with_tax ($price, $tax_id, $currency='', $currency_v='', $qty=1)
    Vue du prix total produits.
  • display_tax_value ($value, $padding=TAX_DECIMAL_PLACES)
    Ajout de zero après la virgule si besoin.
  • format ($number, $calculate_currency_value=true, $currency_type= '', $currency_value= '')
    Alias currency_format pour display.
  • get_tax_rate ($class_id, $country_id=-1, $zone_id=-1)
    Récupération du taux de la taxe d'un produit à partir de l'identifiant de la taxe.
  • display_with_tax ($products_price, $tax, $force=false, $strict=false)
  • print_products_price ($products_id, $style='html')
    Mise en forme pour l'affichage d'un prix de produit à partir de son identifiant Prend en compte :.
  • get_products_price ($products_id, $qty=1, $mode='', $tax_force=false)
    Recup prix produit, tableau ou detail.
  • display_products_price ($products_id, $products_price, $products_tax_rate=0, $specials_products_price=0, $style='html', $tax_sym=true, $tax_force=false)
    Génération du html pour l'affichage du prix d'un produit.
  • get_tax_description ($class_id, $country_id, $zone_id)
    Recupère le nom des taxes.
  • tep_get_tax_class_title ($tax_class_id)
    Recup title class.
  • get_tax_amount ($products_price, $tax, $round=false)
    Calcule le montant de la taxe.
  • display_price ($products_price, $products_tax, $quantity=1)

Static Public Member Functions

  • static convert_in_currency ($number, $in_currency, $to_currency=DEFAULT_CURRENCY)
    Fonction de convertion de valeur ,.
  • static define_modele ($format, $type='price_model', $style='html')
    re-definiton d'un modele de sortie de prix
  • static define_OneModele ($products_id, $format, $type='price_model', $style='html')
    re-definiton d'un modele de sortie de prix usage ponctuel

Public Attributes

Static Public Attributes

  • static $currency = array()
  • static $PriceCache = array()
    array tableau de cache des prix deja calculé
  • static $_spe_Cache = array()
    array cache des prix promo (special)

Static Protected Attributes

Private Member Functions

Static Private Member Functions

Static Private Attributes


Detailed Description

Definition at line 49 of file price.php.


Constructor & Destructor Documentation

price::__construct (  ) 

Definition at line 93 of file price.php.

00093                                 {
00094 
00095     $this->currencies = array();
00096     $currencies_query = tep_db_query("select code, title, symbol_left, symbol_right, decimal_point, thousands_point, decimal_places, value from " . TABLE_CURRENCIES);
00097     while ($currencies = tep_db_fetch_array($currencies_query)) {
00098       $this->currencies[$currencies['code']] = array('title' => $currencies['title'],
00099                                                      'symbol_left' => $currencies['symbol_left'],
00100                                                      'symbol_right' => $currencies['symbol_right'],
00101                                                      'decimal_point' => $currencies['decimal_point'],
00102                                                      'thousands_point' => $currencies['thousands_point'],
00103                                                      'decimal_places' => $currencies['decimal_places'],
00104                                                      'value' => $currencies['value']);
00105     }
00106     self::$currency=$this->currencies ;
00107   }


Member Function Documentation

price::calcul_price ( products_id,
products_price,
products_tax_rate = 0,
specials_products_price = 0,
qty = 1,
tax_force = false 
) [private]

frontoffice function

Note:
Update price , by module , special , group , discount Prend en charge le calcul du prix produit, special, total line, en HT et TTC
Parameters:
$products_id int/string pid or prid
$products_price 
$products_tax_rate 
$specials_products_price 
$qty 
$tax_force 
Returns:
array prices products

discount SPPC

add taxes

qty

Inclusion des modules intervant sur les prix, flag price

qty apres adjust price

Definition at line 365 of file price.php.

Referenced by display_products_price(), and get_products_price().

00365                                                                                                                                             {
00366 
00367     if(isset(self::$PriceCache[$products_id.'_'.$qty])) return self::$PriceCache[$products_id.'_'.$qty];
00368 
00370     $products_price=self::get_SPPC_discount($products_price);
00371     $specials_products_price=self::get_SPPC_discount($specials_products_price);
00372 
00374     $res_price = $this->display_with_tax($products_price, $products_tax_rate, $tax_force);
00375     $res_spe_price =$this->display_with_tax($specials_products_price, $products_tax_rate, $tax_force);
00376 
00378     $total_line=( (($specials_products_price>0 && $specials_products_price !=$products_price)? $specials_products_price :$products_price) * $qty);
00379     $total_line_ttc=( (($res_spe_price>0 && $res_spe_price !=$res_price)? $res_spe_price :$res_price) * $qty);
00380 
00384     $array_res=product::get_adjust_price(array('products_id'=>$products_id,
00385                                               'final_price_ht'=> $products_price,
00386                                               'final_price_ttc'=> $res_price,
00387                                               'final_sprice_ht'=> $specials_products_price,
00388                                               'final_sprice_ttc'=> $res_spe_price,
00389                                               'total_line'=> $total_line,
00390                                               'total_line_ttc'=> $total_line_ttc,
00391                                               'products_quantity'=>$qty)
00392                                               );
00393 
00394     //
00395     $_products_price=( (is_float($array_res['final_price_ht']) )? $array_res['final_price_ht'] : $products_price );
00396 
00397     if(/*$_products_price != $products_price &&*/ $array_res['final_price_ttc']=='')
00398       $_res_price=$this->display_with_tax($_products_price, $products_tax_rate, $tax_force);
00399     else
00400       $_res_price=( (is_float($array_res['final_price_ttc']) )? $array_res['final_price_ttc'] : $res_price );
00401 
00402     $_specials_products_price=( (is_float($array_res['final_sprice_ht']) )? $array_res['final_sprice_ht'] : $specials_products_price );
00403     $_res_spe_price=( (is_float($array_res['final_sprice_ttc']) )? $array_res['final_sprice_ttc'] : $res_spe_price );
00404     $total_line=( (is_float($array_res['total_line']) )? $array_res['total_line'] : $total_line );
00405     $total_line_ttc=( (is_float($array_res['total_line_ttc']) )? $array_res['total_line_ttc'] : $total_line_ttc );
00406 
00408     if(!is_float($array_res['total_line']) ||($_products_price !=$products_price) || ($_specials_products_price !=$specials_products_price ) )
00409       $total_line=( (($_specials_products_price>0 && $_specials_products_price !=$_products_price)? $_specials_products_price :$_products_price) * $qty);
00410     if(!is_float($array_res['total_line_ttc']) ||($_res_spe_price !=$res_spe_price) || ($_res_price !=$res_price ) )
00411       $total_line_ttc=( (($_res_spe_price>0 && $_res_spe_price !=$_res_price)? $_res_spe_price :$_res_price) * $qty);
00412 
00413     return self::$PriceCache[$products_id.'_'.$qty]=array('price_ht'=>$_products_price,
00414                                                   'price_ttc'=>$_res_price,
00415                                                   'sprice_ht'=>$_specials_products_price,
00416                                                   'sprice_ttc'=>$_res_spe_price,
00417                                                   'total_line'=>$total_line,
00418                                                   'total_line_ttc'=>$total_line_ttc,
00419                                                   );
00420   }

static price::convert_in_currency ( number,
in_currency,
to_currency = DEFAULT_CURRENCY 
) [static]

Fonction de convertion de valeur ,.

Parameters:
$number 
$in_currency 
$to_currency 

Definition at line 444 of file price.php.

00444                                                                                                     {
00445     $in_currency = (!empty($in_currency) ? $in_currency : (_cst_bool('USE_DEFAULT_LANGUAGE_CURRENCY') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY) ) ;
00446     return  (($number / self::$currency[$in_currency]['value'])  * self::$currency[$to_currency]['value']);
00447   }

price::currency_format ( number,
calculate_currency_value = true,
currency_type = '',
currency_value = '',
round = false 
) [private]
Parameters:
$number 
$calculate_currency_value boolean
$currency_type 
$currency_value 
$round boolean round in process = false

Definition at line 230 of file price.php.

Referenced by display_price(), display_products_price(), format(), and view_price_with_tax().

00230                                                                                                                                        {
00231     global $currency;
00232     $euro_string = '';
00233 
00234     if (empty($currency_type))
00235        $currency_type = (!empty($currency) ? $currency : (_cst_bool('USE_DEFAULT_LANGUAGE_CURRENCY') ? LANGUAGE_CURRENCY : DEFAULT_CURRENCY) ) ;
00236 
00237     if ($calculate_currency_value == true) {
00238       $number *= tep_not_null($currency_value) ? $currency_value : $this->get_currency_value();
00239       // if the selected currency is in the european euro-conversion and the default currency is euro, the currency will displayed in the national currency and euro currency
00240       if ( (DEFAULT_CURRENCY == 'EUR') && in_array($currency_type, array('DEM','BEF','LUF','ESP','FRF','IEP','ITL','NLG','ATS','PTE','FIM','GRD')) )
00241         $euro_string = ' <small>[' . $this->currency_format($number, true, 'EUR') . ']</small>';
00242     }
00243 
00244     return $this->currencies[$currency_type]['symbol_left'] . number_format(tep_round($number, $this->get_round($round) ), $this->get_currency_decimal_places(), $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'] . $euro_string;
00245   }

static price::define_modele ( format,
type = 'price_model',
style = 'html' 
) [static]

re-definiton d'un modele de sortie de prix

Note:
cf $price_model | $special_model
Parameters:
$format string
$type string
$style string

Definition at line 654 of file price.php.

00654                                                                                   {
00655     if(isset(self::$modele[$type][$style]))  self::$modele[$type][$style]=$format;
00656   }

static price::define_OneModele ( products_id,
format,
type = 'price_model',
style = 'html' 
) [static]

re-definiton d'un modele de sortie de prix usage ponctuel

Note:
cf $price_model | $special_model
Parameters:
$products_id int
$format 
$type string
$style string

Definition at line 667 of file price.php.

00667                                                                                                   {
00668     self::$getmodele[$products_id][$type][$style]=$format;
00669   }

price::display_price ( products_price,
products_tax,
quantity = 1 
)

Definition at line 725 of file price.php.

00725                                                                                {
00726     return $this->currency_format(tep_add_tax($products_price, $products_tax) * $quantity);
00727   }

price::display_products_price ( products_id,
products_price,
products_tax_rate = 0,
specials_products_price = 0,
style = 'html',
tax_sym = true,
tax_force = false 
)

Génération du html pour l'affichage du prix d'un produit.

Parameters:
$products_id 
$products_price 
$products_tax_rate 
$specials_products_price 
$style string
$tax_sym 
$tax_force bool
Returns:
string

Definition at line 628 of file price.php.

Referenced by print_products_price().

00628                                                                                                                                                                              {
00629 
00630     $res_array=$this->calcul_price($products_id,$products_price, $products_tax_rate, $specials_products_price ,1, $tax_force);
00631 
00632     $style = strtolower($style);
00633 
00634     $output_price = $this->currency_format($res_array['price_ttc']).($tax_sym?$this->display_tax_symbol($style):'');
00635     $output_special = $this->currency_format($res_array['sprice_ttc']).($tax_sym?$this->display_tax_symbol($style):'');
00636     $output = '';
00637 
00638     if ((int)$res_array['sprice_ttc'] && $res_array['sprice_ttc'] != $res_array['price_ttc'])
00639       $output = str_replace('%pprice', $output_price, str_replace('%sprice', $output_special, self::getModele($products_id,'special_model',$style) /*self::$special_model[$style]*/));
00640     elseif($products_price)
00641       $output = str_replace('%pprice', $output_price,self::getModele($products_id,'price_model',$style) /*self::$price_model[$style]*/);
00642 
00643     return $output;
00644   }

price::display_tax_symbol ( style = 'html'  )  [private]

Precise si tarif avec/ hors taxe.

Parameters:
$style string

Definition at line 196 of file price.php.

Referenced by display_products_price().

00196                                                      {
00197     $tax_symbol = '&nbsp;';
00198 
00199     if (self::is_SPPC_show_tax()) $tax_symbol .= TAX_SYMBOL;
00200     else $tax_symbol .= NOTAX_SYMBOL;
00201 
00202     if ($style=='html')
00203       return '<span class="tax_symbol">'.$tax_symbol.'</span>';
00204     else
00205       return $tax_symbol;
00206   }

price::display_tax_value ( value,
padding = TAX_DECIMAL_PLACES 
)

Ajout de zero après la virgule si besoin.

Parameters:
$value float
$padding 
Returns:
string

Definition at line 498 of file price.php.

00498                                                                            {
00499     if (strpos($value, '.')) {
00500       while (substr($value, -1) == '0') $value = substr($value, 0, -1);
00501       if (substr($value, -1) == '.') $value = substr($value, 0, -1);
00502     }
00503     if ($padding > 0) {
00504       if ($decimal_pos = strpos($value, '.')) {
00505         $decimals = strlen(substr($value, ($decimal_pos+1)));
00506         for ($i=$decimals; $i<$padding; $i++) $value .= '0';
00507       } else {
00508         $value .= '.';
00509         for ($i=0; $i<$padding; $i++) $value .= '0';
00510       }
00511     }
00512     return $value;
00513   }

price::display_with_tax ( products_price,
tax,
force = false,
strict = false 
)

Definition at line 570 of file price.php.

Referenced by calcul_price(), and view_price_with_tax().

00570                                                                                        { //tep_add_tax //$this->add_tax
00571 
00572     $customer_group_show_tax = self::is_SPPC_show_tax();
00573 
00574     if ( $force || ($tax > 0 && $customer_group_show_tax))
00575       return (!$strict)
00576                 ? tep_round((float)$products_price, $this->get_round($strict) ) + $this->get_tax_amount((float)$products_price, $tax ,$strict )
00577                 : (float)$products_price + $this->get_tax_amount((float)$products_price, $tax ,false );
00578     else
00579       return $products_price;
00580   }

price::format ( number,
calculate_currency_value = true,
currency_type = '',
currency_value = '' 
)

Alias currency_format pour display.

Parameters:
$number 
$calculate_currency_value bool
$currency_type 
$currency_value 

Definition at line 523 of file price.php.

00523                                                                                                                {
00524     return $this->currency_format($number, $calculate_currency_value, $currency_type, $currency_value, true);
00525   }

price::get_attributes_price ( products_id,
attributes = array() 
) [private]

Definition at line 157 of file price.php.

Referenced by get_db_products_price().

00157                                                                            {
00158     return product::get_product_attribut_price($products_id, $attributes);
00159   }

price::get_currency_decimal_places ( code = DEFAULT_CURRENCY  )  [private]
Parameters:
$code string

Definition at line 271 of file price.php.

Referenced by currency_format(), get_decimal_places(), get_round(), and view_price_with_tax().

00271                                                                        {
00272     return $this->currencies[$code]['decimal_places'];
00273   }

price::get_currency_value ( code = DEFAULT_CURRENCY  )  [private]
Parameters:
$code string

Definition at line 263 of file price.php.

Referenced by currency_format().

00263                                                               {
00264     return $this->currencies[$code]['value'];
00265   }

price::get_customer_group_id (  )  [private]

Definition at line 298 of file price.php.

Referenced by get_db_products_price(), get_db_products_special_price(), and get_product_sell_price().

00298                                            {
00299     global $page;
00300 
00301     if (!isset($this->customer['customers_group_id'])) {
00302       $page->new_class('customer');
00303       $this->customer = $page->_call('customer','the_customer');
00304     }
00305     if(!isset($this->customer['customers_group_id'])) self::is_SPPC_grp();
00306 
00307     return $this->customer['customers_group_id'];
00308   }

price::get_db_products_price ( products_id,
customers_group_id = 'NaN' 
) [private]

Récupère le prix d'origine d'un produit en fonction du groupe.

Parameters:
$products_id 
$customers_group_id 
Returns:
float

Definition at line 137 of file price.php.

Referenced by get_product_sell_price(), get_products_price(), and print_products_price().

00137                                                                                   {
00138     if ($customers_group_id == 'NaN') $customers_group_id = $this->get_customer_group_id();
00139 
00140     $pid = tep_get_prid($products_id);
00141 
00142     if ($customers_group_id > 0) { // recup prix spécifiqu au groupe
00143       $price_query = tep_db_query("select customers_group_price as products_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" .$pid. "' and customers_group_id =  '" . $customers_group_id  . "'");
00144       if (tep_db_num_rows($price_query)) $products_price = (float)tep_db_fetch_array($price_query);
00145     }
00146     if (!isset($products_price['products_price'])) { // si pas de prix pour le groupe, recup prix général
00147       $product_obj=product::get_item($pid);
00148       if(!$product_obj) return 0;
00149       $products_price['products_price']=(float) $product_obj->products_price;
00150     }
00151 
00152     $products_price['products_price'] += (float)$this->get_attributes_price($products_id, tep_get_prid_array($products_id));
00153 
00154     return $products_price['products_price'];
00155   }

price::get_db_products_special_price ( products_id,
customers_group_id = 'NaN' 
) [private]

Récupère le prix promotionnel d'un produit en fonction du groupe.

Parameters:
$products_id 
$customers_group_id 

Definition at line 171 of file price.php.

Referenced by get_product_sell_price(), get_products_price(), and print_products_price().

00171                                                                                           {
00172 
00173     if ($customers_group_id == 'NaN') $customers_group_id = $this->get_customer_group_id();
00174     $pid = tep_get_prid($products_id);
00175 
00176     if(!isset(self::$_spe_Cache[$pid])){
00177       $product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$pid . "' and customers_group_id= '" . (int)$customers_group_id . "' and status='1' ");
00178       $product = tep_db_fetch_array($product_query);
00179       self::$_spe_Cache[$pid]=(isset($product['specials_new_products_price'])? $product['specials_new_products_price'] : 0);
00180 
00181     } else {
00182       $product['specials_new_products_price'] = self::$_spe_Cache[$pid];
00183     }
00184     return $product['specials_new_products_price'];
00185   }

price::get_decimal_places ( code = DEFAULT_CURRENCY  ) 
Parameters:
$code string

Definition at line 453 of file price.php.

00453                                                             {
00454     return $this->get_currency_decimal_places($code);
00455   }

price::get_product_sell_price ( products_id,
customers_group_id = 'NaN' 
) [private]

Definition at line 117 of file price.php.

00117                                                                                    {
00118     if ($customers_group_id == 'NaN') $customers_group_id = $this->get_customer_group_id();
00119 
00120     $products_price = $this->get_db_products_price($products_id, $customers_group_id);
00121 
00122     if (($products_special_price=$this->get_db_products_special_price($products_id, $customers_group_id)) && $products_special_price < $products_price)
00123       return $products_special_price;
00124     else
00125        return $products_price;
00126   }

price::get_products_price ( products_id,
qty = 1,
mode = '',
tax_force = false 
)

Recup prix produit, tableau ou detail.

Parameters:
$products_id string/int $products_id pid or prid
$qty int
$mode string
$tax_force bool
Returns:
array/string

Definition at line 608 of file price.php.

00608                                                                                     {
00609     $res_array=$this->calcul_price($products_id,$this->get_db_products_price($products_id), $this->get_tax_rates_from_pid($products_id), $this->get_db_products_special_price($products_id), $qty,$tax_force);
00610 
00611     if(!empty($mode) && isset($res_array[$mode])) return $res_array[$mode];
00612     return $res_array;
00613   }

price::get_round ( process  ) 

Fonction public.

value round

Parameters:
$process bool

Definition at line 431 of file price.php.

Referenced by currency_format(), display_with_tax(), and get_tax_amount().

00431                                      {
00432     return ((bool)$process)
00433             ? $this->get_currency_decimal_places()
00434             : 6 ;
00435   }

static price::get_SPPC_discount ( price  )  [static, private]
Parameters:
$price float

Definition at line 314 of file price.php.

Referenced by calcul_price().

00314                                                    {
00315     if(isset($_SESSION['sppc_group_discount']) && $_SESSION['sppc_group_discount']>0)  return ($price - ($price*($_SESSION['sppc_group_discount']/100)) );
00316     return $price;
00317   }

static price::get_SPPC_sql_specific_tax_exemption (  )  [static, private]

Definition at line 284 of file price.php.

00284                                                                 {
00285     if (isset($_SESSION['sppc_customer_specific_taxes_exempt']) && tep_not_null($_SESSION['sppc_customer_specific_taxes_exempt']))
00286       return  "AND tax_rates_id NOT IN ( ". $_SESSION['sppc_customer_specific_taxes_exempt'] ." )";
00287     else
00288       return '';
00289   }

price::get_tax_amount ( products_price,
tax,
round = false 
)

Calcule le montant de la taxe.

Parameters:
$products_price 
$tax 
$round boolean round in process = false

Definition at line 719 of file price.php.

Referenced by display_with_tax().

00719                                                                      { //tep_calculate_tax //$this->calculate_tax
00720 
00721     if(!$round)return tep_round((float)$products_price * $tax / 100, $this->get_round($round));
00722     else return ($products_price * $tax / 100);
00723   }

price::get_tax_description ( class_id,
country_id,
zone_id 
)

Recupère le nom des taxes.

Parameters:
$class_id 
$country_id 
$zone_id 

Definition at line 678 of file price.php.

00678                                                                         {
00679    // Gestion de l'exemption totale de taxe
00680     if (self::is_SPPC_tax_exempt()) return '';
00681 
00682 
00683     if(isset(self::$_taxdesc_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id]) ) return self::$_taxdesc_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id];
00684 
00685     $tax_query = tep_db_query("select tax_description from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' " . self::get_SPPC_sql_specific_tax_exemption() . " order by tr.tax_priority");
00686 
00687     if (!tep_db_num_rows($tax_query)) return self::$_taxdesc_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id] = TEXT_UNKNOWN_TAX_RATE;
00688 
00689     $tax_description = '';
00690     while ($tax = tep_db_fetch_array($tax_query)) {
00691       $tax_description .= $tax['tax_description'] . ' + ';
00692     }
00693     $tax_description = substr($tax_description, 0, -3);
00694 
00695     return self::$_taxdesc_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id] = $tax_description;
00696   }

price::get_tax_rate ( class_id,
country_id = -1,
zone_id = -1 
)

Récupération du taux de la taxe d'un produit à partir de l'identifiant de la taxe.

Definition at line 530 of file price.php.

Referenced by get_tax_rates_from_pid().

00530                                                                            {
00531     global $customer_zone_id, $customer_country_id;
00532 
00533     // Gestion de l'exemption totale de taxe
00534     if (self::is_SPPC_tax_exempt()) return 0;;
00535 
00536     // Geolocalisation
00537     if ( ($country_id == -1) && ($zone_id == -1) ) {
00538       if (!tep_session_is_registered('customer_id')) {
00539         $country_id = STORE_COUNTRY;
00540         $zone_id = STORE_ZONE;
00541       } else {
00542         $country_id = $customer_country_id;
00543         $zone_id = $customer_zone_id;
00544       }
00545     }
00546     if(isset(self::$_taxrate_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id])) return self::$_taxrate_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id];
00547 
00548     $tax_query = tep_db_query("select sum(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " tr left join " . TABLE_ZONES_TO_GEO_ZONES . " za on (tr.tax_zone_id = za.geo_zone_id) left join " . TABLE_GEO_ZONES . " tz on (tz.geo_zone_id = tr.tax_zone_id) where (za.zone_country_id is null or za.zone_country_id = '0' or za.zone_country_id = '" . (int)$country_id . "') and (za.zone_id is null or za.zone_id = '0' or za.zone_id = '" . (int)$zone_id . "') and tr.tax_class_id = '" . (int)$class_id . "' " . self::get_SPPC_sql_specific_tax_exemption() . " group by tr.tax_priority");
00549 
00550     if (!tep_db_num_rows($tax_query)) return self::$_taxrate_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id] = 0;
00551 
00552     $tax_multiplier = 1.0;
00553     while ($tax = tep_db_fetch_array($tax_query)) {
00554       $tax_multiplier *= 1.0 + ($tax['tax_rate'] / 100);
00555     }
00556 
00557     return self::$_taxrate_Cache[(int)$country_id .'_'.(int)$zone_id .'_'.(int)$class_id] = ($tax_multiplier - 1.0) * 100;
00558   }

price::get_tax_rates_from_pid ( products_id,
country_id = -1,
zone_id = -1 
) [private]

Récupération du taux de la taxe d'un produit à partir de l'identifiant produit.

Parameters:
$products_id 
$country_id 
$zone_id 

Definition at line 214 of file price.php.

Referenced by get_products_price(), and print_products_price().

00214                                                                                          {
00215     $pid = tep_get_prid($products_id);
00216     $product_obj=product::get_item($pid);
00217     if(!$product_obj)return false;
00218     return $this->get_tax_rate($product_obj->products_tax_class_id, $country_id, $zone_id);
00219   }

price::get_value ( code  ) 
Parameters:
$code string

Definition at line 470 of file price.php.

00470                                    {
00471     return $this->currencies[$code]['value'];
00472   }

static price::getModele ( products_id,
type = 'price_model',
style = 'html' 
) [static, private]

FrontOffice.

Note:
Utilisation modele Uniquement appelé par display_products_price
Parameters:
$products_id int
$type string
$style string

Definition at line 341 of file price.php.

00341                                                                                     {
00342 
00343     if(isset(self::$getmodele[$products_id][$type][$style])){
00344       $res= self::$getmodele[$products_id][$type][$style];
00345     }
00346     else $res= self::$modele[$type][$style];
00347 
00348     return $res;
00349   }

price::is_currency_set ( code  )  [private]
Parameters:
$code string

Definition at line 251 of file price.php.

00251                                           { // alias trouvé tep_currency_exists <> retour $code au lieu de true
00252     if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) {
00253       return true;
00254     } else {
00255       return false;
00256     }
00257   }

price::is_set ( code  ) 
Parameters:
$code string

Definition at line 461 of file price.php.

00461                                 {
00462     if (isset($this->currencies[$code]) && tep_not_null($this->currencies[$code])) return true;
00463     else  return false;
00464   }

static price::is_SPPC_grp (  )  [static, private]

Recup element groupe 0 si user not connected.

Definition at line 322 of file price.php.

Referenced by get_customer_group_id().

00322                                        {
00323     $DB=Database::getInstance();
00324     $res_o=$DB->query("select * from ".TABLE_CUSTOMERS_GROUPS." where customers_group_id='0' ");
00325     $res=$res_o->fetchAssoc();
00326 
00327     $_SESSION['sppc_customer_group_tax_exempt']=$res['customers_group_tax_exempt'];
00328     $_SESSION['sppc_customer_specific_taxes_exempt']=$res['group_specific_taxes_exempt'];
00329     $_SESSION['sppc_customer_group_show_tax']=$res['customers_group_show_tax'];
00330     $_SESSION['sppc_group_discount']=$res['group_discount'];
00331   }

static price::is_SPPC_show_tax (  )  [static, private]

Definition at line 277 of file price.php.

Referenced by display_with_tax().

00277                                              {
00278     if (!isset($_SESSION['sppc_customer_group_show_tax']) || ( isset($_SESSION['sppc_customer_group_show_tax']) &&  $_SESSION['sppc_customer_group_show_tax']=='1'))
00279       return true ;
00280     else
00281       return false;
00282   }

static price::is_SPPC_tax_exempt (  )  [static, private]

Definition at line 291 of file price.php.

00291                                                {
00292     if (isset($_SESSION['sppc_customer_group_tax_exempt']) && $_SESSION['sppc_customer_group_tax_exempt'] == '1')
00293       return true;
00294     else
00295       return false;
00296   }

price::print_products_price ( products_id,
style = 'html' 
)

Mise en forme pour l'affichage d'un prix de produit à partir de son identifiant Prend en compte :.

  • - l'existance ou non d'une promotion
  • - l'affichage des taxes
  • - Le module SPPC (prix, taxes et promo)
Parameters:
$products_id int|string product_id | prid
$style string format sortie
Returns:
string

Definition at line 595 of file price.php.

00595                                                                    {
00596     return $this->display_products_price($products_id,$this->get_db_products_price($products_id), $this->get_tax_rates_from_pid($products_id), $this->get_db_products_special_price($products_id), $style);
00597   }

price::tep_get_tax_class_title ( tax_class_id  ) 

Recup title class.

Parameters:
$tax_class_id 

Definition at line 703 of file price.php.

00703                                                          {
00704     if ($tax_class_id == '0')  return TEXT_NONE;
00705     else {
00706       if(isset(self::$_taxtitle_Cache[(int)$tax_class_id])) return self::$_taxtitle_Cache[(int)$tax_class_id];
00707       $classes_query = tep_db_query("select tax_class_title from " . TABLE_TAX_CLASS . " where tax_class_id = '" . (int)$tax_class_id . "'");
00708       $classes = tep_db_fetch_array($classes_query);
00709       return self::$_taxtitle_Cache[(int)$tax_class_id] = $classes['tax_class_title'];
00710     }
00711   }

price::view_price_with_tax ( price,
tax_id,
currency = '',
currency_v = '',
qty = 1 
)

Vue du prix total produits.

Parameters:
$price float
$tax_id int
$currency 
$currency_v float
$qty int

Definition at line 483 of file price.php.

00483                                                                                           {
00484     return $this->currency_format(
00485             tep_round(
00486               ($this->display_with_tax($price, $tax_id, true, true) *$qty)
00487               , $this->get_currency_decimal_places())
00488             , false , $currency, $currency_v);
00489   }


Member Data Documentation

price::$_spe_Cache = array() [static]

array cache des prix promo (special)

Definition at line 63 of file price.php.

price::$_taxdesc_Cache = array() [static, private]

Definition at line 69 of file price.php.

price::$_taxrate_Cache = array() [static, private]

Cache.

Definition at line 68 of file price.php.

price::$_taxtitle_Cache = array() [static, private]

Definition at line 70 of file price.php.

price::$currencies

Definition at line 51 of file price.php.

Referenced by __construct().

price::$currency = array() [static]

Definition at line 55 of file price.php.

Referenced by currency_format(), and view_price_with_tax().

price::$customer

Definition at line 53 of file price.php.

price::$getmodele = array() [static, protected]

Gabarit one usage.

Definition at line 88 of file price.php.

price::$modele [static, protected]
Initial value:
 array( 'price_model' => array( 'text'=>'%pprice', 
                                                            'html'=>'<span class="price">%pprice</span>', 
                                                            'rss'=>'      <price>%pprice</price>' 
                                                          ),
                                    'special_model'=> array( 'text'=>'%sprice', 
                                                            'html'=>'<del>%pprice</del>&nbsp;<span class="productSpecialPrice">%sprice</span>',
                                                            'rss'=>"      <price>%pprice</price> \n       <specialprice>%sprice</specialprice>" 
                                                          ),
                                      )

Gabarit prix normal.

Definition at line 75 of file price.php.

price::$PriceCache = array() [static]

array tableau de cache des prix deja calculé

Definition at line 59 of file price.php.


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