/** * 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)) { $products = array(); $context = $this->getContext(); $config = $context->getConfig(); if (isset($view->listCurrentCatItem)) { /** client/html/catalog/lists/promo/size * The maximum number of products that should be shown in the promotion section * * Each product list can render a list of promoted products on * top if there are any products associated to that category whose * list type is "promotion". This option limits the maximum number * of products that are displayed. It takes only effect if more * promotional products are added to this category than the set * value. * * @param integer Number of promotion products * @since 2014.03 * @category User * @category Developer */ $size = $config->get('client/html/catalog/lists/promo/size', 6); $domains = $config->get('client/html/catalog/lists/domains', array('media', 'price', 'text')); $total = null; $catId = $view->listCurrentCatItem->getId(); $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog'); $filter = $controller->createIndexFilterCategory($catId, 'relevance', '+', 0, $size, 'promotion'); $products = $controller->getIndexItems($filter, $domains, $total); } if (!empty($products) && $config->get('client/html/catalog/lists/stock/enable', true) === true) { $stockTarget = $config->get('client/html/catalog/stock/url/target'); $stockController = $config->get('client/html/catalog/stock/url/controller', 'catalog'); $stockAction = $config->get('client/html/catalog/stock/url/action', 'stock'); $stockConfig = $config->get('client/html/catalog/stock/url/config', array()); $productIds = array_keys($products); sort($productIds); $params = array('s_prodid' => implode(' ', $productIds)); $view->promoStockUrl = $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); } $this->addMetaItem($products, 'product', $this->expire, $this->tags); $this->addMetaList(array_keys($products), 'product', $this->expire); $view->promoItems = $products; $this->cache = $view; } $expire = $this->expires($this->expire, $expire); $tags = array_merge($tags, $this->tags); return $this->cache; }
/** * 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 * 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 = array_shift($onepage); // 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 current step isn't available due to one page layout $current = !in_array($current, $steps) ? $onestep : $current; $cpos = $cpos = array_search($current, $steps); if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) { $view->standardStepActive = $current; } $activeStep = $view->standardStepActive; $view->standardSteps = $steps; $step = null; do { $lastStep = $step; } while (($step = array_shift($steps)) !== null && $step !== $activeStep); if ($lastStep !== null) { $param = array('c_step' => $lastStep); $view->standardUrlBack = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig); } else { $view->standardUrlBack = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig); } if (!isset($view->standardUrlNext) && ($nextStep = array_shift($steps)) !== null) { $param = array('c_step' => $nextStep); $view->standardUrlNext = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig); } // don't overwrite $view->standardUrlNext so order step URL is used $this->cache = $view; } return $this->cache; }
/** * Returns the URL to the update page. * * @param \Aimeos\MW\View\Iface $view View object * @param array $params Parameters that should be part of the URL * @param array $config Default URL configuration * @return string URL string */ protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config) { /** client/html/checkout/update/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/update/url/controller * @see client/html/checkout/update/url/action * @see client/html/checkout/update/url/config */ $target = $view->config('client/html/checkout/update/url/target'); /** client/html/checkout/update/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/update/url/target * @see client/html/checkout/update/url/action * @see client/html/checkout/update/url/config */ $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout'); /** client/html/checkout/update/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/update/url/target * @see client/html/checkout/update/url/controller * @see client/html/checkout/update/url/config */ $action = $view->config('client/html/checkout/update/url/action', 'update'); /** client/html/checkout/update/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/update/url/target * @see client/html/checkout/update/url/controller * @see client/html/checkout/update/url/action * @see client/html/url/config */ $config = $view->config('client/html/checkout/update/url/config', $config); return $view->url($target, $cntl, $action, $params, array(), $config); }
/** * Returns the URL to fetch the stock level details of the given products * * @param \Aimeos\MW\View\Iface $view View object * @param array $productIds List of product IDs * @return string Generated stock level URL */ protected function getStockUrl(\Aimeos\MW\View\Iface $view, array $productIds) { $stockTarget = $view->config('client/html/catalog/stock/url/target'); $stockController = $view->config('client/html/catalog/stock/url/controller', 'catalog'); $stockAction = $view->config('client/html/catalog/stock/url/action', 'stock'); $stockConfig = $view->config('client/html/catalog/stock/url/config', array()); sort($productIds); $params = array('s_prodid' => implode(' ', $productIds)); return $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); }
/** * 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)) { $config = $this->getContext()->getConfig(); /** client/html/catalog/count/enable * Enables or disables displaying product counts in the catalog filter * * This configuration option allows shop owners to display product * counts in the catalog filter or to disable fetching product count * information. * * The product count information is fetched via AJAX and inserted via * Javascript. This allows to cache parts of the catalog filter by * leaving out such highly dynamic content like product count which * changes with used filter parameter. * * @param boolean Value of "1" to display product counts, "0" to disable them * @since 2014.03 * @category User * @category Developer * @see client/html/catalog/count/url/target * @see client/html/catalog/count/url/controller * @see client/html/catalog/count/url/action * @see client/html/catalog/count/url/config */ if ($config->get('client/html/catalog/count/enable', true) == true) { /** client/html/catalog/count/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/catalog/count/url/controller * @see client/html/catalog/count/url/action * @see client/html/catalog/count/url/config */ $target = $config->get('client/html/catalog/count/url/target'); /** client/html/catalog/count/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/catalog/count/url/target * @see client/html/catalog/count/url/action * @see client/html/catalog/count/url/config */ $controller = $config->get('client/html/catalog/count/url/controller', 'catalog'); /** client/html/catalog/count/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/catalog/count/url/target * @see client/html/catalog/count/url/controller * @see client/html/catalog/count/url/config */ $action = $config->get('client/html/catalog/count/url/action', 'count'); /** client/html/catalog/count/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/catalog/count/url/target * @see client/html/catalog/count/url/controller * @see client/html/catalog/count/url/action * @see client/html/url/config */ $config = $config->get('client/html/catalog/count/url/config', array()); $params = $this->getClientParams($view->param(), array('f')); $view->filterCountUrl = $view->url($target, $controller, $action, $params, array(), $config); } $this->cache = $view; } return $this->cache; }
/** * Adds the "back" and "next" URLs to the view * * @param \Aimeos\MW\View\Iface $view View object * @param array $steps List of checkout step names * @param unknown $activeStep Name of the active step * @return \Aimeos\MW\View\Iface Enhanced view object * @since 2016.05 */ protected function addNavigationUrls(\Aimeos\MW\View\Iface $view, array $steps, $activeStep) { /** 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()); $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()); $step = null; do { $lastStep = $step; } while (($step = array_shift($steps)) !== null && $step !== $activeStep); if ($lastStep !== null) { $param = array('c_step' => $lastStep); $view->standardUrlBack = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig); } else { $view->standardUrlBack = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig); } if (!isset($view->standardUrlNext) && ($nextStep = array_shift($steps)) !== null) { $param = array('c_step' => $nextStep); $view->standardUrlNext = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig); } // don't overwrite $view->standardUrlNext so order step URL is used return $view; }
/** * 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; }
/** * 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(); $site = $context->getLocale()->getSite()->getCode(); if (($params = $context->getSession()->get('aimeos/catalog/detail/params/last' . $site)) !== null) { $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()); } else { $params = $context->getSession()->get('aimeos/catalog/lists/params/last' . $site, array()); $target = $view->config('client/html/catalog/list/url/target'); $controller = $view->config('client/html/catalog/list/url/controller', 'catalog'); $action = $view->config('client/html/catalog/list/url/action', 'list'); $config = $view->config('client/html/catalog/list/url/config', array()); } $view->standardParams = $this->getClientParams($view->param()); $view->standardBackUrl = $view->url($target, $controller, $action, $params, array(), $config); $view->standardBasket = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket')->get(); $this->cache = $view; } return $this->cache; }
/** * Returns the URL to the update page. * * @param \Aimeos\MW\View\Iface $view View object * @param array $params Parameters that should be part of the URL * @param array $config Default URL configuration * @return string URL string */ protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config) { $target = $view->config('client/html/checkout/update/url/target'); $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout'); $action = $view->config('client/html/checkout/update/url/action', 'update'); $config = $view->config('client/html/checkout/update/url/config', $config); return $view->url($target, $cntl, $action, $params, array(), $config); }
/** * 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)) { $config = $this->getContext()->getConfig(); /** client/html/catalog/detail/stock/enable * Enables or disables displaying product stock levels in product detail view * * This configuration option allows shop owners to display product * stock levels for each product in the detail 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/lists/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 (isset($view->detailProductItem) && $config->get('client/html/catalog/detail/stock/enable', true) === true) { $stockTarget = $config->get('client/html/catalog/stock/url/target'); $stockController = $config->get('client/html/catalog/stock/url/controller', 'catalog'); $stockAction = $config->get('client/html/catalog/stock/url/action', 'stock'); $stockConfig = $config->get('client/html/catalog/stock/url/config', array()); $prodIds = array_keys($view->detailProductItem->getRefItems('product', null, 'default')); array_unshift($prodIds, $view->detailProductItem->getId()); $params = array('s_prodid' => $prodIds); $view->basketStockUrl = $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); $view->basketProductIds = $prodIds; } $this->cache = $view; } return $this->cache; }