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

PHP Frontend\Factory类代码示例

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

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



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

示例1: getCatalogController

 /**
  * Returns the catalog controller object
  *
  * @return \Aimeos\Controller\Frontend\Catalog\Interface Catalog controller
  */
 protected function getCatalogController()
 {
     if (!isset($this->controller)) {
         $context = $this->getContext();
         $this->controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
     }
     return $this->controller;
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:13,代码来源:Base.php


示例2: testClearSpecific

 public function testClearSpecific()
 {
     $cache = \Aimeos\Controller\Frontend\Factory::setCache(true);
     $context = \TestHelperFrontend::getContext();
     $basket1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
     $catalog1 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
     \Aimeos\Controller\Frontend\Factory::clear((string) $context, 'basket');
     $basket2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
     $catalog2 = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
     \Aimeos\Controller\Frontend\Factory::setCache($cache);
     $this->assertNotSame($basket1, $basket2);
     $this->assertSame($catalog1, $catalog2);
 }
开发者ID:aimeos,项目名称:ai-controller-frontend,代码行数:13,代码来源:FactoryTest.php


示例3: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->view)) {
         if (($pos = $view->param('l_pos')) !== null && ($pid = $view->param('d_prodid')) !== null) {
             if ($pos < 1) {
                 $start = 0;
                 $size = 2;
             } else {
                 $start = $pos - 1;
                 $size = 3;
             }
             $context = $this->getContext();
             $site = $context->getLocale()->getSite()->getCode();
             $params = $context->getSession()->get('aimeos/catalog/lists/params/last/' . $site, array());
             $filter = $this->getProductListFilterByParam($params);
             $filter->setSlice($start, $size);
             $total = null;
             $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
             $products = $controller->getIndexItems($filter, array('text'), $total);
             if (($count = count($products)) > 1) {
                 $enc = $view->encoder();
                 $listPos = array_search($pid, array_keys($products));
                 $target = $view->config('client/html/catalog/detail/url/target');
                 $controller = $view->config('client/html/catalog/detail/url/controller', 'catalog');
                 $action = $view->config('client/html/catalog/detail/url/action', 'detail');
                 $config = $view->config('client/html/catalog/detail/url/config', array());
                 if ($listPos > 0 && ($product = reset($products)) !== false) {
                     $param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url ')), 'l_pos' => $pos - 1);
                     $view->navigationPrev = $view->url($target, $controller, $action, $param, array(), $config);
                 }
                 if ($listPos < $count - 1 && ($product = end($products)) !== false) {
                     $param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url')), 'l_pos' => $pos + 1);
                     $view->navigationNext = $view->url($target, $controller, $action, $param, array(), $config);
                 }
             }
         }
         $this->view = $view;
     }
     return $this->view;
 }
开发者ID:andreasfernandez,项目名称:aimeos-core,代码行数:48,代码来源:Standard.php


