public function updateProduct(DtoProduct $v) { $dto = array("code" => $v->getCode(), "name" => $v->getName(), "description" => $v->getDescription(), "size" => $v->getSize(), "unit" => $v->getUnit(), "brand" => $v->getBrand(), "price" => $v->getPrice(), "promotion" => $v->getPromotion(), "updated_by" => $v->getUpdated_by()); $this->db->set('updated_date', 'NOW()', FALSE); $this->db->set('status', TRUE); $this->db->where('id', $v->getId()); $this->db->update('products', $dto); if ($this->db->affected_rows() == 1) { return true; } else { return false; } }
public function updateProduct(DtoProduct $products) { $productID = $products->getProductid(); $this->db->trans_begin(); $product = array("categoryid" => $products->getCategoryid(), "userid" => $products->getUserid(), "seotitle" => $products->getSeotitle(), "seodescription" => $products->getSeodescription(), "thumbnailurl" => $products->getThumbnailurl(), "price" => $products->getPrice(), "recommend" => $products->getRecommend()); $this->db->where("productid", $productID); $this->db->update("PRODUCTS", $product); foreach ($products->getProductDetails() as $pro) { $pro["productid"] = $productID; $this->db->where('productid', $productID); $this->db->where('languageid', $pro['languageid']); $this->db->update("PRODUCTDETAIL", $pro); } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); return FALSE; } else { $this->db->trans_commit(); return TRUE; } }