/** * Returns the required params for the stage clients, either from GET/POST or from the session. * * @param MW_View_Interface $view The view object which generates the HTML output * @return array List of parameters */ protected function _getParamStage(MW_View_Interface $view) { if (!isset($this->_params)) { $params = $this->_getClientParams($view->param(), array('f')); if (empty($params)) { $params = $this->_getContext()->getSession()->get('arcavias/catalog/list/params/last', '[]'); $params = ($data = json_decode($params, true)) !== null && is_array($data) ? $data : array(); } $this->_params = $params; } return $this->_params; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $input = $view->param('f_search'); $controller = Controller_Frontend_Factory::createController($this->_getContext(), 'catalog'); $filter = $controller->createTextFilter($input); $items = $controller->getTextList($filter); $suggestTextItems = array(); foreach ($items as $id => $name) { $suggestTextItems[] = array("id" => $id, "name" => $name); } $view->suggestTextItems = $suggestTextItems; $this->_cache = $view; } return $this->_cache; }
/** * Returns the current active step. * * @param MW_View_Interface $view View object * @param array $steps Ordered list of steps through the checkout process * @param string $default Default step */ protected function _getStepActive(MW_View_Interface $view, array $steps, $default) { $current = $view->param('c-step', $default); $cpos = $cpos = array_search($current, $steps); if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) { $view->standardStepActive = $current; } return $view->standardStepActive; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $map = array(); $context = $this->_getContext(); $locale = $context->getLocale(); $manager = MShop_Factory::createManager($context, 'locale'); $search = $manager->createSearch(true); $search->setSortations(array($search->sort('-', 'locale.position'))); foreach ($manager->searchItems($search) as $item) { $map[$item->getLanguageId()][$item->getCurrencyId()] = $item; } $view->selectItems = $map; $view->selectLanguageId = $locale->getLanguageId(); $view->selectCurrencyId = $locale->getCurrencyId(); $view->selectParams = $this->_getClientParams($view->param(), array('f', 'l', 'd')); $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $view The view object which generates the HTML output * @return MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $attrMap = array(); $controller = 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; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $expire = null; $tags = $items = array(); $context = $this->_getContext(); $config = $context->getConfig(); $session = $context->getSession(); $default = array('media', 'price', 'text'); $domains = $config->get('client/html/catalog/domains', $default); /** client/html/catalog/detail/pinned/domains * A list of domain names whose items should be available in the pinned view template for the product * * 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 * @see client/html/catalog/domains * @see client/html/catalog/list/domains * @see client/html/catalog/detail/domains */ $domains = $config->get('client/html/catalog/detail/pinned/domains', $domains); $str = $session->get('arcavias/catalog/session/pinned/list', ''); if (($pinned = @unserialize($str)) === false) { $pinned = array(); } $manager = MShop_Factory::createManager($context, 'product'); $search = $manager->createSearch(true); $search->setConditions($search->compare('==', 'product.id', $pinned)); $result = $manager->searchItems($search, $domains); foreach (array_reverse($pinned) as $id) { if (isset($result[$id])) { $items[$id] = $result[$id]; } } $view->pinnedProductItems = $items; $view->pinnedParams = $this->_getClientParams($view->param()); $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $customerManager = MShop_Factory::createManager($context, 'customer'); $search = $customerManager->createSearch(true); $expr = array($search->compare('==', 'customer.id', $context->getUserId()), $search->getConditions()); $search->setConditions($search->combine('&&', $expr)); $items = $customerManager->searchItems($search); if (($item = reset($items)) !== false) { $view->addressCustomerItem = $item; $customerAddressManager = MShop_Factory::createManager($context, 'customer/address'); $search = $customerAddressManager->createSearch(); $search->setConditions($search->compare('==', 'customer.address.refid', $item->getId())); $view->addressCustomerAddressItems = $customerAddressManager->searchItems($search); } $localeManager = MShop_Factory::createManager($context, 'locale'); $locales = $localeManager->searchItems($localeManager->createSearch(true)); $languages = array(); foreach ($locales as $locale) { $languages[] = $locale->getLanguageId(); } $view->addressLanguages = $languages; /** client/html/common/address/countries * List of available countries that that users can select from in the front-end * * This configration option is used whenever a list of countries is * shown in the front-end users can select from. It's used e.g. * if the customer should select the country he is living in the * checkout process. In case that the list is empty, no country * selection is shown. * * Each list entry must be a two letter ISO country code that is then * translated into its name. The codes have to be upper case * characters like "DE" for Germany or "GB" for Great Britain, e.g. * * array( 'DE', 'GB', ... ) * * To display the country selection, you have to add the key for the * country ID (order.base.address.languageid) to the "mandatory" or * "optional" configuration option for billing and delivery addresses. * * @param array List of two letter ISO country codes * @since 2014.03 * @category User * @category Developer * @see client/html/common/address/billing/mandatory * @see client/html/common/address/billing/optional * @see client/html/common/address/delivery/mandatory * @see client/html/common/address/delivery/optional */ $view->addressCountries = $view->config('client/html/common/address/countries', array()); /** client/html/common/address/states * List of available states that that users can select from in the front-end * * This configration option is used whenever a list of states is * shown in the front-end users can select from. It's used e.g. * if the customer should select the state he is living in the * checkout process. In case that the list is empty, no state * selection is shown. * * A two letter ISO country code must be the key for the list of * states that belong to this country. The list of states must then * contain the state code as key and its name as values, e.g. * * array( * 'US' => array( * 'CA' => 'California', * 'NY' => 'New York', * ... * ), * ... * ); * * The codes have to be upper case characters like "US" for the * United States or "DE" for Germany. The order of the country and * state codes determine the order of the states in the frontend and * the state codes are later used for per state tax calculation. * * To display the country selection, you have to add the key for the * state (order.base.address.state) to the "mandatory" or * "optional" configuration option for billing and delivery addresses. * You also need to add order.base.address.countryid as well because * it is required to display the states that belong to this country. * * @param array Multi-dimensional list ISO country codes and state codes/names * @since 2014.09 * @category User * @category Developer * @see client/html/common/address/billing/mandatory * @see client/html/common/address/billing/optional * @see client/html/common/address/delivery/mandatory * @see client/html/common/address/delivery/optional */ $view->addressStates = $view->config('client/html/common/address/states', array()); $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_view)) { $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->_view = $view; } return $this->_view; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $attributeTypes = array(); $attrItems = $view->get('detailProductAttributeItems', array()); $configAttributes = $view->detailProductItem->getRefItems('attribute', null, 'config'); foreach ($configAttributes as $id => $attribute) { if (isset($attrItems[$id])) { $attributeTypes[$attrItems[$id]->getType()][$id] = $attrItems[$id]; } } $view->attributeConfigItems = $attributeTypes; $view->attributeCustomItems = $view->detailProductItem->getRefItems('attribute', null, 'custom'); $view->attributeHiddenItems = $view->detailProductItem->getRefItems('attribute', null, 'hidden'); $this->_cache = $view; } return $this->_cache; }
/** * Returns the URL to the update page. * * @param MW_View_Interface $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(MW_View_Interface $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); }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $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/list/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-product-id' => $prodIds); $view->basketStockUrl = $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig); $view->basketProductIds = $prodIds; } $view->basketParams = $this->_getClientParams($view->param()); $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $map = array(); $context = $this->_getContext(); $config = $context->getConfig(); $locale = $context->getLocale(); /** client/html/locale/select/language/param-name * Name of the parameter that contains the language ID value * * Frameworks and applications normally use its own predefined parameter * that contains the current language ID if they are multi-language * capable. To adapt the Aimeos parameter name to the already used name, * you are able to configure it by using this setting. * * @param string Parameter name for language ID * @since 2015.06 * @see client/html/locale/select/currency/param-name */ $langname = $config->get('client/html/locale/select/language/param-name', 'loc_languageid'); /** client/html/locale/select/currency/param-name * Name of the parameter that contains the currency ID value * * Frameworks and applications normally use its own predefined parameter * that contains the current currency ID if they already support multiple * currencies. To adapt the Aimeos parameter name to the already used name, * you are able to configure it by using this setting. * * @param string Parameter name for currency ID * @since 2015.06 * @see client/html/locale/select/language/param-name */ $curname = $config->get('client/html/locale/select/currency/param-name', 'loc_currencyid'); $manager = MShop_Factory::createManager($context, 'locale'); $search = $manager->createSearch(true); $search->setSortations(array($search->sort('+', 'locale.position'))); foreach ($manager->searchItems($search) as $item) { $curId = $item->getCurrencyId(); $langId = $item->getLanguageId(); $map[$langId][$curId] = array($langname => $langId, $curname => $curId); } $view->selectMap = $map; $view->selectLanguageId = $locale->getLanguageId(); $view->selectCurrencyId = $locale->getCurrencyId(); $view->selectParams = $this->_getClientParams($view->param(), array('f', 'l', 'd')); $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $domains = array('media', 'price', 'text', 'attribute', 'product'); $productItem = $this->_getProductItem($view->param('d_prodid'), $domains); $controller = Controller_Frontend_Factory::createController($context, 'catalog'); $attrManager = $controller->createManager('attribute'); $attrSearch = $attrManager->createSearch(true); $expr = array($attrSearch->compare('==', 'attribute.id', array_keys($productItem->getRefItems('attribute'))), $attrSearch->getConditions()); $attrSearch->setConditions($attrSearch->combine('&&', $expr)); $attributes = $attrManager->searchItems($attrSearch, $domains); $this->_addMetaItem($attributes, 'attribute', $this->_expire, $this->_tags); $this->_addMetaList(array_keys($attributes), 'attribute', $this->_expire); $mediaManager = $controller->createManager('media'); $mediaSearch = $mediaManager->createSearch(true); $expr = array($mediaSearch->compare('==', 'media.id', array_keys($productItem->getRefItems('media'))), $mediaSearch->getConditions()); $mediaSearch->setConditions($mediaSearch->combine('&&', $expr)); $media = $mediaManager->searchItems($mediaSearch, $domains); $this->_addMetaItem($media, 'media', $this->_expire, $this->_tags); $this->_addMetaList(array_keys($media), 'media', $this->_expire); $view->detailProductItem = $productItem; $view->detailProductAttributeItems = $attributes; $view->detailProductMediaItems = $media; $view->detailParams = $this->_getClientParams($view->param()); $this->_cache = $view; } $expire = $this->_expires($this->_expire, $expire); $tags = array_merge($tags, $this->_tags); return $this->_cache; }
/** * Updates the payment status for the given order ID and returns the order item * * @param MW_View_Interface $view View object of the HTML client * @param string $orderid ID of the order whose payment status should be updated * @return void|MShop_Order_Item_Interface Order item that has been updated */ protected function _updatePayment(MW_View_Interface $view, $orderid) { if (($code = $view->param('code')) === null) { return; } $provider = $this->_getServiceProvider($code); $config = array('absoluteUri' => true, 'namespace' => false); $params = array('code' => $code, 'orderid' => $orderid); $urls = array('payment.url-success' => $this->_getUrlConfirm($view, $params, $config), 'payment.url-update' => $this->_getUrlUpdate($view, $params, $config), 'client.ipaddress' => $view->request()->getClientAddress()); $urls['payment.url-self'] = $urls['payment.url-success']; $provider->injectGlobalConfigBE($urls); $reqParams = $view->param(); $reqParams['orderid'] = $orderid; if (($orderItem = $provider->updateSync($reqParams, $view->request()->getBody())) !== null && $orderItem->getPaymentStatus() === MShop_Order_Item_Abstract::PAY_UNFINISHED && $provider->isImplemented(MShop_Service_Provider_Payment_Abstract::FEAT_QUERY)) { $provider->query($orderItem); } return $orderItem; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $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/list/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/list/promo/size', 6); $domains = $config->get('client/html/catalog/list/domains', array('media', 'price', 'text')); $manager = MShop_Factory::createManager($context, 'catalog/list'); $search = $manager->createSearch(true); $expr = array($search->compare('==', 'catalog.list.parentid', $view->listCurrentCatItem->getId()), $search->compare('==', 'catalog.list.domain', 'product'), $search->compare('==', 'catalog.list.type.code', 'promotion'), $search->getConditions()); $search->setConditions($search->combine('&&', $expr)); $sort = array($search->sort('+', 'catalog.list.parentid'), $search->sort('+', 'catalog.list.siteid'), $search->sort('+', 'catalog.list.position')); $search->setSortations($sort); $search->setSlice(0, $size); $result = $manager->searchRefItems($search, $domains); if (isset($result['product'])) { $products = $result['product']; } } if (!empty($products) && $config->get('client/html/catalog/list/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-product-id' => 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 MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $mediaItems = array(); $catPath = $view->get('stageCatPath', array()); foreach (array_reverse($catPath) as $catItem) { $mediaItems = $catItem->getRefItems('media', 'default', 'stage'); if (!empty($mediaItems)) { break; } } $view->imageItems = $mediaItems; $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $manager = MShop_Factory::createManager($context, 'order'); $orderId = $view->param('his_id', null); if ($orderId !== null) { $search = $manager->createSearch(true); $expr = array($search->getConditions(), $search->compare('==', 'order.id', $orderId), $search->compare('==', 'order.base.customerid', $context->getUserId())); $search->setConditions($search->combine('&&', $expr)); $orderItems = $manager->searchItems($search); if (($orderItem = reset($orderItems)) === false) { $msg = $view->translate('client/html', 'Order with ID "%1$s" not found'); throw new Client_Html_Exception(sprintf($msg, $orderId)); } $baseManager = MShop_Factory::createManager($context, 'order/base'); $view->summaryBasket = $baseManager->load($orderItem->getBaseId()); } $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $view->actionsParams = $this->_getClientParams($view->param()); $this->_cache = $view; } return $this->_cache; }
/** * Returns the required params for the stage clients, either from GET/POST or from the session. * * @param MW_View_Interface $view The view object which generates the HTML output * @return array List of parameters */ protected function _getParamStage(MW_View_Interface $view) { if (!isset($this->_params)) { $params = $this->_getClientParams($view->param(), array('f')); if (empty($params)) { $context = $this->_getContext(); $site = $context->getLocale()->getSite()->getCode(); $params = $context->getSession()->get('arcavias/catalog/list/params/last/' . $site, array()); } $this->_params = $params; } return $this->_params; }
/** * Edits the products specified by the view parameters to the basket. * * @param MW_View_Interface $view View object * @param array $options List of options for editProducts() in basket controller */ protected function _editProducts(MW_View_Interface $view, array $options) { $this->_clearCached(); $products = (array) $view->param('b-prod', array()); $controller = Controller_Frontend_Factory::createController($this->_getContext(), 'basket'); if (($positon = $view->param('b-position', null)) !== null) { $products[] = array('position' => $positon, 'quantity' => $view->param('b-quantity', 1), 'attrconf-code' => array_filter((array) $view->param('b-attrconf-code', array()))); } foreach ($products as $values) { $controller->editProduct(isset($values['position']) ? $values['position'] : null, isset($values['quantity']) ? $values['quantity'] : 1, $options, isset($values['attrconf-code']) ? array_filter((array) $values['attrconf-code']) : array()); } }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $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/list/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/list/promo/size', 6); $domains = $config->get('client/html/catalog/list/domains', array('media', 'price', 'text')); $total = null; $catId = $view->listCurrentCatItem->getId(); $controller = 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/list/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; }
/** * Returns the sanitized sortation from the parameters for the product list. * * @param MW_View_Interface $view View instance with helper for retrieving the required parameters * @param string &$sortdir Value-result parameter where the sort direction will be stored * @return string Sortation string (relevance, name, price) */ protected function _getProductListSort(MW_View_Interface $view, &$sortdir) { return $this->_getProductListSortByParam($view->param(), $sortdir); }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $siteConfig = $context->getLocale()->getSite()->getConfig(); /** client/html/catalog/stock/sort * Sortation key if stock levels for different warehouses exist * * Products can be shipped from several warehouses with a different * stock level for each one. The stock levels for each warehouse will * be shown in the product detail page. To get a consistent sortation * of this list, the configured key of the product warehouse manager * will be used. * * @param string Key for sorting * @since 2014.03 * @category Developer * @see client/html/catalog/stock/level/low */ $sortkey = $context->getConfig()->get('client/html/catalog/stock/sort', 'product.stock.warehouseid'); $productIds = $view->param('s_prodid'); if (!is_array($productIds)) { $productIds = explode(' ', $productIds); } $stockManager = MShop_Factory::createManager($context, 'product/stock'); $search = $stockManager->createSearch(true); $expr = array($search->compare('==', 'product.stock.productid', $productIds)); if (isset($siteConfig['warehouse'])) { $expr[] = $search->compare('==', 'product.stock.warehouse.code', $siteConfig['warehouse']); } $expr[] = $search->getConditions(); $sortations = array($search->sort('+', 'product.stock.productid'), $search->sort('+', $sortkey)); $search->setConditions($search->combine('&&', $expr)); $search->setSortations($sortations); $search->setSlice(0, 0x7fffffff); $stockItems = $stockManager->searchItems($search); if (!empty($stockItems)) { $warehouseIds = $stockItemsByProducts = array(); foreach ($stockItems as $item) { $warehouseIds[$item->getWarehouseId()] = null; $stockItemsByProducts[$item->getProductId()][] = $item; } $warehouseIds = array_keys($warehouseIds); $warehouseManager = MShop_Factory::createManager($context, 'product/stock/warehouse'); $search = $warehouseManager->createSearch(); $search->setConditions($search->compare('==', 'product.stock.warehouse.id', $warehouseIds)); $search->setSlice(0, count($warehouseIds)); $view->stockWarehouseItems = $warehouseManager->searchItems($search); $view->stockItemsByProducts = $stockItemsByProducts; } $view->stockProductIds = $productIds; $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_view)) { $context = $this->_getContext(); $config = $context->getConfig(); $prodid = $view->param('d-product-id'); $default = array('media', 'price', 'text', 'attribute', 'product'); /** client/html/catalog/domains * A list of domain names whose items should be available in the catalog view templates * * @see client/html/catalog/detail/domains */ $domains = $config->get('client/html/catalog/domains', $default); /** client/html/catalog/detail/domains * A list of domain names whose items should be available in the product detail view template * * The templates rendering product details usually add the images, * prices, texts, attributes, products, 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! * * Since version 2014.05 this configuration option overwrites the * "client/html/catalog/domains" option that allows to configure the * domain names of the items fetched for all catalog related data. * * @param array List of domain names * @since 2014.03 * @category Developer * @see client/html/catalog/domains * @see client/html/catalog/list/domains */ $domains = $config->get('client/html/catalog/detail/domains', $domains); $manager = MShop_Factory::createManager($context, 'product'); $productItem = $manager->getItem($prodid, $domains); $this->_addMetaItem($productItem, 'product', $this->_expire, $this->_tags); $this->_addMetaList($prodid, 'product', $this->_expire); $attrManager = MShop_Factory::createManager($context, 'attribute'); $attrSearch = $attrManager->createSearch(true); $expr = array($attrSearch->compare('==', 'attribute.id', array_keys($productItem->getRefItems('attribute'))), $attrSearch->getConditions()); $attrSearch->setConditions($attrSearch->combine('&&', $expr)); $attributes = $attrManager->searchItems($attrSearch, $default); $this->_addMetaItem($attributes, 'attribute', $this->_expire, $this->_tags); $this->_addMetaList(array_keys($attributes), 'attribute', $this->_expire); $mediaManager = MShop_Factory::createManager($context, 'media'); $mediaSearch = $mediaManager->createSearch(true); $expr = array($mediaSearch->compare('==', 'media.id', array_keys($productItem->getRefItems('media'))), $mediaSearch->getConditions()); $mediaSearch->setConditions($mediaSearch->combine('&&', $expr)); $media = $mediaManager->searchItems($mediaSearch, $default); $this->_addMetaItem($media, 'media', $this->_expire, $this->_tags); $this->_addMetaList(array_keys($media), 'media', $this->_expire); $view->detailProductItem = $productItem; $view->detailProductAttributeItems = $attributes; $view->detailProductMediaItems = $media; $view->detailParams = $this->_getClientParams($view->param()); $this->_view = $view; } $expire = $this->_expires($this->_expire, $expire); $tags = array_merge($tags, $this->_tags); return $this->_view; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $basketCntl = Controller_Frontend_Factory::createController($context, 'basket'); try { $langid = $basketCntl->get()->getAddress('payment')->getLanguageId(); } catch (Exception $e) { $langid = $view->param('ca_billing/order.base.address.languageid', $context->getLocale()->getLanguageId()); } $view->billingLanguage = $langid; /** client/html/checkout/standard/address/billing/hidden * List of billing address input fields that are optional and should be hidden * * You can configure the list of billing address fields that * are hidden when a customer enters his new billing address. * Available field keys are: * * order.base.address.company * * order.base.address.vatid * * order.base.address.salutation * * order.base.address.firstname * * order.base.address.lastname * * order.base.address.address1 * * order.base.address.address2 * * order.base.address.address3 * * order.base.address.postal * * order.base.address.city * * order.base.address.state * * order.base.address.languageid * * order.base.address.countryid * * order.base.address.telephone * * order.base.address.telefax * * order.base.address.email * * order.base.address.website * * Caution: Only hide fields that don't require any input * * Until 2015-02, the configuration option was available as * "client/html/common/address/billing/hidden" starting from 2014-03. * * @param array List of field keys * @since 2015.02 * @category User * @category Developer * @see client/html/checkout/standard/address/billing/disable-new * @see client/html/checkout/standard/address/billing/salutations * @see client/html/checkout/standard/address/billing/mandatory * @see client/html/checkout/standard/address/billing/optional * @see client/html/checkout/standard/address/countries */ $hidden = $view->config('client/html/checkout/standard/address/billing/hidden', array()); if (count($view->get('addressLanguages', array())) === 1) { $hidden[] = 'order.base.address.languageid'; } $salutations = array('company', 'mr', 'mrs'); /** client/html/checkout/standard/address/billing/salutations * List of salutions the customer can select from for the billing address * * The following salutations are available: * * empty string for "unknown" * * company * * mr * * mrs * * miss * * You can modify the list of salutation codes and remove the ones * which shouldn't be used. Adding new salutations is a little bit * more difficult because you have to adapt a few areas in the source * code. * * Until 2015-02, the configuration option was available as * "client/html/common/address/billing/salutations" starting from 2014-03. * * @param array List of available salutation codes * @since 2015.02 * @category User * @category Developer * @see client/html/checkout/standard/address/billing/disable-new * @see client/html/checkout/standard/address/billing/mandatory * @see client/html/checkout/standard/address/billing/optional * @see client/html/checkout/standard/address/billing/hidden * @see client/html/checkout/standard/address/countries */ $view->billingSalutations = $view->config('client/html/checkout/standard/address/billing/salutations', $salutations); $view->billingMandatory = $view->config('client/html/checkout/standard/address/billing/mandatory', $this->_mandatory); $view->billingOptional = $view->config('client/html/checkout/standard/address/billing/optional', $this->_optional); $view->billingHidden = $hidden; $this->_cache = $view; } return $this->_cache; }
/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $view The view object which generates the HTML output * @return MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $manager = MShop_Factory::createManager($context, 'catalog'); /** client/html/catalog/filter/tree/startid * The ID of the category node that should be the root of the displayed category tree * * If you want to display only a part of your category tree, you can * configure the ID of the category node from which rendering the * remaining sub-tree should start. * * In most cases you can set this value via the administration interface * of the shop application. In that case you often can configure the * start ID individually for each catalog filter. * * @param string Category ID * @since 2014.03 * @category User * @category Developer * @see client/html/catalog/filter/tree/levels-always * @see client/html/catalog/filter/tree/levels-only */ $startid = $view->config('client/html/catalog/filter/tree/startid', ''); $currentid = (string) $view->param('f-catalog-id', ''); /** @todo Make referenced domains configurable */ $ref = array('text', 'media', 'attribute'); if ($currentid != '') { $catItems = $manager->getPath($currentid); if ($startid != '') { foreach ($catItems as $key => $item) { if ($key == $startid) { break; } unset($catItems[$key]); } } if (($node = reset($catItems)) === false) { $msg = sprintf('Category with ID "%1$s" not below ID "%2$s"', $currentid, $startid); throw new Client_Html_Exception($msg); } } else { if ($startid != '') { $node = $manager->getItem($startid); $catItems = array($node->getId() => $node); } else { $node = $manager->getTree(null, array(), MW_Tree_Manager_Abstract::LEVEL_ONE); $catItems = array($node->getId() => $node); } } $search = $manager->createSearch(); $expr = $search->compare('==', 'catalog.parentid', array_keys($catItems)); $expr = $search->combine('||', array($expr, $search->compare('==', 'catalog.id', $node->getId()))); /** client/html/catalog/filter/tree/levels-always * The number of levels in the category tree that should be always displayed * * Usually, only the root node and the first level of the category * tree is shown in the frontend. Only if the user clicks on a * node in the first level, the page reloads and the sub-nodes of * the chosen category are rendered as well. * * Using this configuration option you can enforce the given number * of levels to be always displayed. The root node uses level 0, the * categories below level 1 and so on. * * In most cases you can set this value via the administration interface * of the shop application. In that case you often can configure the * levels individually for each catalog filter. * * @param integer Number of tree levels * @since 2014.03 * @category User * @category Developer * @see client/html/catalog/filter/tree/startid * @see client/html/catalog/filter/tree/levels-only */ if (($levels = $view->config('client/html/catalog/filter/tree/levels-always')) != null) { $expr = $search->combine('||', array($expr, $search->compare('<=', 'catalog.level', $levels))); } /** client/html/catalog/filter/tree/levels-only * No more than this number of levels in the category tree should be displayed * * If the user clicks on a category node, the page reloads and the * sub-nodes of the chosen category are rendered as well. * Using this configuration option you can enforce that no more than * the given number of levels will be displayed at all. The root * node uses level 0, the categories below level 1 and so on. * * In most cases you can set this value via the administration interface * of the shop application. In that case you often can configure the * levels individually for each catalog filter. * * @param integer Number of tree levels * @since 2014.03 * @category User * @category Developer * @see client/html/catalog/filter/tree/startid * @see client/html/catalog/filter/tree/levels-always */ if (($levels = $view->config('client/html/catalog/filter/tree/levels-only')) != null) { $expr = $search->combine('&&', array($expr, $search->compare('<=', 'catalog.level', $levels))); } $search->setConditions($expr); $id = $startid != '' ? $startid : null; $level = MW_Tree_Manager_Abstract::LEVEL_TREE; $view->treeCatalogPath = $catItems; $view->treeCatalogTree = $manager->getTree($id, $ref, $level, $search); $view->treeCatalogIds = $this->_getCatalogIds($view->treeCatalogTree, $catItems, $currentid); $view->treeFilterParams = $this->_getClientParams($view->param(), array('f')); $this->_addMetaItemCatalog($view->treeCatalogTree, $this->_expire, $this->_tags); $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 MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_view)) { if (($pos = $view->param('l-pos')) !== null && ($pid = $view->param('d-product-id')) !== null) { if ($pos < 1) { $start = 0; $size = 2; } else { $start = $pos - 1; $size = 3; } $filter = $this->_getProductListFilterByParam($view->get('stageParams', array())); $filter->setSlice($start, $size); $total = null; $controller = Controller_Frontend_Factory::createController($this->_getContext(), 'catalog'); $products = $controller->getProductList($filter, $total, array('text')); if (($count = count($products)) > 1) { $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('a-name' => $product->getName(), 'd-product-id' => $product->getId(), 'l-pos' => $listPos - 1); $view->navigationPrev = $view->url($target, $controller, $action, $param, array(), $config); } if ($listPos < $count - 1 && ($product = end($products)) !== false) { $param = array('a-name' => $product->getName(), 'd-product-id' => $product->getId(), 'l-pos' => $listPos + 1); $view->navigationNext = $view->url($target, $controller, $action, $param, array(), $config); } } } $this->_view = $view; } return $this->_view; }
/** * Returns the sanitized page size from the parameters for the product list. * * @param MW_View_Interface $view View instance with helper for retrieving the required parameters * @return integer Page size */ protected function _getProductListSize(MW_View_Interface $view) { /** client/html/account/watch/size * The number of products shown in a list page for watch products * * Limits the number of products that is shown in the list pages to the * given value. If more products are available, the products are split * into bunches which will be shown on their own list page. The user is * able to move to the next page (or previous one if it's not the first) * to display the next (or previous) products. * * The value must be an integer number from 1 to 100. Negative values as * well as values above 100 are not allowed. The value can be overwritten * per request if the "l-size" parameter is part of the URL. * * @param integer Number of products * @since 2014.09 * @category User * @category Developer * @see client/html/catalog/list/size */ $defaultSize = $this->_getContext()->getConfig()->get('client/html/account/watch/size', 48); $size = (int) $view->param('watch-size', $defaultSize); return $size < 1 || $size > 100 ? $defaultSize : $size; }
/** * Returns the URL to the update page. * * @param MW_View_Interface $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(MW_View_Interface $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 MW_View_Interface $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 MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $basketCntl = 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/default/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; }