示例4: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $config = $context->getConfig();
         $attrIds = $attributeMap = $subAttrDeps = array();
         if (isset($view->detailProductItem)) {
             $attrIds = array_keys($view->detailProductItem->getRefItems('attribute', null, 'default'));
             $attrIds += array_keys($view->detailProductItem->getRefItems('attribute', null, 'variant'));
         }
         $products = $view->detailProductItem->getRefItems('product', 'default', 'default');
         /** client/html/catalog/detail/additional/attribute/domains
          * A list of domain names whose items should be available in the additional attribute part of the catalog detail view templates
          *
          * The templates rendering additional attribute related data usually add
          * the images and texts associated to each item. If you want to
          * display additional content like the attributes, you can configure
          * your own list of domains (attribute, media, price, product, text,
          * etc. are domains) whose items are fetched from the storage.
          * Please keep in mind that the more domains you add to the
          * configuration, the more time is required for fetching the content!
          *
          * @param array List of domain names
          * @since 2015.09
          * @category Developer
          * @see client/html/catalog/detail/basket/selection/domains-attributes
          */
         $domains = $config->get('client/html/catalog/detail/basket/selection/domains', array('attribute'));
         // find regular attributes from sub-products
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $products = $controller->getProductItems(array_keys($products), $domains);
         foreach ($products as $subProdId => $subProduct) {
             $subItems = $subProduct->getRefItems('attribute', null, 'default');
             $subItems += $subProduct->getRefItems('attribute', null, 'variant');
             foreach ($subItems as $attrId => $attrItem) {
                 $subAttrDeps[$attrId][] = $subProdId;
                 $attrIds[] = $attrId;
             }
         }
         $this->addMetaItem($products, 'product', $this->expire, $this->tags);
         $this->addMetaList(array_keys($products), 'product', $this->expire);
         $attrManager = $controller->createManager('attribute');
         $search = $attrManager->createSearch(true);
         $expr = array($search->compare('==', 'attribute.id', $attrIds), $search->getConditions());
         $search->setConditions($search->combine('&&', $expr));
         /** client/html/catalog/detail/basket/selection/domains-attributes
          * A list of domain names whose items should be available for the attributes in the
          * additional attribute part of the catalog detail view templates
          *
          * The templates rendering additional attribute related data usually add
          * the images and texts associated to each item. If you want to
          * display additional content like the attributes, you can configure
          * your own list of domains (attribute, media, price, product, text,
          * etc. are domains) whose items are fetched from the storage.
          * Please keep in mind that the more domains you add to the
          * configuration, the more time is required for fetching the content!
          *
          * @param array List of domain names
          * @since 2015.09
          * @category Developer
          * @see client/html/catalog/detail/basket/selection/domains
          */
         $domains = $config->get('client/html/catalog/detail/basket/selection/domains-attributes', array('text', 'media'));
         $attributes = $attrManager->searchItems($search, $domains);
         foreach ($attributes as $id => $item) {
             $attributeMap[$item->getType()][$id] = $item;
         }
         $this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags);
         $this->addMetaList(array_keys($attributes), 'attribute', $this->expire);
         $view->attributeMap = $attributeMap;
         $view->subAttributeDependencies = $subAttrDeps;
         $this->cache = $view;
     }
     $expire = $this->expires($this->expire, $expire);
     $tags = array_merge($tags, $this->tags);
     return $this->cache;
 }
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:85,代码来源:Standard.php


