Beispiel #1
0
 /**
  * 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);
 }
Beispiel #2
0
 /**
  * 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;
 }
Beispiel #3
0
 /**
  * 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();
         $basketTarget = $view->config('client/html/basket/standard/url/target');
         $basketController = $view->config('client/html/basket/standard/url/controller', 'basket');
         $basketAction = $view->config('client/html/basket/standard/url/action', 'index');
         $basketConfig = $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
          */
         $checkoutTarget = $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
          */
         $checkoutController = $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
          */
         $checkoutAction = $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
          */
         $checkoutConfig = $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');
         $steps = (array) $context->getConfig()->get($this->_subPartPath, $this->_subPartNames);
         $default = !in_array($default, $steps) ? reset($steps) : $default;
         $activeStep = $this->_getStepActive($view, $steps, $default);
         $step = null;
         do {
             $lastStep = $step;
         } while (($step = array_shift($steps)) !== null && $step !== $activeStep);
         if ($lastStep !== null) {
             $view->standardUrlBack = $view->url($checkoutTarget, $checkoutController, $checkoutAction, array('c-step' => $lastStep), array(), $checkoutConfig);
         } else {
             $view->standardUrlBack = $view->url($basketTarget, $basketController, $basketAction, array(), array(), $basketConfig);
         }
         if (($nextStep = array_shift($steps)) !== null) {
             $param = $activeStep === $default ? array('c-step' => $nextStep) : array();
             $view->standardUrlNext = $view->url($checkoutTarget, $checkoutController, $checkoutAction, $param, array(), $checkoutConfig);
         } else {
             $view->standardUrlNext = '';
         }
         $view->standardStepActive = $activeStep;
         $view->standardSteps = $steps;
         $this->_cache = $view;
     }
     return $this->_cache;
 }
Beispiel #4
0
 /**
  * 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;
 }
Beispiel #5
0
 /**
  * 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;
 }
Beispiel #6
0
 /**
  * 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;
 }
Beispiel #7
0
 /**
  * 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;
 }
Beispiel #8
0
 /**
  * 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();
         $params = $context->getSession()->get('arcavias/catalog/detail/params/last', array());
         $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());
         $view->standardParams = $this->_getClientParams($view->param());
         $view->standardBackUrl = $view->url($target, $controller, $action, $params, array(), $config);
         $view->standardBasket = Controller_Frontend_Factory::createController($context, 'basket')->get();
         $this->_cache = $view;
     }
     return $this->_cache;
 }
Beispiel #9
0
 /**
  * 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);
 }
Beispiel #10
0
 /**
  * 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;
 }