/** * Get the data */ protected function getData() { $this->product = BackendCatalogModel::get($this->getParameter('product_id', 'int')); $this->file = BackendCatalogModel::getFile($this->getParameter('id', 'int')); $this->file['data'] = unserialize($this->record['data']); $this->file['link'] = $this->record['data']['link']; }
/** * Load the item data */ protected function loadData() { $this->id = $this->getParameter('product_id', 'int', null); if ($this->id != null) { $this->record = BackendCatalogModel::get($this->id); } // get categories $this->categories = BackendCatalogModel::getCategories(true); // Get all products grouped by categories $this->allProductsGroupedByCategories = BackendCatalogModel::getAllProductsGroupedByCategories(); // get specifications $this->specifications = BackendCatalogModel::getSpecifications(); // get brands $this->brands = BackendCatalogModel::getBrandsForDropdown(); }
/** * Execute the action */ public function execute() { $this->id = $this->getParameter('id', 'int'); // does the item exist if ($this->id !== null && BackendCatalogModel::exists($this->id)) { parent::execute(); $this->record = BackendCatalogModel::get($this->id); // clean the tags BackendTagsModel::saveTags($this->id, '', $this->URL->getModule()); // clean the related products BackendCatalogModel::saveRelatedProducts($this->id, array()); // delete record BackendCatalogModel::delete($this->id); // delete search indexes BackendSearchModel::removeIndex($this->getModule(), $this->id); BackendModel::triggerEvent($this->getModule(), 'after_delete', array('id' => $this->id)); $this->redirect(BackendModel::createURLForAction('index') . '&report=deleted&var=' . urlencode($this->record['title'])); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
/** * Get the necessary data */ private function getData() { $this->product = BackendCatalogModel::get($this->getParameter('product_id', 'int')); }
/** * Load the item data */ protected function loadData() { $this->id = $this->getParameter('id', 'int', null); if ($this->id == null || !BackendCatalogModel::exists($this->id)) { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } $this->record = BackendCatalogModel::get($this->id); $this->categories = (array) BackendCatalogModel::getCategories(true); $this->products = (array) BackendCatalogModel::getAll(); $this->allProductsGroupedByCategories = (array) BackendCatalogModel::getAllProductsGroupedByCategories(); $this->relatedProducts = (array) BackendCatalogModel::getRelatedProducts($this->id); $this->specifications = (array) BackendCatalogModel::getSpecifications(); // get brands $this->brands = BackendCatalogModel::getBrandsForDropdown(); }
/** * Gets all necessary data */ protected function getData() { $this->product = BackendCatalogModel::get($this->id); }