• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Product类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Product的典型用法代码示例。如果您正苦于以下问题:PHP Product类的具体用法?PHP Product怎么用?PHP Product使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Product类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: setProduct

 /**
  * The setter of the field product_id.
  * @param Product $product - the product related to the issue
  */
 public function setProduct(Product $product)
 {
     if ($product == NULL) {
         throw new InvalidArgumentException('[Model\\Issue] Invalid Model\\Product.');
     }
     $this->product_id = $product->getProductId();
 }
开发者ID:kelliany,项目名称:TestZilla,代码行数:11,代码来源:Issue.php


示例2: productMultiDialog

 function productMultiDialog($productId = 0)
 {
     $chooseProduct = new Product($productId);
     $product = new Product();
     $dis['searchKey'] = "";
     $dis['searchProductCat'] = "";
     $dis['searchProductCatId'] = "";
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $searchKey = $this->input->post('searchName');
         $searchProductCat = $this->input->post('searchProductCat');
         $searchProductCatId = $this->input->post('searchProductCatId');
         $product->like("name", $searchKey);
         if ($searchProductCatId != "") {
             $product->where_related_productcat('id', $searchProductCatId);
         }
         $dis['searchKey'] = $searchKey;
         $dis['searchProductCat'] = $searchProductCat;
         $dis['searchProductCatId'] = $searchProductCatId;
         $dis['isSearch'] = true;
     }
     if ($productId != 0 && $chooseProduct->accessory->result_count() > 0) {
         $product->where_not_in('id', $chooseProduct->accessory);
     }
     $product->order_by("name", "asc");
     $product->get_iterated(100);
     $dis['chooseProduct'] = $chooseProduct;
     $dis['base_url'] = base_url();
     $dis['product'] = $product;
     $this->load->view("admin/layout/dialogContent/productMultiSelectDialogContent", $dis);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:30,代码来源:dialogmanager.php


示例3: __construct

 public function __construct($controller, $name)
 {
     $product = new Product();
     $title = new TextField('Title', _t('Product.PAGETITLE', 'Product Title'));
     $urlSegment = new TextField('URLSegment', 'URL Segment');
     $menuTitle = new TextField('MenuTitle', 'Navigation Title');
     $sku = TextField::create('InternalItemID', _t('Product.CODE', 'Product Code/SKU'), '', 30);
     $categories = DropdownField::create('ParentID', _t("Product.CATEGORY", "Category"), $product->categoryoptions())->setDescription(_t("Product.CATEGORYDESCRIPTION", "This is the parent page or default category."));
     $otherCategories = ListBoxField::create('ProductCategories', _t("Product.ADDITIONALCATEGORIES", "Additional Categories"), ProductCategory::get()->filter("ID:not", $product->getAncestors()->map('ID', 'ID'))->map('ID', 'NestedTitle')->toArray())->setMultiple(true);
     $model = TextField::create('Model', _t('Product.MODEL', 'Model'), '', 30);
     $featured = CheckboxField::create('Featured', _t('Product.FEATURED', 'Featured Product'));
     $allow_purchase = CheckboxField::create('AllowPurchase', _t('Product.ALLOWPURCHASE', 'Allow product to be purchased'), 1, 'Content');
     $price = TextField::create('BasePrice', _t('Product.PRICE', 'Price'))->setDescription(_t('Product.PRICEDESC', "Base price to sell this product at."))->setMaxLength(12);
     $image = UploadField::create('Image', _t('Product.IMAGE', 'Product Image'));
     $content = new HtmlEditorField('Content', 'Content');
     $fields = new FieldList();
     $fields->add($title);
     //$fields->add($urlSegment);
     //$fields->add($menuTitle);
     //$fields->add($sku);
     $fields->add($categories);
     //$fields->add($otherCategories);
     $fields->add($model);
     $fields->add($featured);
     $fields->add($allow_purchase);
     $fields->add($price);
     $fields->add($image);
     $fields->add($content);
     //$fields = $product->getFrontEndFields();
     $actions = new FieldList(new FormAction('submit', _t("ChefProductForm.ADDPRODUCT", 'Add product')));
     $requiredFields = new RequiredFields(array('Title', 'Model', 'Price'));
     parent::__construct($controller, $name, $fields, $actions, $requiredFields);
 }
开发者ID:8secs,项目名称:cocina,代码行数:33,代码来源:ChefProductForm.php


