当前位置: 首页>>代码示例>>PHP>>正文


PHP Manufacturer::getInstanceByName方法代码示例

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


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

示例1: processMass

 /**
  * @role mass
  */
 public function processMass()
 {
     $filter = $this->getSelectFilter();
     $act = $this->request->get('act');
     $field = array_pop(explode('_', $act, 2));
     if ('move' == $act) {
         new ActiveGrid($this->application, $filter, $this->getClassName());
         $cat = Category::getInstanceById($this->request->get('categoryID'), Category::LOAD_DATA);
         $update = new ARUpdateFilter();
         $update->setCondition($filter->getCondition());
         $update->addModifier('Product.categoryID', $cat->getID());
         $update->joinTable('ProductPrice', 'Product', 'productID AND (ProductPrice.currencyID = "' . $this->application->getDefaultCurrencyCode() . '")', 'ID');
         ActiveRecord::beginTransaction();
         ActiveRecord::updateRecordSet('Product', $update, Product::LOAD_REFERENCES);
         Category::recalculateProductsCount();
         ActiveRecord::commit();
         return new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->translate('_move_succeeded'));
     }
     // remove design themes
     if ('theme' == $act && !$this->request->get('theme')) {
         ClassLoader::import('application.model.presentation.CategoryPresentation');
         ActiveRecord::deleteRecordSet('CategoryPresentation', new ARDeleteFilter($filter->getCondition()), null, array('Product', 'Category'));
         return new JSONResponse(array('act' => $this->request->get('act')), 'success', $this->translate('_themes_removed'));
     }
     $params = array();
     if ('manufacturer' == $act) {
         $params['manufacturer'] = Manufacturer::getInstanceByName($this->request->get('manufacturer'));
     } else {
         if ('price' == $act || 'inc_price' == $act) {
             $params['baseCurrency'] = $this->application->getDefaultCurrencyCode();
             $params['price'] = $this->request->get($act);
             $params['currencies'] = $this->application->getCurrencySet();
             $params['inc_price_value'] = $this->request->get('inc_price_value');
             $params['inc_quant_price'] = $this->request->get('inc_quant_price');
         } else {
             if ('addRelated' == $act) {
                 $params['relatedProduct'] = Product::getInstanceBySKU($this->request->get('related'));
                 if (!$params['relatedProduct']) {
                     return new JSONResponse(0);
                 }
             } else {
                 if ($this->request->get('categoryID')) {
                     $params['category'] = Category::getInstanceById($this->request->get('categoryID'), Category::LOAD_DATA);
                 } else {
                     if ('theme' == $act) {
                         ClassLoader::import('application.model.presentation.CategoryPresentation');
                         $params['theme'] = $this->request->get('theme');
                     } else {
                         if ('shippingClass' == $act) {
                             $params['shippingClass'] = $this->request->get('shippingClass');
                         } else {
                             if ('taxClass' == $act) {
                                 $params['taxClass'] = $this->request->get('taxClass');
                             }
                         }
                     }
                 }
             }
         }
     }
     $response = parent::processMass($params);
     if ($this->request->get('categoryID')) {
         Category::recalculateProductsCount();
     }
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:69,代码来源:ProductController.php

示例2: loadRequestData

 public function loadRequestData(Request $request, $removeMissingPrices = true)
 {
     // basic data
     parent::loadRequestData($request);
     if (!$this->isExistingRecord()) {
         $this->save();
     }
     // set manufacturer
     if ($man = $request->get('Manufacturer')) {
         $this->manufacturer->set(!empty($man['name']) ? Manufacturer::getInstanceByName($man['name']) : null);
     }
     $this->getSpecification()->loadRequestData($request);
     // set prices
     $this->loadPricingFromRequest($request, false, $removeMissingPrices);
     $this->loadPricingFromRequest($request, true, $removeMissingPrices);
     if ($quantities = $request->get('quantityPrice')) {
         foreach ($this->getRelatedRecordSet('ProductPrice', new ARSelectFilter()) as $price) {
             $id = $price->currency->get()->getID();
             if (!empty($quantities[$id]['serializedRules'])) {
                 $prices = $quantities[$id]['serializedRules'];
                 ksort($prices);
                 $price->serializedRules->set(serialize($prices));
                 $price->save();
             }
         }
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:27,代码来源:Product.php

示例3: loadRequestData

 public function loadRequestData(Request $request)
 {
     // basic data
     parent::loadRequestData($request);
     if (!$this->isExistingRecord()) {
         $this->save();
     }
     // set manufacturer
     if ($request->isValueSet('manufacturer')) {
         $this->manufacturer->set(Manufacturer::getInstanceByName($request->get('manufacturer')));
     }
     $this->getSpecification()->loadRequestData($request);
     // set prices
     $this->loadPricingFromRequest($request);
     $this->loadPricingFromRequest($request, true);
 }
开发者ID:saiber,项目名称:www,代码行数:16,代码来源:Product.php


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