示例5: bootstrap

 public static function bootstrap()
 {
     self::getAimeos();
     \Aimeos\MShop\Factory::setCache(false);
     \Aimeos\Controller\Frontend\Factory::setCache(false);
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:6,代码来源:TestHelperHtml.php


示例6: process

 /**
  * Processes the input, e.g. store given values.
  * A view must be available and this method doesn't generate any output
  * besides setting view variables.
  */
 public function process()
 {
     $view = $this->getView();
     $context = $this->getContext();
     switch ($view->param('b_action')) {
         case 'coupon-delete':
             if (($coupon = $view->param('b_coupon')) != '') {
                 $this->clearCached();
                 $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
                 $cntl->deleteCoupon($coupon);
             }
             break;
         default:
             if (($coupon = $view->param('b_coupon')) != '') {
                 $this->clearCached();
                 $cntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
                 /** client/html/basket/standard/coupon/allowed
                  * Number of coupon codes a customer is allowed to enter
                  *
                  * This configuration option enables shop owners to limit the number of coupon
                  * codes that can be added by a customer to his current basket. By default, only
                  * one coupon code is allowed per order.
                  *
                  * Coupon codes are valid until a payed order is placed by the customer. The
                  * "count" of the codes is decreased afterwards. If codes are not personalized
                  * the codes can be reused in the next order until their "count" reaches zero.
                  *
                  * @param integer Positive number of coupon codes including zero
                  * @since 2014.05
                  * @category User
                  * @category Developer
                  */
                 $allowed = $context->getConfig()->get('client/html/basket/standard/coupon/allowed', 1);
                 if ($allowed <= count($cntl->get()->getCoupons())) {
                     throw new \Aimeos\Client\Html\Exception(sprintf('Number of coupon codes exceeds the limit'));
                 }
                 $cntl->addCoupon($coupon);
             }
             break;
     }
     parent::process();
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:47,代码来源:Standard.php


示例7: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
         $view->standardBasket = $basketCntl->get();
         $bTarget = $view->config('client/html/basket/standard/url/target');
         $bCntl = $view->config('client/html/basket/standard/url/controller', 'basket');
         $bAction = $view->config('client/html/basket/standard/url/action', 'index');
         $bConfig = $view->config('client/html/basket/standard/url/config', array());
         /** client/html/checkout/standard/url/target
          * Destination of the URL where the controller specified in the URL is known
          *
          * The destination can be a page ID like in a content management system or the
          * module of a software development framework. This "target" must contain or know
          * the controller that should be called by the generated URL.
          *
          * @param string Destination of the URL
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/action
          * @see client/html/checkout/standard/url/config
          */
         $cTarget = $view->config('client/html/checkout/standard/url/target');
         /** client/html/checkout/standard/url/controller
          * Name of the controller whose action should be called
          *
          * In Model-View-Controller (MVC) applications, the controller contains the methods
          * that create parts of the output displayed in the generated HTML page. Controller
          * names are usually alpha-numeric.
          *
          * @param string Name of the controller
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/action
          * @see client/html/checkout/standard/url/config
          */
         $cCntl = $view->config('client/html/checkout/standard/url/controller', 'checkout');
         /** client/html/checkout/standard/url/action
          * Name of the action that should create the output
          *
          * In Model-View-Controller (MVC) applications, actions are the methods of a
          * controller that create parts of the output displayed in the generated HTML page.
          * Action names are usually alpha-numeric.
          *
          * @param string Name of the action
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/config
          */
         $cAction = $view->config('client/html/checkout/standard/url/action', 'index');
         /** client/html/checkout/standard/url/config
          * Associative list of configuration options used for generating the URL
          *
          * You can specify additional options as key/value pairs used when generating
          * the URLs, like
          *
          *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
          *
          * The available key/value pairs depend on the application that embeds the e-commerce
          * framework. This is because the infrastructure of the application is used for
          * generating the URLs. The full list of available config options is referenced
          * in the "see also" section of this page.
          *
          * @param string Associative list of configuration options
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/action
          * @see client/html/url/config
          */
         $cConfig = $view->config('client/html/checkout/standard/url/config', array());
         /** client/html/checkout/standard/url/step-active
          * Name of the checkout process step to jump to if no previous step requires attention
          *
          * The checkout process consists of several steps which are usually
          * displayed one by another to the customer. If the data of a step
          * is already available, then that step is skipped. The active step
          * is the one that is displayed if all other steps are skipped.
          *
          * If one of the previous steps misses some data the customer has
          * to enter, then this step is displayed first. After providing
          * the missing data, the whole series of steps are tested again
          * and if no other step requests attention, the configured active
          * step will be displayed.
          *
          * The order of the steps is determined by the order of sub-parts
//.........这里部分代码省略.........
开发者ID:boettner-it,项目名称:aimeos-core,代码行数:101,代码来源:Standard.php


示例8: process

 /**
  * Processes the input, e.g. store given order.
  * A view must be available and this method doesn't generate any output
  * besides setting view variables.
  */
 public function process()
 {
     $view = $this->getView();
     $errors = $view->get('standardErrorList', array());
     if (!in_array($view->param('c_step'), array('order', 'process')) || !empty($errors)) {
         return;
     }
     $context = $this->getContext();
     $session = $context->getSession();
     $orderid = $session->get('aimeos/orderid');
     $config = array('absoluteUri' => true, 'namespace' => false);
     try {
         $orderItem = \Aimeos\MShop\Factory::createManager($context, 'order')->getItem($orderid);
         if (($code = $this->getOrderServiceCode($orderItem->getBaseId())) !== null) {
             $serviceItem = $this->getServiceItem($code);
             $serviceManager = \Aimeos\MShop\Factory::createManager($context, 'service');
             $provider = $serviceManager->getProvider($serviceItem);
             $args = array('code' => $serviceItem->getCode(), 'orderid' => $orderid);
             $urls = array('payment.url-self' => $this->getUrlSelf($view, $args + array('c_step' => 'process'), array()), 'payment.url-success' => $this->getUrlConfirm($view, $args, $config), 'payment.url-update' => $this->getUrlUpdate($view, $args, $config), 'client.ipaddress' => $view->request()->getClientAddress());
             $provider->injectGlobalConfigBE($urls);
             $params = $view->param();
             try {
                 $basket = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket')->get();
                 $attrs = $basket->getService(\Aimeos\MShop\Order\Item\Base\Service\Base::TYPE_PAYMENT)->getAttributes();
                 foreach ($attrs as $item) {
                     $params[$item->getCode()] = $item->getValue();
                 }
             } catch (\Exception $e) {
             }
             // nothing available
             if (($form = $provider->process($orderItem, $params)) === null) {
                 $msg = sprintf('Invalid process response from service provider with code "%1$s"', $serviceItem->getCode());
                 throw new \Aimeos\Client\Html\Exception($msg);
             }
             $view->standardUrlNext = $form->getUrl();
             $view->standardMethod = $form->getMethod();
             $view->standardProcessParams = $form->getValues();
             $view->standardUrlExternal = $form->getExternal();
         } else {
             $view->standardUrlNext = $this->getUrlConfirm($view, array(), array());
             $view->standardMethod = 'GET';
         }
         parent::process();
     } catch (\Aimeos\Client\Html\Exception $e) {
         $error = array($context->getI18n()->dt('client', $e->getMessage()));
         $view->standardErrorList = $view->get('standardErrorList', array()) + $error;
     } catch (\Aimeos\Controller\Frontend\Exception $e) {
         $error = array($context->getI18n()->dt('controller/frontend', $e->getMessage()));
         $view->standardErrorList = $view->get('standardErrorList', array()) + $error;
     } catch (\Aimeos\MShop\Exception $e) {
         $error = array($context->getI18n()->dt('mshop', $e->getMessage()));
         $view->standardErrorList = $view->get('standardErrorList', array()) + $error;
     } catch (\Exception $e) {
         $context->getLogger()->log($e->getMessage() . PHP_EOL . $e->getTraceAsString());
         $error = array($context->getI18n()->dt('client', 'A non-recoverable error occured'));
         $view->standardErrorList = $view->get('standardErrorList', array()) + $error;
     }
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:63,代码来源:Standard.php


示例9: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $config = $context->getConfig();
         $products = $this->getProductList($view);
         $text = (string) $view->param('f_search');
         $catid = (string) $view->param('f_catid');
         if ($catid == '') {
             $catid = $config->get('client/html/catalog/lists/catid-default', '');
         }
         if ($text === '' && $catid !== '') {
             $domains = $config->get('client/html/catalog/domains', array('media', 'text'));
             $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
             $listCatPath = $controller->getCatalogPath($catid, $domains);
             if (($categoryItem = end($listCatPath)) !== false) {
                 $view->listCurrentCatItem = $categoryItem;
             }
             $view->listCatPath = $listCatPath;
             $this->addMetaItem($listCatPath, 'catalog', $this->expire, $this->tags);
             $this->addMetaList(array_keys($listCatPath), 'catalog', $this->expire);
         }
         /** client/html/catalog/lists/stock/enable
          * Enables or disables displaying product stock levels in product list views
          *
          * This configuration option allows shop owners to display product
          * stock levels for each product in list views or to disable
          * fetching product stock information.
          *
          * The stock information is fetched via AJAX and inserted via Javascript.
          * This allows to cache product items by leaving out such highly
          * dynamic content like stock levels which changes with each order.
          *
          * @param boolean Value of "1" to display stock levels, "0" to disable displaying them
          * @since 2014.03
          * @category User
          * @category Developer
          * @see client/html/catalog/detail/stock/enable
          * @see client/html/catalog/stock/url/target
          * @see client/html/catalog/stock/url/controller
          * @see client/html/catalog/stock/url/action
          * @see client/html/catalog/stock/url/config
          */
         if (!empty($products) && $config->get('client/html/catalog/lists/stock/enable', true) === true) {
             $view->listStockUrl = $this->getStockUrl($view, array_keys($products));
         }
         $this->addMetaItem($products, 'product', $this->expire, $this->tags);
         $this->addMetaList(array_keys($products), 'product', $this->expire);
         // Delete cache when products are added or deleted even when in "tag-all" mode
         $this->tags[] = 'product';
         $view->listParams = $this->getClientParams($view->param());
         $view->listPageCurr = $this->getProductListPage($view);
         $view->listPageSize = $this->getProductListSize($view);
         $view->listProductTotal = $this->getProductListTotal($view);
         $view->listProductSort = $view->param('f_sort', 'relevance');
         $view->listProductItems = $products;
         $this->cache = $view;
     }
     $expire = $this->expires($this->expire, $expire);
     $tags = array_merge($tags, $this->tags);
     return $this->cache;
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:70,代码来源:Standard.php


示例10: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $attrMap = array();
         $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
         /** client/html/catalog/filter/attribute/types
          * List of attribute types that should be displayed in this order in the catalog filter
          *
          * The attribute section in the catalog filter component can display
          * all attributes a visitor can use to reduce the listed products
          * to those that contains one or more attributes. By default, all
          * available attributes will be displayed and ordered by their
          * attribute type.
          *
          * With this setting, you can limit the attribute types to only thoses
          * whose names are part of the setting value. Furthermore, a particular
          * order for the attribute types can be enforced that is different
          * from the standard order.
          *
          * @param array List of attribute type codes
          * @since 2015.05
          * @category User
          * @category Developer
          * @see client/html/catalog/filter/attribute/domains
          */
         $attrTypes = $view->config('client/html/catalog/filter/attribute/types', array());
         $manager = $controller->createManager('attribute');
         $search = $manager->createSearch(true);
         $expr = array();
         if (!empty($attrTypes)) {
             $expr[] = $search->compare('==', 'attribute.type.code', $attrTypes);
         }
         $expr[] = $search->compare('==', 'attribute.domain', 'product');
         $expr[] = $search->getConditions();
         $sort = array($search->sort('+', 'attribute.position'));
         $search->setConditions($search->combine('&&', $expr));
         $search->setSortations($sort);
         /** client/html/catalog/filter/attribute/domains
          * List of domain names whose items should be fetched with the filter attributes
          *
          * The templates rendering the attributes in the catalog filter usually
          * add the images and texts associated to each item. If you want to
          * display additional content, you can configure your own list of
          * domains (attribute, media, price, product, text, etc. are domains)
          * whose items are fetched from the storage. Please keep in mind that
          * the more domains you add to the configuration, the more time is
          * required for fetching the content!
          *
          * @param array List of domain item names
          * @since 2015.05
          * @category Developer
          * @see client/html/catalog/filter/attribute/types
          */
         $domains = $view->config('client/html/catalog/filter/attribute/domains', array('text', 'media'));
         $attributes = $manager->searchItems($search, $domains);
         foreach ($attributes as $id => $item) {
             $attrMap[$item->getType()][$id] = $item;
         }
         if (!empty($attrTypes)) {
             $sortedMap = array();
             foreach ($attrTypes as $type) {
                 if (isset($attrMap[$type])) {
                     $sortedMap[$type] = $attrMap[$type];
                 }
             }
             $attrMap = $sortedMap;
         } else {
             ksort($attrMap);
         }
         $this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags);
         $this->addMetaList(array_keys($attributes), 'attribute', $this->expire);
         // Delete cache when attributes are added or deleted even in "tag-all" mode
         $this->tags[] = 'attribute';
         $view->attributeMap = $attrMap;
         $this->cache = $view;
     }
     $expire = $this->expires($this->expire, $expire);
     $tags = array_merge($tags, $this->tags);
     return $this->cache;
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:86,代码来源:Standard.php


