/** * Execute the action */ public function execute() { $this->id = $this->getParameter('product_id', 'int'); if ($this->id !== null && BackendCatalogModel::exists($this->id)) { parent::execute(); $this->getData(); $this->loadForm(); $this->validateForm(); $this->parse(); $this->display(); } else { $this->redirect(BackendModel::createURLForAction('index') . '&error=non-existing'); } }
public function execute() { parent::execute(); // get parameters $newIdSequence = trim(\SpoonFilter::getPostValue('new_id_sequence', null, '', 'string')); // list id $ids = (array) explode(',', rtrim($newIdSequence, ',')); // loop id's and set new sequence foreach ($ids as $i => $id) { $item['id'] = $id; $item['sequence'] = $i + 1; // update sequence if (BackendCatalogModel::exists($id)) { BackendCatalogModel::update($item); } } // success output $this->output(self::OK, null, 'sequence updated'); }
/** * 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'); } }
/** * 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(); }