示例4: setProduct

 public function setProduct(Product $product)
 {
     if ($product) {
         $this->api()->addProduct($product->get());
     }
     return $this;
 }
开发者ID:gradosevic,项目名称:easy-ga,代码行数:7,代码来源:Transaction.php


示例5: getProductGroupsFilter

 private static function getProductGroupsFilter(Product $product)
 {
     $filter = new ARSelectFilter();
     $filter->setOrder(new ARFieldHandle(__CLASS__, "position"), 'ASC');
     $filter->setCondition(new EqualsCond(new ARFieldHandle(__CLASS__, "productID"), $product->getID()));
     return $filter;
 }
开发者ID:saiber,项目名称:livecart,代码行数:7,代码来源:ProductFileGroup.php


示例6: run

 public function run()
 {
     if (!$this->product) {
         return;
     }
     $this->render($this->view, ['dataProvider' => $this->product->getLinkedProductsDataProvider($this->code)]);
 }
开发者ID:RonLab1987,项目名称:43berega,代码行数:7,代码来源:LinkedProductsWidget.php


示例7: testAdd

 /**
  * @covers QueueController::Add
  * @todo Implement testAdd().
  */
 public function testAdd()
 {
     $person = Person::factory('adult');
     $person->name = 'Poehavshiy';
     $person->add();
     $store = Store::factory('Grocery');
     $store->name = 'Prison';
     $store->add();
     $product = new Product();
     $product->name = 'Sladkiy hleb';
     $product->add();
     $request = Application::getInstance()->request;
     $request->setParams(array('storeId' => $store->id, 'personId' => $person->id, 'product_' . $product->id => 'on'));
     $personId = $request->p('personId');
     $storeId = $request->p('storeId');
     $store = Store::get($storeId);
     $person = Person::get($personId);
     $store->queue->add($person);
     $person->basket->drop();
     $name = 'product_' . $product->id;
     $value = $product;
     if (preg_match_all('/^product_(\\d+)$/', $name, $matches)) {
         $person->basket->add(Product::get($matches[1][0]));
     }
 }
开发者ID:ruyozora,项目名称:Test-test,代码行数:29,代码来源:QueueControllerTest.php


示例8: getAdminInterface

 public function getAdminInterface()
 {
     $st = "select ecomm_product.id as product_id, ecomm_product.name as product_name,\n\t\t\t\tecomm_product.supplier as supplier_id, ecomm_supplier.name as supplier_name, ecomm_product.price as product_price\n\t\t\t\tfrom ecomm_product left join ecomm_supplier on ecomm_product.supplier = ecomm_supplier.id\n\t\t\t\torder by ecomm_supplier.name,ecomm_product.name";
     $products = Database::singleton()->query_fetch_all($st);
     $formPath = "/admin/EComm&section=Plugins&page=ChangeProductPrice";
     $form = new Form('change_product_prices', 'post', $formPath);
     if ($form->validate() && isset($_REQUEST['submit'])) {
         foreach ($products as $product) {
             $ECommProduct = new Product($product['product_id']);
             $ECommProduct->setPrice($_REQUEST['product_' . $product['product_id']]);
             $ECommProduct->save();
         }
         return "Your products' prices have been changed successfully<br/><a href='{$formPath}'>Go back</a>";
     }
     $oldSupplier = 0;
     $currentSupplier = 0;
     $defaultValue = array();
     foreach ($products as $product) {
         $currentSupplier = $product['supplier_id'];
         if ($oldSupplier != $currentSupplier) {
             $form->addElement('html', '<br/><br/><hr/><h3>Supplier: ' . $product['supplier_name'] . '</h3>');
         }
         $form->addElement('text', 'product_' . $product['product_id'], $product['product_name']);
         $defaultValue['product_' . $product['product_id']] = $product['product_price'];
         $oldSupplier = $product['supplier_id'];
     }
     $form->addElement('submit', 'submit', 'Submit');
     $form->setDefaults($defaultValue);
     return $form->display();
 }
开发者ID:anas,项目名称:feedstore,代码行数:30,代码来源:ChangeProductPrice.php


