예제 #1
0
 function handleDeleteProduct($id)
 {
     ProductModel::delete($id);
     $this->flashMessage(_('Produkt bol zmazaný'));
     if ($this->isAjax()) {
         $this->invalidateControl('productTabella');
     } else {
         $this->redirect('this');
     }
 }
예제 #2
0
 public function DeleteAction()
 {
     $id = intval(Request::GetPart(3));
     $product = ProductModel::GetObj()->where('id = ? AND company_id = ?', [0 => $id, 1 => $this->company->id]);
     if ($product->id > 0) {
         ProductModel::delete()->id($product->id);
     }
     if ($product->pic != '') {
         if (file_exists(ROOT . '/web/files/' . $product->pic)) {
             unlink(ROOT . '/web/files/' . $product->pic);
         }
         if (file_exists(ROOT . '/web/files/s_' . $product->pic)) {
             unlink(ROOT . '/web/files/s_' . $product->pic);
         }
     }
     Site::Message('Продукт успешно удалён');
     $this->route('profile');
 }
예제 #3
0
 protected static function actionDelete()
 {
     $product = new ProductModel($_GET['id']);
     $product->delete();
     self::redirect(App::getLink('AdminProducts'));
 }
예제 #4
0
 function handleDelete($id)
 {
     ProductModel::delete($id);
 }