Exemplo n.º 1
0
 /**
  * Get the data
  */
 private function getData()
 {
     // validate incoming parameters
     if ($this->URL->getParameter(1) === null) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     // get information
     $this->record = FrontendCatalogModel::get($this->URL->getParameter(1));
     $this->comments = FrontendCatalogModel::getComments($this->record['id']);
     $this->specifications = FrontendCatalogModel::getProductSpecifications($this->record['id']);
     $this->tags = FrontendTagsModel::getForItem('Catalog', $this->record['id']);
     $this->settings = $this->get('fork.settings')->getForModule('Catalog');
     $this->files = FrontendCatalogModel::getFiles($this->record['id']);
     $this->videos = FrontendCatalogModel::getVideos($this->record['id']);
     $this->relatedProducts = FrontendCatalogModel::getRelatedProducts($this->record['id']);
     $this->brand = FrontendCatalogModel::getBrand($this->record['brand_id']);
     $this->record['allow_comments'] = $this->record['allow_comments'] == 'Y';
     $this->record['brand'] = $this->brand;
     $this->record['image'] = FrontendMediaHelper::getFromModule('Catalog', $this->record['id'], 0, 1, 'product');
     $this->record['images'] = FrontendMediaHelper::getFromModule('Catalog', $this->record['id'], 0, 0, 'product');
     // reset allow comments
     if (!$this->settings['allow_comments']) {
         $this->record['allow_comments'] = false;
     }
     // check if record is not empty
     if (empty($this->record)) {
         $this->redirect(FrontendNavigation::getURL(404));
     }
     //--Get all the categories
     $this->categoriesTree = FrontendCatalogModel::getCategoriesTree(0, $this->record['category_id']);
 }