示例11: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $codes = array();
         $context = $this->getContext();
         $input = $view->param('f_search');
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $filter = $controller->createTextFilter($input, null, '+', 0, 25, 'default', 'name');
         $texts = $controller->getTextList($filter);
         /** client/html/catalog/suggest/usecode
          * Enables product suggestions based on using the product code
          *
          * The suggested entries for the full text search in the catalog filter component
          * are based on the product names by default. By setting this option to true or 1,
          * you can add suggestions based on the product codes as well.
          *
          * @param boolean True to search for product codes too, false for product names only
          * @since 2016.09
          * @category Developer
          */
         if ($context->getConfig()->get('client/html/catalog/suggest/usecode', false)) {
             $filter = $controller->createTextFilter($input, null, '+', 0, 25, 'default', 'code');
             $codes = $controller->getTextList($filter);
         }
         /** client/html/catalog/suggest/domains
          * List of domain items that should be fetched along with the products
          *
          * The suggsted entries for the full text search in the catalog filter component
          * usually consist of the names of the matched products. By default, only the
          * product item including the localized name is available. You can add more domains
          * like e.g. "media" to get the images of the product as well.
          *
          * '''Note:''' The more domains you will add, the slower the autocomplete requests
          * will be! Keep it to an absolute minium for user friendly response times.
          *
          * @param array List of domain names
          * @since 2016.08
          * @category Developer
          * @see client/html/catalog/suggest/standard/template-body
          */
         $domains = $context->getConfig()->get('client/html/catalog/suggest/domains', array());
         $manager = $controller->createManager('product');
         $search = $manager->createSearch(true);
         $expr = array($search->compare('==', 'product.id', array_merge(array_keys($texts), array_keys($codes))), $search->getConditions());
         $search->setConditions($search->combine('&&', $expr));
         $result = $manager->searchItems($search, $domains);
         // shortcut to avoid having to fetch the text items to get the the localized name
         foreach ($result as $id => $item) {
             if (isset($texts[$id])) {
                 $item->setLabel($texts[$id]);
             }
         }
         $view->suggestItems = $result;
         $this->cache = $view;
     }
     return $this->cache;
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:65,代码来源:Standard.php


