/** * 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'); } }