示例9: dataAction

 public function dataAction()
 {
     $w = 80;
     $h = 100;
     $img = $this->_getParam('img');
     $ar_img = split('\\.', $img);
     //print_r($ar_img);exit;
     $Product = new Product();
     $product = $Product->get($ar_img[0]);
     if ($product && $product['picture']) {
         $res = GetWebPage($product['picture'], $RetStatus);
         //header('Content-type: image/jpg');
         //print_r($res);exit;
         //$ar = getimagesizefromstring($res);
         $im = imagecreatefromstring($res);
         $width = imagesx($im);
         $height = imagesy($im);
         //print_r($width." ".$height);
         if ($width > $height) {
             $new_height = $w * $height / $width;
             $new_width = $w;
         } else {
             $new_height = $h;
             $new_width = $h * $width / $height;
         }
         $im_new = imagecreatetruecolor($new_width, $new_height);
         //imagecopyresized($im_new,$im,0, 0, 0, 0, $new_width, $new_height, $width, $height);
         imagecopyresampled($im_new, $im, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
         header('Content-type: image/jpg');
         imagejpeg($im_new);
     }
     $this->_helper->viewRenderer->setNoRender();
     $this->_helper->layout->disableLayout();
 }
开发者ID:vitsun,项目名称:igrushki-detkam,代码行数:34,代码来源:ImagesController.php


示例10: run

 public function run()
 {
     $this->init();
     $this->preProcess();
     global $cookie, $link;
     $id_product = Tools::getValue('id');
     $product = new Product($id_product, true, 1);
     $id_customer = (isset(self::$cookie->id_customer) and self::$cookie->id_customer) ? (int) self::$cookie->id_customer : 0;
     if ($id_customer) {
         $sql = "select id from ps_wishlist where id_customer = " . $id_customer . " and id_product = " . $product->id;
         $res = Db::getInstance()->ExecuteS($sql);
         if ($res) {
             self::$smarty->assign("in_wishlist", true);
         } else {
             self::$smarty->assign("in_wishlist", false);
         }
     } else {
         self::$smarty->assign("in_wishlist", false);
     }
     $idImage = $product->getCoverWs();
     if ($idImage) {
         $idImage = $productObj->id . '-' . $idImage;
     } else {
         $idImage = Language::getIsoById(1) . '-default';
     }
     $image_link = $link->getImageLink($productObj->link_rewrite, $idImage, 'thickbox');
     self::$smarty->assign('product', $product);
     self::$smarty->assign('imagelink', $image_link);
     self::$smarty->assign('productlink', $product->getLink());
     die(self::$smarty->display(_PS_THEME_DIR_ . 'quick-view.tpl'));
 }
开发者ID:priyankajsr19,项目名称:indusdiva2,代码行数:31,代码来源:QuickViewController.php


示例11: log

 /**
  * Save log message
  *
  * @param int $action
  * @param Product $product
  * @param int $type
  * @param string $message
  * @param null|string $code
  * @return int|false
  */
 protected static function log($action, Product $product, $type, $message, $code = null)
 {
     $message = trim($message);
     $template = $product->getTemplate();
     $data = array('product_id' => $product->id, 'template_id' => $product->template_id, 'product_name' => $product->original_title, 'template_name' => $template ? $template->name : '-', 'message' => $message, 'code' => $code, 'action' => $action, 'type' => $type, 'datetime' => time());
     return db_query('INSERT INTO ?:ebay_product_log ?e', $data);
 }
开发者ID:ambient-lounge,项目名称:site,代码行数:17,代码来源:ProductLogger.php


示例12: create

 public static function create(Customer $cus, Product $prd, $opts)
 {
     $material = $opts['material'];
     $order_sn = self::makeOrderSn();
     Pdb::insert(array_merge($opts, array('order_no' => $order_sn, 'customer' => $cus->id, 'product' => $prd->id, 'state' => 'InCart', 'estimate_price' => $prd->estimatePrice(compact('material')), 'add_cart_time=NOW()' => null)), self::$table);
     return new self(Pdb::lastInsertId());
 }
开发者ID:name3,项目名称:cheng,代码行数:7,代码来源:Order.php


示例13: create

 /**
  * Creates a scheduling in the database.
  *
  * @return Response
  */
 public function create()
 {
     $request = $this->request;
     $scheduling = new Product();
     $scheduling->assign(['end_period' => $request->get('end_period', 'string'), 'period_type_id' => $request->get('period_type_id', 'strint')]);
     return $this->response($request, $scheduling, true);
 }
开发者ID:soutoner,项目名称:api-desconecta,代码行数:12,代码来源:SchedulingsController.php


示例14: search

 function search()
 {
     $viewMode = $this->uri->segment(2, "") == "" ? "ma-tran" : $this->uri->segment(2);
     $orderBy = $this->uri->segment(3, "") == "" ? "moi-nhat" : $this->uri->segment(3);
     $page = $this->uri->segment(4, "") == "" ? "trang-1" : $this->uri->segment(4);
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $searchKey = $this->input->post('searchKey');
         $this->session->set_userdata('searchKey', $searchKey);
     }
     $searchKey = $this->session->userdata('searchkey');
     $limit = $viewMode == "ma-tran" ? 15 : 10;
     $offset = ($this->getPageNumber($page) - 1) * $limit;
     $product = new Product();
     if (trim($searchKey) != "") {
         $product->like('name', $searchKey);
     }
     $product->where('active', 1);
     $product->order_by($this->getOrderBy($orderBy), $this->getOrderDirection($orderBy));
     $product->get_paged_iterated();
     $dis['product'] = $product;
     $dis['pageUrl'] = "tim-kiem";
     $config['base_url'] = site_url($url . "/" . $viewMode . "/" . $orderBy . "/trang-");
     $config['total_rows'] = $product->paged->total_rows;
     $config['per_page'] = $limit;
     $config['use_page_numbers'] = TRUE;
     $config['uri_segment'] = 4;
     $config['num_links'] = 3;
     $config['full_tag_open'] = '<span class="pagin">';
     $config['full_tag_close'] = "</span>";
     $config['first_link'] = FALSE;
     $config['first_tag_open'] = '';
     $config['first_tag_close'] = '';
     $config['last_link'] = FALSE;
     $config['last_tag_open'] = '';
     $config['last_tag_close'] = '';
     $config['next_link'] = '<img src="' . base_url() . 'images/pagination_next.png" />';
     $config['next_tag_open'] = '';
     $config['next_tag_close'] = '';
     $config['prev_link'] = '<img src="' . base_url() . 'images/pagination_pre.png" /';
     $config['prev_tag_open'] = '';
     $config['prev_tag_close'] = '';
     $config['num_tag_open'] = '';
     $config['num_tag_close'] = '';
     $config['cur_tag_open'] = '<span class="active">';
     $config['cur_tag_close'] = '</span>';
     $this->pagination->initialize($config);
     if ($viewMode == 'ma-tran') {
         $dis['view'] = 'product/product_grid';
     } else {
         $dis['view'] = 'product/product_list';
     }
     $productSaleOff = new product();
     $productSaleOff->where('active', 1);
     $productSaleOff->where('isSale', 1);
     $productSaleOff->order_by('id', 'desc');
     $productSaleOff->get_iterated(15);
     $dis['productSaleOff'] = $productSaleOff;
     $dis['base_url'] = base_url();
     $this->viewfront($dis);
 }