示例12: getProductItems

 /**
  * Returns the product items for the given IDs.
  *
  * @param string[] $ids List of product IDs
  * @return \Aimeos\MShop\Product\Item\Iface[] List of product items
  */
 protected function getProductItems(array $ids)
 {
     $context = $this->getContext();
     $config = $context->getConfig();
     /** client/html/basket/related/bought/standard/domains
      * The list of domain names whose items should be available in the template for the products
      *
      * The templates rendering product details usually add the images,
      * prices and texts, etc. associated to the product
      * item. If you want to display additional or less content, you can
      * configure your own list of domains (attribute, media, price, product,
      * text, etc. are domains) whose items are fetched from the storage.
      * Please keep in mind that the more domains you add to the configuration,
      * the more time is required for fetching the content!
      *
      * @param array List of domain names
      * @since 2014.09
      * @category Developer
      */
     $domains = array('text', 'price', 'media');
     $domains = $config->get('client/html/basket/related/bought/standard/domains', $domains);
     $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
     return $controller->getProductItems($ids, $domains);
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:30,代码来源:Standard.php


示例13: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $config = $context->getConfig();
         if ($config->get('client/html/catalog/lists/basket-add', false)) {
             $products = $view->get('listProductItems', array());
             $domains = array('media', 'price', 'text', 'attribute', 'product');
             $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
             $productIds = $this->getProductIds($products);
             $productManager = $controller->createManager('product');
             $productItems = $this->getDomainItems($productManager, 'product.id', $productIds, $domains);
             $this->addMetaItems($productItems, $this->expire, $this->tags);
             $attrIds = $this->getAttributeIds($productItems);
             $attributeManager = $controller->createManager('attribute');
             $attributeItems = $this->getDomainItems($attributeManager, 'attribute.id', $attrIds, $domains);
             $this->addMetaItems($attributeItems, $this->expire, $this->tags);
             $mediaIds = $this->getMediaIds($productItems);
             $mediaManager = $controller->createManager('media');
             $mediaItems = $this->getDomainItems($mediaManager, 'media.id', $mediaIds, $domains);
             $this->addMetaItems($mediaItems, $this->expire, $this->tags);
             if (!empty($productIds) && $config->get('client/html/catalog/lists/stock/enable', true) === true) {
                 $view->itemsStockUrl = $this->getStockUrl($view, $productIds);
             }
             $view->itemsAttributeItems = $attributeItems;
             $view->itemsProductItems = $productItems;
             $view->itemsMediaItems = $mediaItems;
         }
         $view->itemPosition = ($this->getProductListPage($view) - 1) * $this->getProductListSize($view);
         $this->cache = $view;
     }
     return $this->cache;
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:41,代码来源:Standard.php


