本文整理汇总了PHP中product::update方法的典型用法代码示例。如果您正苦于以下问题:PHP product::update方法的具体用法?PHP product::update怎么用?PHP product::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::update方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: update
public function update($params = array())
{
global $db;
if (isset($params['id'])) {
$product = new product($params['id']);
}
// Save the event info to the eventregistration table
# $event = new expRecord();
# $event->tablename = 'eventregistration';
$event->eventdate = datetimecontrol::parseData('eventdate', $params);
$event->event_starttime = datetimecontrol::parseData('event_starttime', $params) + $event->eventdate;
$event->event_endtime = datetimecontrol::parseData('event_endtime', $params) + $event->eventdate;
$event->signup_cutoff = datetimecontrol::parseData('signup_cutoff', $params);
$event->id = empty($product->product_type_id) ? null : $product->product_type_id;
if (!empty($event->id)) {
$db->updateObject($event, 'eventregistration');
} else {
$event->id = $db->insertObject($event, 'eventregistration');
}
$params['product_type_id'] = $event->id;
parent::update($params);
}
示例2: header
// {
// echo 'plz, upload image type';
// }
// else if($size > 42565433)
// {
// echo 'plz, dun exceed the max limit of size';
// }
// else
// {
// echo "<img src='images/$name'/>";
// }
$products->pName = $_POST['insert_pName'];
echo $_POST['insert_pName'] . "<br/>";
$products->scID = $_POST['scNames_menu_edit'];
echo $_POST['scNames_menu_edit'] . "<br/>";
$products->pPrice = $_POST['insert_pPrice'];
echo $_POST['insert_pPrice'] . "<br/>";
$products->pQuantity = $_POST['insert_pQuantity'];
echo $_POST['insert_pQuantity'] . "<br/>";
$products->pImg = $path;
echo $path . "<br/>";
$products->pDesc = $_POST['insert_pDesc'];
echo $_POST['insert_pDesc'] . "<br/>";
echo $_POST['pID'];
$id = $products->update($_POST['pID']);
} else {
$_SESSION['errors'] = $arrErrors;
}
header("Location: adminEditProduct.php");
exit;
}
示例3: header
//if(!empty(trim($_POST['scatname']))){
if (isset($_FILES['image'])) {
$product_id = $_POST['product_id'];
echo $product_id;
$subType_id = $_POST['scatname'];
$pname = $_POST['pname'];
$desc = $_POST['desc'];
$quantity = $_POST['quantity'];
$price = $_POST['price'];
$pdate = $_POST['pdate'];
print_r($_FILES['image']);
$product_img = $_FILES['image']['tmp_name'];
$imgname = $_FILES['image']['name'];
//echo $imgname;
move_uploaded_file($product_img, "../images/items/{$imgname}");
/*$product->$name=$pname;
$product->$id=$product_id;
$product->$descr=$desc;
$product->$quantity=$quantity;
$product->$image=$imgname;
$product->$price=$price;
$product->$pdate=$pdate;*/
//$product->update($product_id);
$product->update($product_id, $pname, $desc, $quantity, $imgname, $subType_id, $price, $pdate);
header("location:addProduct.php");
}
/* }
else{
header("location:addProduct.php");
}*/
}
示例4: updateProduct
function updateProduct($product_id, $column, $value)
{
$arr = array('selector' => '#updated', 'content' => array('id' => $product_id, 'column' => $column, 'value' => $value));
$p = new product();
$p->read($product_id);
//$d->__set('valid', true);
$p->validate();
//id, attribute, value
//$column, $equiv, $value
if ($column == 'name') {
$p->update($column, 'name', $value);
} elseif ($column == 'description') {
$p->update($column, 'description', $value);
} elseif ($column == 'category_id') {
$p->update($column, 'category_id', $value);
$arr['content']['cat_id'] = $value;
$arr['source'] = 'updateProduct';
} else {
return false;
}
echo json_encode($arr);
}
示例5:
} 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';
}
?>
</div>
示例6: OrderItems
$oID = $order->insert();
if ($oID == false) {
$err = true;
}
$orderItem = new OrderItems();
foreach ($_SESSION['cart'] as $pID => $q) {
$orderItem->oID = $oID;
$orderItem->pID = $pID;
$orderItem->quantity = $q;
$orderItem->insert();
if ($orderItem == false) {
$err = true;
}
$product = new product($pID);
$product->pQuantity = $product->pQuantity - $q;
$product->update($pID);
if ($product == false) {
$err = true;
}
}
$customer->cridetLimit = $customer->cridetLimit - $_GET['total'];
$customer->update($_SESSION['user']);
if ($customer == false) {
$err = true;
}
if ($err) {
mysqli_rollback($conn);
$responce = 'error happend!!';
} else {
mysqli_commit($conn);
$responce = "done";
示例7: product
$_SESSION['errors'] = $errors;
}
if (empty(trim($_GET['quantity'])) || !ctype_digit($_GET['quantity'])) {
$errors[] = "invalid quantity";
$_SESSION['errors'] = $errors;
}
if (!empty($errors)) {
$errors[] = $_GET["id"];
} else {
$products->product_name = $_GET['name'];
$products->product_desc = $_GET['desc'];
$products->product_price = $_GET['price'];
$products->product_quantity = $_GET['quantity'];
$products->sub_cat_id = $_GET['sub'];
$products->category_id = $_GET['cat'];
$products->update();
}
$data = $products->products();
//$jsonerrors =json_encode($errors);
$response1 = [];
$response1[] = $data;
$response1[] = $errors;
$jsondata = json_encode($response1);
echo $jsondata;
//echo $jsonerrors;
} else {
if ($_GET['value'] == 'Edit') {
$products = new product($_GET['id']);
$jsondata = json_encode($products);
echo $jsondata;
}