コード例 #1
0
ファイル: product.php プロジェクト: jeprodev/jeproshop
 public static function initPricesComputation($customer_id = null)
 {
     if ($customer_id) {
         $customer = new JeproshopCustomerModelCustomer((int) $customer_id);
         if (!JeproshopTools::isLoadedObject($customer, 'customer_id')) {
             die(Tools::displayError());
         }
         self::$_taxCalculationMethod = JeproshopGroupModelGroup::getPriceDisplayMethod((int) $customer->default_group_id);
         $cur_cart = JeproshopContext::getContext()->cart;
         $address_id = 0;
         if (JeproshopTools::isLoadedObject($cur_cart, 'cart_id')) {
             $address_id = (int) $cur_cart->{JeproshopSettingModelSetting::getValue('tax_address_type')};
         }
         $address_info = JeproshopAddressModelAddress::getCountryAndState($address_id);
         if (self::$_taxCalculationMethod != COM_JEPROSHOP_TAX_EXCLUDED && !empty($address_info->vat_number) && $address_info->country_id != JeproshopSettingModelSetting::getValue('country_vat_number') && JeproshopSettingModelSetting::getValue('vat_number_management')) {
             self::$_taxCalculationMethod = COM_JEPROSHOP_TAX_EXCLUDED;
         }
     } else {
         self::$_taxCalculationMethod = JeproshopGroupModelGroup::getPriceDisplayMethod(JeproshopGroupModelGroup::getCurrent()->group_id);
     }
 }