Thibault GUILLAUME 5e376949d9 add product home
2015-09-22 11:47:01 +02:00

95 lines
1.9 KiB
PHP

<?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);
$this->link = Context::getContext()->link->getProductLink($this);
$this->id_product = $this->id;
$id_image = Product::getCover($this->id);
$this->id_image = $id_image['id_image'];
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;
}
}