开发者ID:lxthien,项目名称:batdongsan,代码行数:60,代码来源:fsearch.php


示例15: indexAction

 public function indexAction()
 {
     $categories = new Category();
     //$this->view->categories = array ('1','2','3','4');
     //$this->view->categories = $categories->fetchAll();
     //$this->_helper->actionStack('detail-list');
     //$this->_forward('detail-list');
     //$this->rrr();
     $front = Zend_Controller_Front::getInstance();
     if ($front->getRequest()->getParam('controller') == 'toy') {
         $toy_id = $front->getRequest()->getParam('toy_id');
         $Product = new Product();
         $toy = $Product->get($toy_id);
         $cat_id = $toy['categoryId'];
         $this->view->current_id = $cat_id;
         $this->view->p_type = 'toy';
     } else {
         $cat_id = $front->getRequest()->getParam('cat_id');
         $cat_id = $cat_id ? $cat_id : 0;
         $this->view->current_id = $cat_id;
         $this->view->p_type = 'category';
     }
     //print_r($cat_id);exit;
     $this->view->categories = $categories->get_sort_categories($cat_id);
 }
开发者ID:vitsun,项目名称:igrushki-detkam,代码行数:25,代码来源:CategoryController.php


示例16: _product_link

function _product_link($fk_product)
{
    global $db, $langs, $conf;
    $p = new Product($db);
    $p->fetch($fk_product);
    return $p->getNomUrl(1) . ' ' . $p->label;
}
开发者ID:ATM-Consulting,项目名称:dolibarr_module_mandarin,代码行数:7,代码来源:graph_cost_price.php