示例14: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
         $view->standardBasket = $basketCntl->get();
         /** client/html/checkout/standard/url/step-active
          * Name of the checkout process step to jump to if no previous step requires attention
          *
          * The checkout process consists of several steps which are usually
          * displayed one by another to the customer. If the data of a step
          * is already available, then that step is skipped. The active step
          * is the one that is displayed if all other steps are skipped.
          *
          * If one of the previous steps misses some data the customer has
          * to enter, then this step is displayed first. After providing
          * the missing data, the whole series of steps are tested again
          * and if no other step requests attention, the configured active
          * step will be displayed.
          *
          * The order of the steps is determined by the order of sub-parts
          * that are configured for the checkout client.
          *
          * @param string Name of the confirm standard HTML client
          * @since 2014.07
          * @category Developer
          * @category User
          * @see client/html/checkout/standard/standard/subparts
          */
         $default = $view->config('client/html/checkout/standard/url/step-active', 'summary');
         /** client/html/checkout/standard/onepage
          * Shows all named checkout subparts at once for a one page checkout
          *
          * Normally, the checkout process is divided into several steps for entering
          * addresses, select delivery and payment options as well as showing the
          * summary page. This enables dependencies between two steps like showing
          * delivery options based on the address entered by the customer. Furthermore,
          * this is good way to limit the amount of information displayed which is
          * preferred by mobile users.
          *
          * Contrary to that, a one page checkout displays all information on only
          * one page and customers get an immediate overview of which information
          * they have to enter and what options they can select from. This is an
          * advantage if only a very limited amount of information must be entered
          * or if there are almost no options to choose from and no dependencies
          * between exist.
          *
          * Using this config options, shop developers are able to define which
          * checkout subparts are combined to a one page view. Simply add the names
          * of all checkout subparts to the list. Available checkout subparts for
          * a one page checkout are:
          * * address
          * * delivery
          * * payment
          * * summary
          *
          * @param array List of checkout subparts name
          * @since 2015.05
          * @category Developer
          */
         $onepage = $view->config('client/html/checkout/standard/onepage', array());
         $onestep = !empty($onepage) ? array_shift($onepage) : $default;
         // keep the first one page step
         $steps = (array) $context->getConfig()->get($this->subPartPath, $this->subPartNames);
         $steps = array_diff($steps, $onepage);
         // remove all remaining steps in $onepage
         // use first step if default step isn't available
         $default = !in_array($default, $steps) ? reset($steps) : $default;
         $current = $view->param('c_step', $default);
         // use $onestep if the current step isn't available due to one page layout
         if (!in_array($current, $steps)) {
             $current = $onestep;
         }
         // use $onestep if the active step isn't available due to one page layout
         if (isset($view->standardStepActive) && in_array($view->standardStepActive, $onepage)) {
             $view->standardStepActive = $onestep;
         }
         $cpos = array_search($current, $steps);
         if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) {
             $view->standardStepActive = $current;
         }
         $view->standardSteps = $steps;
         $this->cache = $this->addNavigationUrls($view, $steps, $view->standardStepActive);
     }
     return $this->cache;
 }
开发者ID:aimeos,项目名称:ai-client-html,代码行数:94,代码来源:Standard.php


示例15: setViewParams

 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
         $serviceCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'service');
         $basket = $basketCntl->get();
         $services = $serviceCntl->getServices('payment', $basket);
         $serviceAttributes = $servicePrices = array();
         foreach ($services as $id => $service) {
             $serviceAttributes[$id] = $serviceCntl->getServiceAttributes('payment', $id, $basket);
             $servicePrices[$id] = $serviceCntl->getServicePrice('payment', $id, $basket);
         }
         $view->paymentServices = $services;
         $view->paymentServiceAttributes = $serviceAttributes;
         $view->paymentServicePrices = $servicePrices;
         $this->cache = $view;
     }
     return $this->cache;
 }
开发者ID:mvnp,项目名称:aimeos-core,代码行数:28,代码来源:Standard.php



鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP MShop\Factory类代码示例发布时间:2022-05-23
下一篇:
PHP Model\AuthGroupModel类代码示例发布时间: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