本文整理汇总了PHP中Products类的典型用法代码示例。如果您正苦于以下问题:PHP Products类的具体用法?PHP Products怎么用?PHP Products使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Products类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteAction
/**
* Delete a customer record
*/
public function deleteAction()
{
$productsTable = new Products();
$product = $productsTable->find($this->_getParam('id'))->current();
!is_null($product) && $product->delete();
$this->_redirect('/products');
}
示例2: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
//$confirmation_code = str_random(30);
$data = Input::except(array('_token'));
$rule = array('custId' => 'required', 'custName' => 'required', 'custEmail' => 'required', 'prodId' => 'required', 'pname' => 'required', 'price' => 'required', 'stockUnit' => 'required', 'sales' => 'required', 'quantity' => 'required');
$validator = Validator::make($data, $rule);
if ($validator->fails()) {
return Redirect::back()->withInput()->withErrors($validator);
} else {
$newproduct = new Products();
$newproduct->prodId = Input::get('prodId');
$newproduct->pname = Input::get('pname');
$newproduct->descr = Input::get('descr');
$newproduct->location = Input::get('location');
$newproduct->purl = Input::get('purl');
$newproduct->price = Input::get('price');
$newproduct->pvat = Input::get('pvat');
$newproduct->sales = Input::get('sales');
$newproduct->svat = Input::get('svat');
$newproduct->quantity = Input::get('quantity');
$newproduct->swarn = Input::get('swarn');
$newproduct->save();
return Redirect::to('/back_end/manageProduct')->with('success', true)->with('message', 'Product Added Successfully');
}
}
示例3: getResult
public function getResult()
{
// Date in the past
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// always modified
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
// HTTP/1.1
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
// HTTP/1.0
header("Pragma: no-cache");
if (isset($_POST['process'])) {
} else {
$products = new Products();
$this->licenseData['prices2'] = $this->licenseData['prices'];
$this->licenseData['prices'] = json_encode($this->licenseData['prices']);
$this->licenseData['licenses'] = json_encode($this->licenseData['lic']);
$this->licenseData['bundle_prices'] = json_encode(isset($this->licenseData['bundle_prices']) ? $this->licenseData['bundle_prices'] : NULL);
$this->licenseData['bundle_product_prices'] = json_encode(isset($this->licenseData['bundle_product_prices']) ? $this->licenseData['bundle_product_prices'] : NULL);
$this->licenseData['offer_prices'] = json_encode($this->licenseData['offer_prices']);
// $this->licenseData['geo_currency'] = json_encode($this->licenseData['geo_currency']);
$this->licenseData['products'] = $products->getProductsShort(TRUE, FALSE, 3);
$this->licenseData['product_versions'] = $products->getProductMajorVersions($this->productId);
$this->licenseData['product'] = $products->getProductById($this->productId);
$this->licenseData['currencies'] = json_encode($this->licenseData['currencies']);
return $this->licenseData;
}
}
示例4: product_log
function product_log($id, $status, $bean, $status_action, $old_status)
{
$productLog = new ProductLog();
$product = new Products();
$product->retrieve($id);
if ($old_status != $status || empty($product->date_modified)) {
$productLog->product_name = $product->name;
$productLog->product_id = $product->id;
$productLog->from_status = $old_status;
$product->status = $status;
$product->save($GLOBALS['check_notify']);
$productLog->to_status = $product->status;
var_dump($productLog->object_name);
var_dump($productLog->object_id);
$productLog->bean_name = $bean->object_name;
$productLog->bean_id = $bean->id;
var_dump($productLog->object_name);
var_dump($productLog->object_id);
var_dump($bean->object_name);
var_dump($bean->object_id);
$productLog->action = $status_action;
if (!empty($_REQUEST['status_action'])) {
$productLog->action = $_REQUEST['status_action'];
}
$productLog->save($GLOBALS['check_notify']);
}
}
示例5: testMany
public function testMany()
{
$this->_mock = new Mock_Database($this, array(array('many', "SELECT products.*\nFROM products", array(), null, array('return' => array(array('id' => 1), array('id' => 2)))), array('many', "SELECT products_options.*\nFROM products_options\nWHERE `product_id` IN (?, ?)", array(1, 2), null, array('return' => array(array('id' => 3, 'product_id' => 1), array('id' => 4, 'product_id' => 2))))));
\Snowfire\Database\Model::database($this->_mock);
$prod_model = new Products();
$opt_model = new Products_Options();
$this->assertEquals(array(array('id' => 1, 'options' => array(array('id' => 3, 'product_id' => 1))), array('id' => 2, 'options' => array(array('id' => 4, 'product_id' => 2)))), $prod_model->many(array('foreign_models' => array('options' => $opt_model))));
}
示例6: exportAll
/**
*Export all orders,
*customers, product into a xml file
*
*/
public static function exportAll()
{
// create the xml customer file
$customers = new Customers();
$theCustomers = $customers->bulk_xml();
// create the xml product
$products = new Products();
$theCustomers = $products->bulk_xml();
}
示例7: testObject
public function testObject()
{
$product = new Product();
$product->setTitle('title');
$product->setSize('10k');
$product->setUnitPrice('10');
$product->setDescription('description');
$products = new Products();
$products->add($product);
$this->assertArrayHasKey('total', $products->getItems());
}
示例8: createUserInterface
/**
* @see ApplicationView::createUserInterface()
*/
protected function createUserInterface()
{
parent::createUserInterface();
$this->addStyle('/css/home.css');
$resourceBundle = Application::getInstance()->getBundle();
$products = $this->products->getProducts();
if (count($products) == 0) {
$this->contentPanel->addChild(new Heading(2))->addChild(new Text($resourceBundle->getString('NO_PRODUCT')));
} else {
$this->contentPanel->addChild(new ProductList())->setProductList($products);
}
}
示例9: get
public function get($productid)
{
$this->authenticate();
if (empty($productid)) {
throw new Shineisp_Api_Exceptions(400002, ":: 'productid' field");
exit;
}
$product = new Products();
$details = $product->getAllInfo($productid);
$details['ProductsUpgrades'] = ProductsUpgrades::getItemsbyProductID($productid);
return $details;
}
示例10: GetWaitingList
public function GetWaitingList($id_user)
{
$sql = "SELECT wl.id_product, p.art, p.name, p.translit , p.img_1,\r\n\t\t\tp.price_opt, p.price_mopt, p.old_price_opt, p.visible\r\n\t\t\tFROM " . _DB_PREFIX_ . "waiting_list AS wl\r\n\t\t\tLEFT JOIN " . _DB_PREFIX_ . "product AS p\r\n\t\t\t\tON wl.id_product = p.id_product\r\n\t\t\tWHERE wl.id_user = '" . $id_user . "'\r\n\t\t\tORDER BY wl.id_product";
if (!($arr = $this->db->GetArray($sql))) {
return false;
}
foreach ($arr as &$value) {
$Products = new Products();
$value['images'] = $Products->GetPhotoById($value['id_product']);
}
return $arr;
}
示例11: findProductCoalesced
/**
* @param int $customerId
* @param int $productId
*/
public function findProductCoalesced($customerId, $productId)
{
$productsTable = new Products();
$p = $productsTable->find($productId)->current();
$cp = $this->find($productId, $customerId)->current();
if ($cp) {
$productCoalesced = array('product_id' => $cp->product_id, 'sku' => $cp->sku ?: $p->sku, 'name' => $cp->name ?: $p->name, 'description' => $cp->description ?: $p->description, 'unit_price' => $cp->unit_price ?: $p->unit_price);
} else {
$productCoalesced = array('product_id' => $p->product_id, 'sku' => $p->sku, 'name' => $p->name, 'description' => $p->description, 'unit_price' => $p->unit_price);
}
return $productCoalesced;
}
示例12: init
public function init()
{
// Set the custom decorator
$this->addElementPrefixPath('Shineisp_Decorator', 'Shineisp/Decorator/', 'decorator');
$translate = Shineisp_Registry::get('Zend_Translate');
$this->addElement('text', 'quantity', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Quantity'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'setupfee', array('filters' => array('StringTrim'), 'label' => $translate->_('Setup fees'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'discount', array('filters' => array('StringTrim'), 'label' => $translate->_('Discount'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('text', 'cost', array('filters' => array('StringTrim'), 'label' => $translate->_('Cost'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('select', 'product_id', array('filters' => array('StringTrim'), 'required' => false, 'label' => $translate->_('Products'), 'class' => 'form-control'));
$this->getElement('product_id')->setAllowEmpty(false)->setMultiOptions(Products::getList(true));
$this->addElement('text', 'price', array('filters' => array('StringTrim'), 'required' => true, 'label' => $translate->_('Price'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->addElement('select', 'billing_cycle_id', array('label' => $translate->_('Billing Cycle'), 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('billing_cycle_id')->setAllowEmpty(false)->setMultiOptions(BillingCycle::getList(true));
$this->addElement('text', 'date_start', array('filters' => array('StringTrim'), 'label' => $translate->_('Start Date'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
$this->addElement('text', 'date_end', array('filters' => array('StringTrim'), 'label' => $translate->_('Expiry Date'), 'decorators' => array('Bootstrap'), 'class' => 'form-control date', 'dateformat' => Settings::getJsDateFormat()));
$this->addElement('textarea', 'description', array('filters' => array('StringTrim'), 'label' => $translate->_('Description'), 'decorators' => array('Bootstrap'), 'rows' => 5, 'class' => 'form-control'));
$this->addElement('textarea', 'parameters', array('filters' => array('StringTrim'), 'label' => $translate->_('Service Panel Configuration'), 'decorators' => array('Bootstrap'), 'rows' => 5, 'description' => $translate->_('Parameters model accepted: {"domain":{"name":"domain.com","tld":"2","action":"renewDomain","authcode":null}}'), 'class' => 'form-control'));
$this->addElement('select', 'status_id', array('label' => $translate->_('Status'), 'required' => true, 'decorators' => array('Bootstrap'), 'class' => 'form-control'));
$this->getElement('status_id')->setAllowEmpty(false)->setMultiOptions(Statuses::getList('orders'));
$this->addElement('select', 'autorenew', array('decorators' => array('Bootstrap'), 'label' => $translate->_('Auto Renewal'), 'class' => 'form-control', 'multioptions' => array(0 => 'NO', 1 => 'YES')));
$this->addElement('multiselect', 'domains', array('label' => $translate->_('Available Domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control tmpitems'));
$this->getElement('domains')->setAllowEmpty(false)->setRegisterInArrayValidator(false)->setMultiOptions(Domains::getList());
$this->addElement('multiselect', 'domains_selected', array('label' => $translate->_('Selected domains'), 'decorators' => array('Bootstrap'), 'class' => 'form-control items'));
$this->getElement('domains_selected')->setRegisterInArrayValidator(false);
// Disable the Validator in order to manage a dynamic list.
$this->addElement('hidden', 'detail_id');
}
示例13: productsAction
/**
* compareAction
* Compare the services between themselves
*/
public function productsAction()
{
$code = $this->getRequest()->getParam('code');
if ($code) {
// Get all the data from the database
$data = Products::GetProductsByGroupCode($code);
}
if (!empty($data['products'][0]['ProductsAttributesGroups']['name'])) {
$this->view->headTitle()->prepend($this->translator->_("Compare %s", $data['products'][0]['ProductsAttributesGroups']['name']));
$this->view->title = $data['products'][0]['ProductsAttributesGroups']['name'];
} else {
$this->view->title = $code;
}
// Check the existence of the mandatories attributes
if (!empty($data['attributes'][0])) {
$this->view->attributes = $data['attributes'];
}
// Check if there are values set for the group of the product selected
if (!empty($data['attributes_values'][0])) {
$this->view->values = $data['attributes_values'];
}
// Get the products
if (!empty($data['products'][0])) {
$this->view->products = $data['products'];
}
// Render the page
$this->_helper->viewRenderer('index');
}
示例14: searchAction
public function searchAction()
{
$numberPage = 1;
if ($this->request->isPost()) {
$query = Criteria::fromInput($this->di, "Products", $_POST);
$this->persistent->searchParams = $query->getParams();
} else {
$numberPage = $this->request->getQuery("page", "int");
if ($numberPage <= 0) {
$numberPage = 1;
}
}
$parameters = array();
if ($this->persistent->searchParams) {
$parameters = $this->persistent->searchParams;
}
$products = Products::find($parameters);
if (count($products) == 0) {
$this->flash->notice("没找到任何类型");
return $this->forward("products/index");
}
$paginator = new Phalcon\Paginator\Adapter\Model(array("data" => $products, "limit" => 5, "page" => $numberPage));
$page = $paginator->getPaginate();
$this->view->setVar("page", $page);
}
示例15: Show
public function Show($parameters)
{
$output = "";
$ns = new Zend_Session_Namespace();
$languageID = Languages::get_language_id($ns->lang);
$mainviewhelper = new Zend_View();
$mainviewhelper->addBasePath(APPLICATION_PATH . '/modules/default/views/');
$view = new Zend_View();
$view->addScriptPath('../library/Shineisp/Custom/views');
$translator = Shineisp_Registry::getInstance()->Zend_Translate;
if (!empty($parameters['code'])) {
$code = $parameters['code'];
} else {
return "";
}
// Get the products
$data = Products::GetProductsByGroupCode($code, $languageID);
// Check the existence of the mandatories attributes
if (!empty($data['attributes'][0])) {
$view->attributes = $data['attributes'];
}
// Check if there are values set for the group of the product selected
if (!empty($data['attributes_values'][0])) {
$view->values = $data['attributes_values'];
}
// Get the products
if (!empty($data['products'][0])) {
$view->products = $data['products'];
}
$view->mainviewhelper = $mainviewhelper;
// Path of the template
return $view->render('productsattributes.phtml');
}