本文整理汇总了PHP中product::addProduct方法的典型用法代码示例。如果您正苦于以下问题:PHP product::addProduct方法的具体用法?PHP product::addProduct怎么用?PHP product::addProduct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类product
的用法示例。
在下文中一共展示了product::addProduct方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
function add()
{
$pid = $_REQUEST["pid"];
$pname = $_REQUEST["pname"];
$price = $_REQUEST["price"];
$qty = $_REQUEST["qty"];
include "product.php";
$obj = new product();
if ($obj->addProduct($pid, $pname, $price, $qty)) {
echo '{"result":1}';
} else {
echo "{'result':0}";
}
}
示例2: addproduct_action
function addproduct_action()
{
$name = $_POST['name'];
$type = $_POST['type'];
$price = $_POST['price'];
$product = new product($name, $type, $price);
$result = $product->addProduct();
$list_url = 'http://' . HOST . '/' . APPLICATION . '/index.php?page=home';
$add_url = 'http://' . HOST . '/' . APPLICATION . '/index.php?page=addProduct';
if ($result) {
header("Location: {$list_url}");
} else {
header("Location: {$add_url}");
}
}
示例3: product
<?php
include '../product.php';
$productAction = new product();
$scatID = $_POST['scat'];
$productAction->addProduct($scatID);
header("location:addProduct.php");
示例4: elseif
$smarty->assign('content', $smarty->fetch('additem.tpl'));
} elseif (isset($_GET['action']) && $_GET['action'] == 'edit') {
$id = $_GET['id'];
$producted = $product->getProduct($id);
$smarty->assign('product', $producted);
$smarty->assign('content', $smarty->fetch('edititem.tpl'));
} elseif (isset($_POST['action']) && $_POST['action'] == 'add') {
$file = $_FILES;
$data = $_POST['data']['Item'];
$data['image'] = $file['name'];
if ($product->checkProduct($data)) {
$_SESSION['message'] = 'Product with catalog no already exist. Please search with product sku and update details.';
header('Location: ' . FRONTEND . 'inventory.php');
exit;
} else {
if ($product->addProduct($data)) {
header('Location: ' . FRONTEND . 'inventory.php');
exit;
}
}
} elseif (isset($_POST['action']) && $_POST['action'] == 'update') {
$file = $_FILES;
$data = $_POST['data']['Item'];
if (isset($file['name'])) {
$data['image'] = $file['name'];
} else {
$data['image'] = '';
}
if ($product->updateProduct($data)) {
$_SESSION['message'] = 'Product has been updated successfully.';
header('Location: ' . FRONTEND . 'inventory.php');