* @copyright 2015 PrestaShow.pl * @license http://PrestaShow.pl/license */ class Product extends ProductCore { /** @var boolean */ public $import = true; public static function checkImportStatus($id_product, $id_shop) { if (version_compare(_PS_VERSION_, '1.7') >= 0) { return 1; } $q = "SELECT `import` FROM `" . _DB_PREFIX_ . "product_shop` WHERE `id_product` = " . (int) $id_product . " AND `id_shop` = " . (int) $id_shop; return (int) Db::getInstance()->getValue($q); } public static function priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, &$specific_price, $use_group_reduction, $id_customer = 0, $use_customer_price = true, $id_cart = 0, $real_quantity = 0, $id_customization = 0) { if (version_compare(_PS_VERSION_, '1.7') == -1) { $price = parent::priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, $specific_price, $use_group_reduction, $id_customer, $use_customer_price, $id_cart, $real_quantity); } else { $price = parent::priceCalculation($id_shop, $id_product, $id_product_attribute, $id_country, $id_state, $zipcode, $id_currency, $id_group, $quantity, $use_tax, $decimals, $only_reduc, $use_reduc, $with_ecotax, $specific_price, $use_group_reduction, $id_customer, $use_customer_price, $id_cart, $real_quantity, $id_customization); } require_once _PS_MODULE_DIR_ . '/pshowimporter/config.php'; if ((bool) PShow_Settings::getInstance(_PS_MODULE_DIR_ . 'pshowimporter/')->get('mod_combination_nett_price') === false) { return $price; } static $address = null; static $context = null; if ($address === null) { $address = new Address(); } if ($context == null) { $context = Context::getContext()->cloneContext(); } $address->id_country = $id_country; $address->id_state = $id_state; $address->postcode = $zipcode; $tax_manager = TaxManagerFactory::getManager($address, Product::getIdTaxRulesGroupByIdProduct((int) $id_product, $context)); $product_tax_calculator = $tax_manager->getTaxCalculator(); $p = new Product($id_product); $pPrice = $use_tax ? $product_tax_calculator->addTaxes($p->price) : $p->price; $price = $price - $pPrice; return $price; } }