} if (isset($_POST['checkin_product']) && !empty($_POST['id'])) { $result = $product->checkProducts($_POST['id'], 1); } if (isset($_POST['checkout_product']) && !empty($_POST['id'])) { $result = $product->checkProducts($_POST['id'], 2); } if (isset($_POST['del'])) { $deleted = false; foreach ($_POST['id'] as $val) { $picture = $product->field("picture", "id=" . $val); @unlink($media_paths['attachment_dir'] . $picture); @unlink($media_paths['attachment_dir'] . $picture . ".small.jpg"); } if (is_array($_POST['id'])) { $deleted = $product->del($_POST['id']); if (!$deleted) { flash(); } } } if (isset($_GET['do'])) { $do = trim($_GET['do']); if (!empty($_GET['id'])) { $id = intval($_GET['id']); } if ($do == "edit") { if (!empty($id)) { $res = $product->getInfo($id); if (!empty($res['picture'])) { $res['image'] = pb_get_attachmenturl($res['picture'], '../', 'small');
/** * delete the products selected * @param array * @return Boolean */ public static function massdelete($ids) { foreach ($ids as $id) { Products::del($id); } return true; }
/** * * Delete a record previously selected by the product */ public function deleteAction() { $this->view->headTitle()->append($this->translator->translate("Delete product")); $id = $this->getRequest()->getParam('id'); try { if (is_numeric($id)) { if (Products::del($id)) { $this->_helper->redirector('list', 'products', 'admin', array('mex' => 'The task requested has been executed successfully.', 'status' => 'success')); } else { $this->_helper->redirector('list', 'products', 'admin', array('mex' => 'The product is locked by a order', 'status' => 'danger')); } } } catch (Exception $e) { $this->_helper->redirector('list', 'products', 'admin', array('mex' => $e->getMessage(), 'status' => 'danger')); } }
break; } if (!empty($id)) { $vals['state'] = $state; $updated = $pdb->Execute("UPDATE {$tb_prefix}products SET state={$state} WHERE id={$id} AND member_id={$the_memberid}"); if (!$updated) { flash(); } } else { flash(); } } if (($do == "del" || $_GET['act'] == "del") && !empty($id)) { $res = $product->read("id", $id); if ($res) { if (!$product->del($_GET['id'], $conditions)) { flash(); } } else { flash("data_not_exists"); } } } if (isset($_GET['typeid']) && !empty($_GET['typeid'])) { $conditions[] = "producttype_id = " . $_GET['typeid']; } $amount = $product->findCount(null, $conditions, "Product.id"); $page->setPagenav($amount); $result = $product->findAll("sort_id,id,name,picture,content,created,status,state", null, $conditions, "Product.id DESC", $page->firstcount, $page->displaypg); if ($result) { $i_count = count($result);
break; } if (!empty($id)) { $vals['state'] = $state; $updated = $pdb->Execute("UPDATE {$tb_prefix}products SET state={$state} WHERE id={$id} AND member_id={$the_memberid}"); if (!$updated) { flash(); } } else { flash(); } } if (($do == "del" || $_GET['act'] == "del") && !empty($id)) { $res = $product->read("id", $id); if ($res) { if (!$product->del($id, $conditions)) { flash(); } } else { flash("data_not_exists"); } } } if (isset($_GET['typeid']) && !empty($_GET['typeid'])) { $conditions[] = "type_id = '" . intval($_GET['typeid']) . "'"; } $amount = $product->findCount(null, $conditions, "Product.id"); $page->setPagenav($amount); $result = $product->findAll("sort_id,id,name,picture,content,created,status,state", null, $conditions, "Product.id DESC", $page->firstcount, $page->displaypg); if ($result) { $i_count = count($result);