/**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     parent::initContent();
     if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToShop()) {
         $this->productSort();
         // productSort must be called before assignOne
         $this->assignOne();
         $this->setTemplate(_PS_THEME_DIR_ . 'supplier.tpl');
     } else {
         $this->assignAll();
         $this->setTemplate(_PS_THEME_DIR_ . 'supplier-list.tpl');
     }
 }
Beispiel #2
0
 /**
  * Assign template vars related to page content
  * @see FrontController::initContent()
  * @param id_categoy : for select suppliers by category
  */
 public function initContent($id_category = null)
 {
     if (Tools::getValue('ajax')) {
         return;
     }
     parent::initContent();
     if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToShop()) {
         if (Validate::isLoadedObject($this->category) && $this->category->active && $this->category->isAssociatedToShop()) {
             $this->productSort();
             // productSort must be called before assignOne
             $this->assignOneCategory();
             $this->setTemplate(_PS_THEME_DIR_ . 'supplier.tpl');
         } else {
             $this->productSort();
             // productSort must be called before assignOne
             $this->assignOne();
             $this->setTemplate(_PS_THEME_DIR_ . 'supplier.tpl');
         }
     } else {
         if ($id_category == null) {
             $this->assignAll();
         } else {
             $this->assignAllByCategory($id_category);
         }
         $this->setTemplate(_PS_THEME_DIR_ . 'supplier-list.tpl');
     }
     $this->context->smarty->assign(array('HOOK_LEFT_COLUMN' => Hook::exec('leftColumn')));
 }
Beispiel #3
0
 /**
  * Assign template vars related to page content.
  *
  * @see FrontController::initContent()
  */
 public function initContent()
 {
     if (Configuration::get('PS_DISPLAY_SUPPLIERS')) {
         parent::initContent();
         if (Validate::isLoadedObject($this->supplier) && $this->supplier->active && $this->supplier->isAssociatedToShop()) {
             $this->assignSupplier();
             $this->label = $this->trans('List of products by supplier %s', array($this->supplier->name), 'Shop.Theme.Catalog');
             $this->doProductSearch('catalog/listing/supplier', array('entity' => 'supplier', 'id' => $this->supplier->id));
         } else {
             $this->assignAll();
             $this->label = $this->trans('List of all suppliers', array(), 'Shop.Theme.Catalog');
             $this->setTemplate('catalog/suppliers', array('entity' => 'suppliers'));
         }
     } else {
         $this->redirect_after = '404';
         $this->redirect();
     }
 }