本文整理汇总了PHP中product::setPrice方法的典型用法代码示例。如果您正苦于以下问题:PHP product::setPrice方法的具体用法?PHP product::setPrice怎么用?PHP product::setPrice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::setPrice方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getProductByGroup
public function getProductByGroup($id = NULL)
{
if ($id) {
$stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM product as p WHERE p.id_group = :id");
$stmt->bindParam(':id', $id);
} else {
$stmt = $this->pdo->PDOInstance->prepare("SELECT * FROM product as p");
}
try {
$stmt->execute();
} catch (Exception $e) {
echo "Problem at " . $e->getLine() . " from model Extraction :" . $e->getMessage();
}
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($id) {
$result_group = $this->getGroup($id);
} else {
$result_group = $this->getGroup();
}
foreach ($result as $product) {
$product_ = new product();
$product_->setId($product["id"]);
$product_->setRef($product["ref"]);
$product_->setName($product["name"]);
$product_->setDescription($product["description"]);
$product_->setCost($product["cost"]);
$product_->setPrice($product["price"]);
$product_->setUnit($product["unit"]);
$product_->setId_group($product["id_group"]);
$indice = 0;
foreach ($result_group as $group) {
if ($group->getId() == $product_->getId_group()) {
$result_group[$indice]->addProduct($product_);
}
$indice++;
}
}
return $result_group;
}
示例2:
}
// convert to bool the published box
if (isset($_REQUEST['published'])) {
$published = true;
} else {
$published = false;
}
// convert to bool the onhome box
if (isset($_REQUEST['onhome'])) {
$onhome = true;
} else {
$onhome = false;
}
$product->setContent($_REQUEST['title_1'], $_REQUEST['content_1'], $_REQUEST['title_2'], $_REQUEST['content_2'], $_REQUEST['title_3'], $_REQUEST['content_3'], $_REQUEST['title_4'], $_REQUEST['content_4'], $_REQUEST['title_5'], $_REQUEST['content_5'], $_REQUEST['title_6'], $_REQUEST['content_6'], $_REQUEST['code']);
$product->setReference($_REQUEST['reference']);
$product->setPrice($_REQUEST['price']);
$product->setVAT($_REQUEST['vat']);
$product->setDiscount($_REQUEST['discount']);
$product->setCategory($_REQUEST['category']);
$product->setDateUpdate();
$product->setService($service);
$product->setPublished($published);
$product->setonHome($onhome);
if ($product->update()) {
print 'sucess';
} else {
print 'failure';
}
}
} else {
print 'error';