2016-01-04 12:48:08 +01:00
|
|
|
<?php
|
|
|
|
class ProductController extends ProductControllerCore {
|
|
|
|
public function preProcess() {
|
|
|
|
parent::preProcess();
|
|
|
|
|
|
|
|
if(Module::isInstalled('privatesales')) {
|
|
|
|
$id_category = $this->product->id_category_default;
|
|
|
|
$sale = Sale::getSaleFromCategory($id_category);
|
|
|
|
|
|
|
|
self::$smarty->assign(array(
|
|
|
|
'sale' => $sale,
|
|
|
|
'HOOK_PRIVATESALES_PRODUCT' => Module::hookExec('privatesales_product', array('sale' => $sale)),
|
|
|
|
'is_sale_home' => ($sale? $sale->id_category == $id_category: FALSE),
|
|
|
|
));
|
2016-07-13 16:37:00 +02:00
|
|
|
|
|
|
|
// assign date estimation from sale delay
|
|
|
|
if (Module::isInstalled('privatesales_delay')) {
|
|
|
|
if (!class_exists('SaleDelay')) {
|
|
|
|
require_once _PS_ROOT_DIR_.'/modules/privatesales_delay/saledelay.php';
|
|
|
|
}
|
|
|
|
$date = new DateTime();
|
|
|
|
$delivery_date = SaleDelay::getDeliveryDate(array($sale->delivery_delay), null, $date);
|
|
|
|
}
|
2016-01-04 12:48:08 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
$bestSaleCart = Module::hookExec('bestSaleCart');
|
|
|
|
self::$smarty->assign(array(
|
|
|
|
'bestSaleCart' => $bestSaleCart,
|
|
|
|
'product' => $this->product,
|
|
|
|
'coverImage' => Product::getCover($this->product->id),
|
2016-07-13 16:37:00 +02:00
|
|
|
'delivery_date' => (!empty($delivery_date)?$delivery_date:null),
|
2016-01-04 12:48:08 +01:00
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function setMedia() {
|
|
|
|
parent::setMedia();
|
|
|
|
|
|
|
|
global $css_files;
|
|
|
|
$css_files = array_slice($css_files, 0, 1);
|
2016-06-01 12:43:12 +02:00
|
|
|
|
|
|
|
if(!_PS_MOBILE_) {
|
|
|
|
Tools::addJS(array(
|
|
|
|
_THEME_JS_DIR_.'jquery.mousewheel.js',
|
|
|
|
_THEME_JS_DIR_.'jquery.jscrollpane.min.js'
|
|
|
|
));
|
|
|
|
}
|
2016-01-04 12:48:08 +01:00
|
|
|
}
|
|
|
|
}
|