本文整理汇总了PHP中product类的典型用法代码示例。如果您正苦于以下问题:PHP product类的具体用法?PHP product怎么用?PHP product使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了product类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getData
function getData()
{
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
//load visitedProduct
//load userinfo bar
$output['visitedProduct'] = $this->getVisitedProduct();
$output['userInfo'] = $this->getUserInfo();
//load product comment and add product to visited list
$productId = $this->input->post('productId');
if ($productId != 0) {
$output['productComment'] = $this->getProductComment($productId);
$this->addProductCookie($productId);
}
//load compare product
$compareCookie = $this->input->cookie('compareProduct');
$compareArray = explode(",", $compareCookie);
array_push($compareArray, 0);
$compareProduct = new product();
$compareProduct->where_in('id', $compareArray);
$compareProduct->get_iterated();
$this->compareProduct = $compareProduct;
$this->compareArray = $compareArray;
$dis['base_url'] = base_url();
$output['compareProduct'] = $this->load->view('front/includes/compareProductSmall', $dis, true);
$output['compareArray'] = $compareArray;
//get number of cart item
$output['numCart'] = $this->countCartItem();
$this->output->set_header('Content-type: application/json');
$this->output->set_output(json_encode($output));
} else {
show_404();
}
}
示例2: check_reorder_level
public function check_reorder_level()
{
global $db;
global $auth_session;
$domain_id = domain_id::get($this->domain_id);
//sellect qty and reorder level
$inventory = new product();
$sth = $inventory->select_all('count');
$inventory_all = $sth->fetchAll(PDO::FETCH_ASSOC);
$email = "";
foreach ($inventory_all as $row) {
if ($row['quantity'] <= $row['reorder_level']) {
$message = "The quantity of Product: " . $row['description'] . " is " . siLocal::number($row['quantity']) . ", which is equal to or below its reorder level of " . $row['reorder_level'];
$return['row_' . $row['id']]['message'] = $message;
$email_message .= $message . "<br />\n";
}
}
//print_r($return);
#$attachment = file_get_contents('./tmp/cache/' . $pdf_file_name);
$email = new email();
$email->notes = $email_message;
$email->from = $email->get_admin_email();
$email->to = $email->get_admin_email();
#$email -> bcc = "justin@localhost";
$email->subject = "Simple Invoices reorder level email";
$email->send();
return $return;
}
示例3: insert_product_warehouse
public function insert_product_warehouse($form)
{
$data = array();
$data['product_id'] = $form['product_id'];
$data['warehouse_cost'] = $form['product_cost'];
$data['warehouse_price'] = $form['product_price'];
$data['warehouse_quantity'] = $form['product_quantity'];
$data['warehouse_barcode'] = $form['product_barcode'];
$data['warehouse_qtytype'] = $form['p_qtytype'];
$data['warehouse_sp_bill'] = $form['sup_bill'];
$this->insert($this->table_name, $data);
$accounts = new accounts();
$products = new product();
// Create GL
$amount = $form['product_cost'] * $products->generate_item_quantity($form['product_id'], $form['p_qtytype'], $form['product_quantity']);
$type = 'debit';
$account = 'Purchase';
$account_type = 'Stock';
$date = $accounts->_date('Y-m-d H:i:s', date('d-m-Y'));
$results = $accounts->create_general_ledger($amount, $type, $account, $account_type, $date);
// Purchase
$product = $form['product_id'];
$cost = $form['product_cost'];
$quantity = $products->generate_item_quantity($form['product_id'], $form['p_qtytype'], $form['product_quantity']);
$date = $date;
$account = 'purchase';
$account_type = 'stock';
$results = $accounts->create_purchase($product, $cost, $quantity, $date, $account, $account_type);
return $this->row_count();
}
示例4: transform
/**
* Transforms an object (product) to a string (number).
*
* @param product|null $product
* @return string
*/
public function transform($product)
{
if (null === $product) {
return '';
}
return $product->getId();
}
示例5: deleteProduct_Action
function deleteProduct_Action()
{
$product_id = $_GET['product_id'];
$list_url = 'http://' . HOST . '/' . APPLICATION . '/index.php?page=home';
$product = new product();
$result = $product->deleteProduct($product_id);
header("Location: {$list_url}");
}
示例6: store
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
{
//dd($request);
$product = new product();
$product->name = $request->name;
$product->price = $request->price;
$product->save();
return redirect()->route('product.index');
}
示例7: getReviewsUrl
/**
* Rewriting this method to output new urls.
* Checks if a rewrite already exists, otherwise creates it.
*
* @param product $product
* @param category $category
* @param array $params
*/
public function getReviewsUrl($product, $category = null, $params = array())
{
$routePath = '';
$routeParams = $params;
$storeId = $product->getStoreId();
if (!$storeId) {
$storeId = Mage::app()->getStore()->getId();
$product->setStoreId($storeId);
}
$categoryId = $product->getCategoryId() && !$product->getDoNotUseCategoryId() ? $product->getCategoryId() : null;
$idPath = sprintf('reviews/%d', $product->getId());
//if ($categoryId) {
// $idPath = sprintf('%s/%d', $idPath, $categoryId);
//}
$rewrite = $this->getUrlRewrite();
$rewrite->setStoreId($storeId)->loadByIdPath($idPath);
$oldRequestPath = $product->getRequestPath();
if ($rewrite->getId()) {
// REWRITE RULE EXISTS
$requestPath = $rewrite->getRequestPath();
$product->setRequestPath($requestPath);
} else {
// CREATE REWRITE RULE
$model = Mage::getModel('reviewsearchfriendlyurls/url');
$requestPath = $model->addUrlRewrite($product);
}
if (isset($routeParams['_store'])) {
$storeId = Mage::app()->getStore($routeParams['_store'])->getId();
}
if ($storeId != Mage::app()->getStore()->getId()) {
$routeParams['_store_to_url'] = true;
}
if (!empty($requestPath)) {
$routeParams['_direct'] = $requestPath;
} else {
$routePath = 'catalog/product/view';
$routeParams['id'] = $product->getId();
$routeParams['s'] = $product->getUrlKey();
//if ($categoryId) {
// $routeParams['category'] = $categoryId;
//}
}
// reset cached URL instance GET query params
if (!isset($routeParams['_query'])) {
$routeParams['_query'] = array();
}
$url = $this->getUrlInstance()->setStore($storeId)->getUrl($routePath, $routeParams);
$product->setRequestPath($oldRequestPath);
return $url;
}
示例8: bill_checkout
function bill_checkout($amount, $invoice, $currency_iso, $acct_fields, $total_recurring = false, $recurr_bill_arr = false)
{
# Validate the currency:
if (!$this->validate_currency($currency_iso)) {
return false;
}
# Special JPY formatting:
if ($currency_iso == 'JPY') {
$amount = round($amount);
}
# Get the regular period for this subscription:
$sched = $recurr_bill_arr[0]["recurr_schedule"];
if ($sched == 0) {
$p3 = '1';
$t3 = 'W';
} elseif ($sched == 1) {
$p3 = '1';
$t3 = 'M';
} elseif ($sched == 2) {
$p3 = '3';
$t3 = 'M';
} elseif ($sched == 3) {
$p3 = '6';
$t3 = 'M';
} elseif ($sched == 4) {
$p3 = '1';
$t3 = 'Y';
} elseif ($sched == 5) {
$p3 = '2';
$t3 = 'Y';
}
$url = "https://www.paypal.com/cgi-bin/webscr";
# Get the next bill date for this subscription:
if ($recurr_bill_arr[0]["recurr_type"] == "1") {
# Pro-rate billing:
include_once PATH_MODULES . 'product/product.inc.php';
$product = new product();
$arr = $product->recurrDates($recurr_bill_arr[0]["recurr_schedule"], $recurr_bill_arr[0]["recurr_weekday"], $recurr_bill_arr[0]["recurr_week"]);
$remain_time = $arr['end'] - time();
$period1 = round($remain_time / 86400);
$subscr_date = date("Y-m-d", $arr["end"]);
$vals = array(array('cmd', '_xclick-subscriptions'), array('bn', 'Agileco.AgileBill'), array('business', $this->cfg['email']), array('item_name', "Invoice No:" . $invoice), array('return', $this->success_url . $invoice), array('cancel_return', $this->decline_url . $invoice), array('notify_url', $this->return_url), array('currency_code', $currency_iso), array('invoice', $invoice), array('first_name', $acct_fields['first_name']), array('last_name', $acct_fields['last_name']), array('payer_business_name', $acct_fields['company']), array('address_street', $acct_fields['address1']), array('address_city', $acct_fields['city']), array('address_state', $acct_fields['state']), array('address_zip', $acct_fields['zip']), array('address_country', $acct_fields['country_id']), array('payer_email', $acct_fields['email']), array('payer_id', $acct_fields['id']), array('txn_type', 'subscr_signup'), array('a1', $amount), array('p1', $period1), array('t1', 'D'), array('a3', $total_recurring), array('p3', $p3), array('t3', $t3), array('src', "1"), array('sra', "1"));
} else {
# Bill on anniversary:
$vals = array(array('cmd', '_xclick-subscriptions'), array('business', $this->cfg['email']), array('item_name', "Invoice No:" . $invoice), array('return', $this->success_url . $invoice), array('cancel_return', $this->decline_url . $invoice), array('notify_url', $this->return_url), array('currency_code', $currency_iso), array('invoice', $invoice), array('first_name', $acct_fields['first_name']), array('last_name', $acct_fields['last_name']), array('payer_business_name', $acct_fields['company']), array('address_street', $acct_fields['address1']), array('address_city', $acct_fields['city']), array('address_state', $acct_fields['state']), array('address_zip', $acct_fields['zip']), array('address_country', $acct_fields['country_id']), array('payer_email', $acct_fields['email']), array('payer_id', $acct_fields['id']), array('txn_type', 'subscr_signup'), array('a1', $amount), array('p1', $p3), array('t1', $t3), array('a3', $total_recurring), array('p3', $p3), array('t3', $t3), array('src', "1"), array('sra', "1"));
}
$this->post_vars($url, $vals);
return true;
}
示例9: __construct
public function __construct($pID = -1)
{
if (is_null(self::$conn)) {
self::$conn = mysqli_connect('localhost', 'root', 'iti', 'eShop');
}
if ($pID != -1) {
$query = "select * from products where pID={$pID} ";
$result = mysqli_query(self::$conn, $query);
// if(mysqli_num_rows($result)>0)
// {
$product = mysqli_fetch_assoc($result);
$this->pID = $product['pID'];
$this->pName = $product['pName'];
$this->pPrice = $product['pPrice'];
$this->pQuantity = $product['pQuantity'];
$this->pImg = $product['pImg'];
$this->pDesc = $product['pDesc'];
$this->scID = $product['scID'];
// }
// else
// }
// return 'undefined';
// }
}
}
示例10: get_products
public function get_products()
{
$result = array();
$query = 'SELECT Id, Unitprice, Pricebook2.Id, Pricebook2.Name, ' . product::get_sf_fields() . ', LastModifiedDate FROM PricebookEntry WHERE Product2.Data_Source__c = \'New Records Salesforce\' AND LastModifiedDate > ' . utcDateFormat(time() + 7200);
$response = $this->conn->query($query);
foreach ($response->records as $record) {
if (!isset($result[$record->Product2->Id])) {
$result[$record->Product2->Id] = $record->Product2;
}
$key = 'Standard';
switch ($record->Pricebook2->Name) {
case 'Price Book 1':
$key = 'PRICE1';
break;
case 'Price Book 2':
$key = 'PRICE2';
break;
case 'Price Book 3':
$key = 'PRICE3';
break;
}
$result[$record->Product2->Id]->{$key} = $record->UnitPrice;
$result[$record->Product2->Id]->LastModifiedDate = $record->LastModifiedDate;
}
return $result;
}
示例11: install
static function install()
{
$db = Database::instance();
$db->query("CREATE TABLE IF NOT EXISTS {products} (\n `id` int(9) NOT NULL auto_increment,\n `name` TEXT NOT NULL,\n `cost` INTEGER(9) default 0,\n `description` varchar(1024),\n PRIMARY KEY (`id`))\n ENGINE=InnoDB DEFAULT CHARSET=utf8;");
product::create("4x6", 5, "4\"x6\" print");
product::create("8x10", 25, "8\"x10\" print");
product::create("8x12", 30, "8\"x12\" print");
module::set_version("basket", 1);
}
示例12: photo_top
static function photo_top($theme)
{
if (product::isForSale($theme->item()->id)) {
$view = new View("add_to_basket.html");
$view->item = $theme->item();
return $view->render();
}
return "";
}
示例13: productsList
function productsList()
{
$page = new page();
$prod = new product();
if (isset($_GET['sort'])) {
if ($_GET['sort'] == "ASC") {
$sort = "DESC";
} else {
$sort = "ASC";
}
} else {
$sort = "";
}
$params = array();
$params = $page->setProductsParams();
$products = $prod->getList($params, $sort);
$page->displayProducts($products, $params, $sort);
}
示例14: show_productSale_new
function show_productSale_new($template)
{
global $TPL;
global $productSaleItemsDoExist;
global $productSaleID;
$taxName = config::get_config_item("taxName");
$productSaleItem = new productSaleItem();
$productSaleItem->set_values();
// wipe clean
$product = new product();
$ops = $product->get_assoc_array("productID", "productName");
$TPL["productList_dropdown"] = page::select_options($ops, $productSaleItem->get_value("productID"));
$productSaleItemsDoExist and $TPL["display"] = "display:none";
if ($taxName) {
$TPL["sellPriceTax_check"] = sprintf(" <input type='checkbox' name='sellPriceIncTax[]' value='1'%s> inc %s", $productSaleItem->get_value("sellPriceIncTax") ? ' checked' : '', $taxName);
}
$TPL["psid"] = $productSaleID;
// poorly named template variable to prevent clobbering
include_template($template);
}
示例15: detail
public function detail()
{
//get expenseaccount
$expenseaccountobj = new expenseaccount();
$detail['expense_account_all'] = $expenseaccountobj->get_all();
//get customers with domain_id from session by constructor
$customerobj = new customer();
$detail['customer'] = $customerobj->get();
$detail['customer_all'] = $customerobj->get_all();
//get billers with domain_id from session by constructor
$billerobj = new biller();
$detail['biller_all'] = $billerobj->get_all();
//get invoices
$invoiceobj = new invoice();
$detail['invoice_all'] = $invoiceobj->get_all();
//get products
$productobj = new product();
$detail['product_all'] = $productobj->get_all();
return $detail;
}