90 lines
1.7 KiB
PHP
Raw Normal View History

2015-09-17 11:09:56 +02:00
<?php
class Product extends ProductCore
{
public function loadReductionInfo(Context $context = null) {
if ($context == null)
$context = Context::getContext();
$id_lang = $context->language->id;
// Tax
$usetax = Tax::excludeTaxeOption();
if (isset($this->id_product_attribute)) {
$id_product_attribute = $this->id_product_attribute;
} else {
$id_product_attribute = null;
}
$this->category = Category::getLinkRewrite((int)$this->id_category_default, (int)$id_lang);
if (self::$_taxCalculationMethod == PS_TAX_EXC)
{
$this->price_tax_exc = Tools::ps_round($this->price_tax_exc, 2);
$this->price = Product::getPriceStatic(
(int)$this->id,
true,
$id_product_attribute,
6
);
$this->price_without_reduction = Product::getPriceStatic(
(int)$this->id,
false,
$id_product_attribute,
2,
null,
false,
false
);
}
else
{
$this->price = Tools::ps_round(
Product::getPriceStatic(
(int)$this->id,
true,
$id_product_attribute,
6
),
(int)Configuration::get('PS_PRICE_DISPLAY_PRECISION')
);
$this->price_without_reduction = Product::getPriceStatic(
(int)$this->id,
true,
$id_product_attribute,
6,
null,
false,
false
);
}
$this->reduction = Product::getPriceStatic(
(int)$this->id,
(bool)$usetax,
$id_product_attribute,
6,
null,
true,
true,
1,
true,
null,
null,
null,
$specific_prices
);
$this->specific_prices = $specific_prices;
$this->quantity = Product::getQuantity(
(int)$this->id,
0,
isset($this->cache_is_pack) ? $this->cache_is_pack : null
);
$this->quantity_all_versions = $this->quantity;
return $this;
}
}