/** * This function delete item / product * * @return : integer (1/0) * */ function deleteProduct() { // load model attribute /*JLoader::import('attributes', JPATH_SITE.DS.'components'.DS.'com_quick2cart'.DS.'models'); $attrmodel = new quick2cartModelAttributes(); */ $productHelper = new productHelper(); $jinput = JFactory::getApplication()->input; $item_id = $jinput->get('item_id', '', 'INTEGETR'); $res = $productHelper->deleteWholeProduct($item_id); $productHelper = new productHelper(); $productHelper->deleteNotReqProdImages($item_id, ''); if (!empty($res)) { echo 1; } else { echo 0; } jexit(); }
/** * Method to delete a row from the database table by primary key value. * * @param array $items An array of primary key value to delete. * * @return int Returns count of success */ public function delete($items) { $db = $this->getDbo(); $app = JFactory::getApplication(); $count = 0; if (is_array($items)) { foreach ($items as $id) { $productHelper = new productHelper(); $res = $productHelper->deleteWholeProduct($id); $productHelper->deleteNotReqProdImages($id, ''); if (!empty($res)) { $count++; } else { $app->enqueueMessage(JText::_('COM_QUICK2CART_MSG_ERROR_DELETE_PRODUCT'), 'error'); return 0; } } } return $count; }