/**
  * Initializes controller.
  *
  * @see FrontController::init()
  *
  * @throws PrestaShopException
  */
 public function init()
 {
     if (Configuration::get('PS_DISPLAY_BEST_SELLERS')) {
         parent::init();
         $this->doProductSearch('catalog/listing/best-sales');
     } else {
         Tools::redirect('index.php?controller=404');
     }
 }
 /**
  * Initialize manufaturer controller.
  *
  * @see FrontController::init()
  */
 public function init()
 {
     if ($id_manufacturer = Tools::getValue('id_manufacturer')) {
         $this->manufacturer = new Manufacturer((int) $id_manufacturer, $this->context->language->id);
         if (!Validate::isLoadedObject($this->manufacturer) || !$this->manufacturer->active || !$this->manufacturer->isAssociatedToShop()) {
             $this->redirect_after = '404';
             $this->redirect();
         } else {
             $this->canonicalRedirection();
         }
     }
     parent::init();
 }
Beispiel #3
0
 /**
  * Initialize supplier controller.
  *
  * @see FrontController::init()
  */
 public function init()
 {
     if ($id_supplier = (int) Tools::getValue('id_supplier')) {
         $this->supplier = new Supplier($id_supplier, $this->context->language->id);
         if (!Validate::isLoadedObject($this->supplier) || !$this->supplier->active) {
             $this->redirect_after = '404';
             $this->redirect();
         } else {
             $this->canonicalRedirection();
         }
     }
     parent::init();
 }
Beispiel #4
0
 /**
  * Initializes controller.
  *
  * @see FrontController::init()
  *
  * @throws PrestaShopException
  */
 public function init()
 {
     parent::init();
     $id_category = (int) Tools::getValue('id_category');
     $this->category = new Category($id_category, $this->context->language->id);
     if (!Validate::isLoadedObject($this->category) || !$this->category->active) {
         Tools::redirect('index.php?controller=404');
     }
     if (!$this->category->checkAccess($this->context->customer->id)) {
         header('HTTP/1.1 403 Forbidden');
         header('Status: 403 Forbidden');
         $this->errors[] = $this->trans('You do not have access to this category.', array(), 'Shop.Notifications.Error');
         $this->setTemplate('errors/forbidden');
         return;
     }
     $this->context->smarty->assign(array('category' => $this->getTemplateVarCategory(), 'subcategories' => $this->getTemplateVarSubCategories()));
     $this->doProductSearch('catalog/listing/category', array('entity' => 'category', 'id' => $id_category));
 }
 /**
  * Initializes controller.
  *
  * @see FrontController::init()
  *
  * @throws PrestaShopException
  */
 public function init()
 {
     parent::init();
     $this->doProductSearch('catalog/listing/new-products');
 }
 /**
  * Initializes controller.
  *
  * @see FrontController::init()
  *
  * @throws PrestaShopException
  */
 public function init()
 {
     parent::init();
     $this->doProductSearch('catalog/listing/prices-drop');
 }