public function init()
 {
     parent::init();
     // PrestaShop removes such declaration before class
     require_once dirname(__FILE__) . '../../../../modules/designerpreview/defines.inc.php';
     $css_dir = _THEME_CSS_DIR_;
     $img_dir = _THEME_IMG_DIR_;
     $js_dir = _THEME_JS_DIR_;
     if (isPreviewTheme()) {
         $css_dir = getPreviewCssDir();
         $img_dir = getPreviewImgDir();
         $js_dir = getPreviewJsDir();
     }
     $this->context->smarty->assign(array('tpl_dir' => getThemeDir(), 'img_dir' => $img_dir, 'css_dir' => $css_dir, 'js_dir' => $js_dir, 'css_theme_cache' => Configuration::get('PS_CSS_THEME_CACHE'), 'bd_order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order', 'sliderVars' => getSliderModeVars(), 'templateVars' => getTemplateVars()));
     // needed in shopping cart Billion Themler control - blockcart.php
     $param = array('cookie' => $this->context->cookie, 'cart' => $this->context->cart);
     $this->getCartProducts($param);
     // needed to output header search form in Billion Themler theme.
     $this->calculSearchCommon();
 }
 public function setMedia()
 {
     // if website is accessed by mobile device
     // @see FrontControllerCore::setMobileMedia()
     if ($this->useMobileTheme()) {
         $this->setMobileMedia();
         return true;
     }
     require_once dirname(__FILE__) . '../../../../modules/designerpreview/defines.inc.php';
     $css_dir = isPreviewTheme() ? getPreviewCssDir() : _THEME_CSS_DIR_;
     $js_dir = isPreviewTheme() ? getPreviewJsDir() : _THEME_JS_DIR_;
     $tpl_dir = getThemeDir();
     $this->addCSS($css_dir . 'grid_prestashop.css', 'all');
     // retro compat themes 1.5
     $this->addCSS($css_dir . 'global.css', 'all');
     $this->addjquery();
     $this->addjqueryPlugin('easing');
     $this->addJS(_PS_JS_DIR_ . 'tools.js');
     $this->addJS($js_dir . 'global.js');
     // Automatically add js files from js/autoload directory in the template
     if (@filemtime($tpl_dir . 'js/autoload/')) {
         foreach (scandir($tpl_dir . 'js/autoload/', 0) as $file) {
             if (preg_match('/^[^.].*\\.js$/', $file)) {
                 $this->addJS($tpl_dir . 'js/autoload/' . $file);
             }
         }
     }
     // Automatically add css files from css/autoload directory in the template
     if (@filemtime($tpl_dir . 'css/autoload/')) {
         foreach (scandir($tpl_dir . 'css/autoload', 0) as $file) {
             if (preg_match('/^[^.].*\\.css$/', $file)) {
                 $this->addCSS($tpl_dir . 'css/autoload/' . $file);
             }
         }
     }
     if (Tools::isSubmit('live_edit') && Tools::getValue('ad') && Tools::getAdminToken('AdminModulesPositions' . (int) Tab::getIdFromClassName('AdminModulesPositions') . (int) Tools::getValue('id_employee'))) {
         $this->addJqueryUI('ui.sortable');
         $this->addjqueryPlugin('fancybox');
         $this->addJS(_PS_JS_DIR_ . 'hookLiveEdit.js');
     }
     if (Configuration::get('PS_QUICK_VIEW')) {
         $this->addjqueryPlugin('fancybox');
     }
     if (Configuration::get('PS_COMPARATOR_MAX_ITEM') > 0) {
         $this->addJS($js_dir . 'products-comparison.js');
     }
     // Execute Hook FrontController SetMedia
     Hook::exec('actionFrontControllerSetMedia', array());
 }