diff --git a/module/product/model.php b/module/product/model.php index a87342024c..e20ae23e86 100644 --- a/module/product/model.php +++ b/module/product/model.php @@ -893,6 +893,25 @@ class productModel extends model if(!dao::isError()) return common::createChanges($oldProduct, $product); } + /** + * Activate a product. + * + * @param int $productID. + * @access public + * @return bool | array + */ + public function activate($productID) + { + $oldProduct = $this->getById($productID); + $product = (object)array('status' => 'normal'); + + $this->dao->update(TABLE_PRODUCT)->data($product)->where('id')->eq((int)$productID)->exec(); + + if(dao::isError()) return false; + + return common::createChanges($oldProduct, $product); + } + /** * Manage line. *