Beispiel #1
0
 public static function initPricesComputation($id_customer = null)
 {
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         if (!Validate::isLoadedObject($customer)) {
             die(Tools::displayError());
         }
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group);
     } else {
         if (Validate::isLoadedObject(Context::getContext()->customer)) {
             self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Context::getContext()->customer->id_default_group);
         } else {
             self::$_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
         }
     }
 }
 public static function initPricesComputation($id_customer = NULL)
 {
     global $cookie;
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         if (!Validate::isLoadedObject($customer)) {
             die(Tools::displayError());
         }
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group);
     } elseif ($cookie->id_customer) {
         $customer = new Customer((int) $cookie->id_customer);
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group);
     } else {
         self::$_taxCalculationMethod = Group::getDefaultPriceDisplayMethod();
     }
 }
Beispiel #3
0
 public static function initPricesComputation($id_customer = null)
 {
     if ($id_customer) {
         $customer = new Customer((int) $id_customer);
         if (!Validate::isLoadedObject($customer)) {
             die(Tools::displayError());
         }
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod((int) $customer->id_default_group);
         $cur_cart = Context::getContext()->cart;
         $id_address = 0;
         if (Validate::isLoadedObject($cur_cart)) {
             $id_address = (int) $cur_cart->{Configuration::get('PS_TAX_ADDRESS_TYPE')};
         }
         $address_infos = Address::getCountryAndState($id_address);
         if (self::$_taxCalculationMethod != PS_TAX_EXC && !empty($address_infos['vat_number']) && $address_infos['id_country'] != Configuration::get('VATNUMBER_COUNTRY') && Configuration::get('VATNUMBER_MANAGEMENT')) {
             self::$_taxCalculationMethod = PS_TAX_EXC;
         }
     } else {
         self::$_taxCalculationMethod = Group::getPriceDisplayMethod(Group::getCurrent()->id);
     }
 }