示例17: __construct

 public function __construct(Product $product, $prices = null, LiveCart $application)
 {
     $this->product = $product;
     $this->application = $application;
     if (is_null($prices) && $product->getID()) {
         $prices = $product->getRelatedRecordSet("ProductPrice", new ARSelectFilter());
     }
     if ($prices instanceof ARSet) {
         foreach ($prices as $price) {
             $this->setPrice($price);
         }
     } else {
         if (is_array($prices)) {
             foreach ($prices as $id => $price) {
                 if (array_key_exists('ID', $price)) {
                     $this->prices[$id] = ProductPrice::getInstance($product, Currency::getInstanceById($id));
                 } else {
                     $this->prices[$id] = ProductPrice::getNewInstance($product, Currency::getInstanceById($id));
                 }
                 $this->prices[$id]->price->set($price['price']);
                 $this->prices[$id]->listPrice->set($price['listPrice']);
                 $this->prices[$id]->serializedRules->set(serialize($price['serializedRules']));
                 $this->prices[$id]->resetModifiedStatus();
             }
         }
     }
 }
开发者ID:saiber,项目名称:www,代码行数:27,代码来源:ProductPricing.php


示例18: transform

 /**
  * Transforms an object (product) to a int (id).
  *
  * @param  Product|null $entity
  * @return string
  */
 public function transform($entity)
 {
     if (null === $entity) {
         return "";
     }
     return $entity->getId();
 }
开发者ID:jlm-entreprise,项目名称:product-bundle,代码行数:13,代码来源:ProductToIntTransformer.php


示例19: add

 public function add(Product $p)
 {
     if (isset($this->products[$p->getUniqueProductID()])) {
         throw new \Exception("Product Unique ID already exist, no duplicated products please!");
     }
     $this->products[$p->getUniqueProductID()] = $p;
 }
开发者ID:henceee,项目名称:1DV608,代码行数:7,代码来源:ProductCatalog.php


示例20: actionUpload_product

 public function actionUpload_product()
 {
     if (Yii::$app->request->isAjax) {
         $model = new ProductCategory();
         $Product = new Product();
         $ProductImageRel = new ProductImageRel();
         $ProductCategoryRel = new ProductCategoryRel();
         $model_cat_title = UploadedFile::getInstance($model, 'cat_title');
         $time = time();
         $model_cat_title->saveAs('product_uploads/' . $time . $model_cat_title->baseName . '.' . $model_cat_title->extension);
         if ($model_cat_title) {
             $response = [];
             $Product->title = $_POST['title'];
             $Product->desc = $_POST['desc'];
             $Product->status = 1;
             if ($Product->save()) {
                 $ProductCategoryRel->category_id = $_POST['id'];
                 $ProductCategoryRel->product_id = $Product->id;
                 $ProductImageRel->product_id = $Product->id;
                 $ProductImageRel->image = $time . $model_cat_title->baseName . '.' . $model_cat_title->extension;
                 if ($ProductCategoryRel->save() && $ProductImageRel->save()) {
                     $response['files'][] = ['name' => $time . $model_cat_title->name, 'type' => $model_cat_title->type, 'size' => $model_cat_title->size, 'url' => Url::base() . '/product_uploads/' . $time . $model_cat_title->baseName . '.' . $model_cat_title->extension, 'deleteUrl' => Url::to(['delete_uploaded_file', 'file' => $model_cat_title->baseName . '.' . $model_cat_title->extension]), 'deleteType' => 'DELETE'];
                     $response['base'] = $time . $model_cat_title->baseName;
                     $response['view'] = $this->renderAjax('uploaded_product', ['url' => Url::base() . '/product_uploads/' . $time . $model_cat_title->baseName . '.' . $model_cat_title->extension, 'basename' => $time . $model_cat_title->baseName, 'id' => $ProductImageRel->id, 'model' => $Product]);
                 }
             } else {
                 $response['errors'] = $product->getErrors();
             }
             return json_encode($response);
         }
     }
 }
开发者ID:hsleonis,项目名称:basetech,代码行数:32,代码来源:CategoryController.php



注:本文中的Product类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ProductCategory类代码示例发布时间:2022-05-23
下一篇:
PHP ProcessPeer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap