예제 #1
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
         $view->standardBasket = $basketCntl->get();
         $bTarget = $view->config('client/html/basket/standard/url/target');
         $bCntl = $view->config('client/html/basket/standard/url/controller', 'basket');
         $bAction = $view->config('client/html/basket/standard/url/action', 'index');
         $bConfig = $view->config('client/html/basket/standard/url/config', array());
         /** client/html/checkout/standard/url/target
          * Destination of the URL where the controller specified in the URL is known
          *
          * The destination can be a page ID like in a content management system or the
          * module of a software development framework. This "target" must contain or know
          * the controller that should be called by the generated URL.
          *
          * @param string Destination of the URL
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/action
          * @see client/html/checkout/standard/url/config
          */
         $cTarget = $view->config('client/html/checkout/standard/url/target');
         /** client/html/checkout/standard/url/controller
          * Name of the controller whose action should be called
          *
          * In Model-View-Controller (MVC) applications, the controller contains the methods
          * that create parts of the output displayed in the generated HTML page. Controller
          * names are usually alpha-numeric.
          *
          * @param string Name of the controller
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/action
          * @see client/html/checkout/standard/url/config
          */
         $cCntl = $view->config('client/html/checkout/standard/url/controller', 'checkout');
         /** client/html/checkout/standard/url/action
          * Name of the action that should create the output
          *
          * In Model-View-Controller (MVC) applications, actions are the methods of a
          * controller that create parts of the output displayed in the generated HTML page.
          * Action names are usually alpha-numeric.
          *
          * @param string Name of the action
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/config
          */
         $cAction = $view->config('client/html/checkout/standard/url/action', 'index');
         /** client/html/checkout/standard/url/config
          * Associative list of configuration options used for generating the URL
          *
          * You can specify additional options as key/value pairs used when generating
          * the URLs, like
          *
          *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
          *
          * The available key/value pairs depend on the application that embeds the e-commerce
          * framework. This is because the infrastructure of the application is used for
          * generating the URLs. The full list of available config options is referenced
          * in the "see also" section of this page.
          *
          * @param string Associative list of configuration options
          * @since 2014.03
          * @category Developer
          * @see client/html/checkout/standard/url/target
          * @see client/html/checkout/standard/url/controller
          * @see client/html/checkout/standard/url/action
          * @see client/html/url/config
          */
         $cConfig = $view->config('client/html/checkout/standard/url/config', array());
         /** client/html/checkout/standard/url/step-active
          * Name of the checkout process step to jump to if no previous step requires attention
          *
          * The checkout process consists of several steps which are usually
          * displayed one by another to the customer. If the data of a step
          * is already available, then that step is skipped. The active step
          * is the one that is displayed if all other steps are skipped.
          *
          * If one of the previous steps misses some data the customer has
          * to enter, then this step is displayed first. After providing
          * the missing data, the whole series of steps are tested again
          * and if no other step requests attention, the configured active
          * step will be displayed.
          *
          * The order of the steps is determined by the order of sub-parts
          * that are configured for the checkout client.
          *
          * @param string Name of the confirm standard HTML client
          * @since 2014.07
          * @category Developer
          * @category User
          * @see client/html/checkout/standard/standard/subparts
          */
         $default = $view->config('client/html/checkout/standard/url/step-active', 'summary');
         /** client/html/checkout/standard/onepage
          * Shows all named checkout subparts at once for a one page checkout
          *
          * Normally, the checkout process is divided into several steps for entering
          * addresses, select delivery and payment options as well as showing the
          * summary page. This enables dependencies between two steps like showing
          * delivery options based on the address entered by the customer. Furthermore,
          * this is good way to limit the amount of information displayed which is
          * preferred by mobile users.
          *
          * Contrary to that, a one page checkout displays all information on only
          * one page and customers get an immediate overview of which information
          * they have to enter and what options they can select from. This is an
          * advantage if only a very limited amount of information must be entered
          * or if there are almost no options to choose from and no dependencies
          * between exist.
          *
          * Using this config options, shop developers are able to define which
          * checkout subparts are combined to a one page view. Simply add the names
          * of all checkout subparts to the list. Available checkout subparts for
          * a one page checkout are:
          * * address
          * * delivery
          * * payment
          * * summary
          *
          * @param array List of checkout subparts name
          * @since 2015.05
          * @category Developer
          */
         $onepage = $view->config('client/html/checkout/standard/onepage', array());
         $onestep = array_shift($onepage);
         // keep the first one page step
         $steps = (array) $context->getConfig()->get($this->subPartPath, $this->subPartNames);
         $steps = array_diff($steps, $onepage);
         // remove all remaining steps in $onepage
         // use first step if default step isn't available
         $default = !in_array($default, $steps) ? reset($steps) : $default;
         $current = $view->param('c_step', $default);
         // use $onestep if current step isn't available due to one page layout
         $current = !in_array($current, $steps) ? $onestep : $current;
         $cpos = $cpos = array_search($current, $steps);
         if (!isset($view->standardStepActive) || ($apos = array_search($view->standardStepActive, $steps)) !== false && $cpos !== false && $cpos < $apos) {
             $view->standardStepActive = $current;
         }
         $activeStep = $view->standardStepActive;
         $view->standardSteps = $steps;
         $step = null;
         do {
             $lastStep = $step;
         } while (($step = array_shift($steps)) !== null && $step !== $activeStep);
         if ($lastStep !== null) {
             $param = array('c_step' => $lastStep);
             $view->standardUrlBack = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig);
         } else {
             $view->standardUrlBack = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig);
         }
         if (!isset($view->standardUrlNext) && ($nextStep = array_shift($steps)) !== null) {
             $param = array('c_step' => $nextStep);
             $view->standardUrlNext = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig);
         }
         // don't overwrite $view->standardUrlNext so order step URL is used
         $this->cache = $view;
     }
     return $this->cache;
 }
예제 #2
0
 /**
  * Returns the URL to the update page.
  *
  * @param \Aimeos\MW\View\Iface $view View object
  * @param array $params Parameters that should be part of the URL
  * @param array $config Default URL configuration
  * @return string URL string
  */
 protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config)
 {
     /** client/html/checkout/update/url/target
      * Destination of the URL where the controller specified in the URL is known
      *
      * The destination can be a page ID like in a content management system or the
      * module of a software development framework. This "target" must contain or know
      * the controller that should be called by the generated URL.
      *
      * @param string Destination of the URL
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/update/url/controller
      * @see client/html/checkout/update/url/action
      * @see client/html/checkout/update/url/config
      */
     $target = $view->config('client/html/checkout/update/url/target');
     /** client/html/checkout/update/url/controller
      * Name of the controller whose action should be called
      *
      * In Model-View-Controller (MVC) applications, the controller contains the methods
      * that create parts of the output displayed in the generated HTML page. Controller
      * names are usually alpha-numeric.
      *
      * @param string Name of the controller
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/update/url/target
      * @see client/html/checkout/update/url/action
      * @see client/html/checkout/update/url/config
      */
     $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout');
     /** client/html/checkout/update/url/action
      * Name of the action that should create the output
      *
      * In Model-View-Controller (MVC) applications, actions are the methods of a
      * controller that create parts of the output displayed in the generated HTML page.
      * Action names are usually alpha-numeric.
      *
      * @param string Name of the action
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/update/url/target
      * @see client/html/checkout/update/url/controller
      * @see client/html/checkout/update/url/config
      */
     $action = $view->config('client/html/checkout/update/url/action', 'update');
     /** client/html/checkout/update/url/config
      * Associative list of configuration options used for generating the URL
      *
      * You can specify additional options as key/value pairs used when generating
      * the URLs, like
      *
      *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
      *
      * The available key/value pairs depend on the application that embeds the e-commerce
      * framework. This is because the infrastructure of the application is used for
      * generating the URLs. The full list of available config options is referenced
      * in the "see also" section of this page.
      *
      * @param string Associative list of configuration options
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/update/url/target
      * @see client/html/checkout/update/url/controller
      * @see client/html/checkout/update/url/action
      * @see client/html/url/config
      */
     $config = $view->config('client/html/checkout/update/url/config', $config);
     return $view->url($target, $cntl, $action, $params, array(), $config);
 }
예제 #3
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $basketCntl = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket');
         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;
 }
예제 #4
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $customerManager = \Aimeos\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) {
             $deliveryAddressItems = array();
             $orderAddressManager = \Aimeos\MShop\Factory::createManager($context, 'order/base/address');
             $customerAddressManager = \Aimeos\MShop\Factory::createManager($context, 'customer/address');
             $search = $customerAddressManager->createSearch();
             $search->setConditions($search->compare('==', 'customer.address.parentid', $item->getId()));
             foreach ($customerAddressManager->searchItems($search) as $id => $address) {
                 $deliveryAddressItem = $orderAddressManager->createItem();
                 $deliveryAddressItem->copyFrom($address);
                 $deliveryAddressItems[$id] = $deliveryAddressItem;
             }
             $paymentAddressItem = $orderAddressManager->createItem();
             $paymentAddressItem->copyFrom($item->getPaymentAddress());
             $view->addressCustomerItem = $item;
             $view->addressPaymentItem = $paymentAddressItem;
             $view->addressDeliveryItems = $deliveryAddressItems;
         }
         $localeManager = \Aimeos\MShop\Factory::createManager($context, 'locale');
         $locales = $localeManager->searchItems($localeManager->createSearch(true));
         $languages = array();
         foreach ($locales as $locale) {
             $languages[$locale->getLanguageId()] = $locale->getLanguageId();
         }
         $view->addressLanguages = $languages;
         /** client/html/checkout/standard/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.
          *
          * Until 2015-02, the configuration option was available as
          * "client/html/common/address/countries" starting from 2014-03.
          *
          * @param array List of two letter ISO country codes
          * @since 2015.02
          * @category User
          * @category Developer
          * @see client/html/checkout/standard/address/billing/mandatory
          * @see client/html/checkout/standard/address/billing/optional
          * @see client/html/checkout/standard/address/delivery/mandatory
          * @see client/html/checkout/standard/address/delivery/optional
          */
         $view->addressCountries = $view->config('client/html/checkout/standard/address/countries', array());
         /** client/html/checkout/standard/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.
          *
          * Until 2015-02, the configuration option was available as
          * "client/html/common/address/states" starting from 2014-09.
          *
          * @param array Multi-dimensional list ISO country codes and state codes/names
          * @since 2015.02
          * @category User
          * @category Developer
          * @see client/html/checkout/standard/address/billing/mandatory
          * @see client/html/checkout/standard/address/billing/optional
          * @see client/html/checkout/standard/address/delivery/mandatory
          * @see client/html/checkout/standard/address/delivery/optional
          */
         $view->addressStates = $view->config('client/html/checkout/standard/address/states', array());
         $view->addressExtra = $context->getSession()->get('client/html/checkout/standard/address/extra', array());
         $this->cache = $view;
     }
     return $this->cache;
 }
예제 #5
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $attrMap = array();
         $controller = \Aimeos\Controller\Frontend\Factory::createController($this->getContext(), 'catalog');
         /** client/html/catalog/filter/attribute/types
          * List of attribute types that should be displayed in this order in the catalog filter
          *
          * The attribute section in the catalog filter component can display
          * all attributes a visitor can use to reduce the listed products
          * to those that contains one or more attributes. By default, all
          * available attributes will be displayed and ordered by their
          * attribute type.
          *
          * With this setting, you can limit the attribute types to only thoses
          * whose names are part of the setting value. Furthermore, a particular
          * order for the attribute types can be enforced that is different
          * from the standard order.
          *
          * @param array List of attribute type codes
          * @since 2015.05
          * @category User
          * @category Developer
          * @see client/html/catalog/filter/attribute/domains
          */
         $attrTypes = $view->config('client/html/catalog/filter/attribute/types', array());
         $manager = $controller->createManager('attribute');
         $search = $manager->createSearch(true);
         $expr = array();
         if (!empty($attrTypes)) {
             $expr[] = $search->compare('==', 'attribute.type.code', $attrTypes);
         }
         $expr[] = $search->compare('==', 'attribute.domain', 'product');
         $expr[] = $search->getConditions();
         $sort = array($search->sort('+', 'attribute.position'));
         $search->setConditions($search->combine('&&', $expr));
         $search->setSortations($sort);
         /** client/html/catalog/filter/attribute/domains
          * List of domain names whose items should be fetched with the filter attributes
          *
          * The templates rendering the attributes in the catalog filter usually
          * add the images and texts associated to each item. If you want to
          * display additional content, you can configure your own list of
          * domains (attribute, media, price, product, text, etc. are domains)
          * whose items are fetched from the storage. Please keep in mind that
          * the more domains you add to the configuration, the more time is
          * required for fetching the content!
          *
          * @param array List of domain item names
          * @since 2015.05
          * @category Developer
          * @see client/html/catalog/filter/attribute/types
          */
         $domains = $view->config('client/html/catalog/filter/attribute/domains', array('text', 'media'));
         $attributes = $manager->searchItems($search, $domains);
         foreach ($attributes as $id => $item) {
             $attrMap[$item->getType()][$id] = $item;
         }
         if (!empty($attrTypes)) {
             $sortedMap = array();
             foreach ($attrTypes as $type) {
                 if (isset($attrMap[$type])) {
                     $sortedMap[$type] = $attrMap[$type];
                 }
             }
             $attrMap = $sortedMap;
         } else {
             ksort($attrMap);
         }
         $this->addMetaItem($attributes, 'attribute', $this->expire, $this->tags);
         $this->addMetaList(array_keys($attributes), 'attribute', $this->expire);
         // Delete cache when attributes are added or deleted even in "tag-all" mode
         $this->tags[] = 'attribute';
         $view->attributeMap = $attrMap;
         $this->cache = $view;
     }
     $expire = $this->expires($this->expire, $expire);
     $tags = array_merge($tags, $this->tags);
     return $this->cache;
 }
예제 #6
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     /** client/html/email/logo
      * Path to the logo image displayed in HTML e-mails
      *
      * The path can either be an absolute local path or an URL to a file on a
      * remote server. If the file is stored on a remote server, "allow_url_fopen"
      * must be enabled. See {@link http://php.net/manual/en/filesystem.configuration.php#ini.allow-url-fopen php.ini allow_url_fopen}
      * documentation for details.
      *
      * @param string Absolute file system path or remote URL to the logo image
      * @since 2014.03
      * @category User
      * @see client/html/email/from-email
      */
     $file = $view->config('client/html/email/logo', 'client/html/themes/elegance/media/aimeos.png');
     if (file_exists($file) && ($content = file_get_contents($file)) !== false) {
         $finfo = new \finfo(FILEINFO_MIME_TYPE);
         $mimetype = $finfo->file($file);
         $view->htmlLogo = $view->mail()->embedAttachment($content, $mimetype, basename($file));
     }
     $path = $view->config('client/html/common/template/baseurl', 'client/html/themes/elegance');
     $filepath = $path . DIRECTORY_SEPARATOR . 'common.css';
     if (file_exists($filepath) && ($css = file_get_contents($filepath)) !== false) {
         $view->htmlCss = $css;
     }
     return $view;
 }
예제 #7
0
 /**
  * Adds the "back" and "next" URLs to the view
  *
  * @param \Aimeos\MW\View\Iface $view View object
  * @param array $steps List of checkout step names
  * @param unknown $activeStep Name of the active step
  * @return \Aimeos\MW\View\Iface Enhanced view object
  * @since 2016.05
  */
 protected function addNavigationUrls(\Aimeos\MW\View\Iface $view, array $steps, $activeStep)
 {
     /** client/html/checkout/standard/url/target
      * Destination of the URL where the controller specified in the URL is known
      *
      * The destination can be a page ID like in a content management system or the
      * module of a software development framework. This "target" must contain or know
      * the controller that should be called by the generated URL.
      *
      * @param string Destination of the URL
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/standard/url/controller
      * @see client/html/checkout/standard/url/action
      * @see client/html/checkout/standard/url/config
      */
     $cTarget = $view->config('client/html/checkout/standard/url/target');
     /** client/html/checkout/standard/url/controller
      * Name of the controller whose action should be called
      *
      * In Model-View-Controller (MVC) applications, the controller contains the methods
      * that create parts of the output displayed in the generated HTML page. Controller
      * names are usually alpha-numeric.
      *
      * @param string Name of the controller
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/standard/url/target
      * @see client/html/checkout/standard/url/action
      * @see client/html/checkout/standard/url/config
      */
     $cCntl = $view->config('client/html/checkout/standard/url/controller', 'checkout');
     /** client/html/checkout/standard/url/action
      * Name of the action that should create the output
      *
      * In Model-View-Controller (MVC) applications, actions are the methods of a
      * controller that create parts of the output displayed in the generated HTML page.
      * Action names are usually alpha-numeric.
      *
      * @param string Name of the action
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/standard/url/target
      * @see client/html/checkout/standard/url/controller
      * @see client/html/checkout/standard/url/config
      */
     $cAction = $view->config('client/html/checkout/standard/url/action', 'index');
     /** client/html/checkout/standard/url/config
      * Associative list of configuration options used for generating the URL
      *
      * You can specify additional options as key/value pairs used when generating
      * the URLs, like
      *
      *  client/html/<clientname>/url/config = array( 'absoluteUri' => true )
      *
      * The available key/value pairs depend on the application that embeds the e-commerce
      * framework. This is because the infrastructure of the application is used for
      * generating the URLs. The full list of available config options is referenced
      * in the "see also" section of this page.
      *
      * @param string Associative list of configuration options
      * @since 2014.03
      * @category Developer
      * @see client/html/checkout/standard/url/target
      * @see client/html/checkout/standard/url/controller
      * @see client/html/checkout/standard/url/action
      * @see client/html/url/config
      */
     $cConfig = $view->config('client/html/checkout/standard/url/config', array());
     $bTarget = $view->config('client/html/basket/standard/url/target');
     $bCntl = $view->config('client/html/basket/standard/url/controller', 'basket');
     $bAction = $view->config('client/html/basket/standard/url/action', 'index');
     $bConfig = $view->config('client/html/basket/standard/url/config', array());
     $step = null;
     do {
         $lastStep = $step;
     } while (($step = array_shift($steps)) !== null && $step !== $activeStep);
     if ($lastStep !== null) {
         $param = array('c_step' => $lastStep);
         $view->standardUrlBack = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig);
     } else {
         $view->standardUrlBack = $view->url($bTarget, $bCntl, $bAction, array(), array(), $bConfig);
     }
     if (!isset($view->standardUrlNext) && ($nextStep = array_shift($steps)) !== null) {
         $param = array('c_step' => $nextStep);
         $view->standardUrlNext = $view->url($cTarget, $cCntl, $cAction, $param, array(), $cConfig);
     }
     // don't overwrite $view->standardUrlNext so order step URL is used
     return $view;
 }
예제 #8
0
 /**
  * Returns the URL to fetch the stock level details of the given products
  *
  * @param \Aimeos\MW\View\Iface $view View object
  * @param array $productIds List of product IDs
  * @return string Generated stock level URL
  */
 protected function getStockUrl(\Aimeos\MW\View\Iface $view, array $productIds)
 {
     $stockTarget = $view->config('client/html/catalog/stock/url/target');
     $stockController = $view->config('client/html/catalog/stock/url/controller', 'catalog');
     $stockAction = $view->config('client/html/catalog/stock/url/action', 'stock');
     $stockConfig = $view->config('client/html/catalog/stock/url/config', array());
     sort($productIds);
     $params = array('s_prodid' => implode(' ', $productIds));
     return $view->url($stockTarget, $stockController, $stockAction, $params, array(), $stockConfig);
 }
예제 #9
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->view)) {
         if (($pos = $view->param('l_pos')) !== null && ($pid = $view->param('d_prodid')) !== null) {
             if ($pos < 1) {
                 $start = 0;
                 $size = 2;
             } else {
                 $start = $pos - 1;
                 $size = 3;
             }
             $context = $this->getContext();
             $site = $context->getLocale()->getSite()->getCode();
             $params = $context->getSession()->get('aimeos/catalog/lists/params/last/' . $site, array());
             $filter = $this->getProductListFilterByParam($params);
             $filter->setSlice($start, $size);
             $total = null;
             $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
             $products = $controller->getIndexItems($filter, array('text'), $total);
             if (($count = count($products)) > 1) {
                 $enc = $view->encoder();
                 $listPos = array_search($pid, array_keys($products));
                 $target = $view->config('client/html/catalog/detail/url/target');
                 $controller = $view->config('client/html/catalog/detail/url/controller', 'catalog');
                 $action = $view->config('client/html/catalog/detail/url/action', 'detail');
                 $config = $view->config('client/html/catalog/detail/url/config', array());
                 if ($listPos > 0 && ($product = reset($products)) !== false) {
                     $param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url ')), 'l_pos' => $pos - 1);
                     $view->navigationPrev = $view->url($target, $controller, $action, $param, array(), $config);
                 }
                 if ($listPos < $count - 1 && ($product = end($products)) !== false) {
                     $param = array('d_prodid' => $product->getId(), 'd_name' => $enc->url($product->getName('url')), 'l_pos' => $pos + 1);
                     $view->navigationNext = $view->url($target, $controller, $action, $param, array(), $config);
                 }
             }
         }
         $this->view = $view;
     }
     return $this->view;
 }
예제 #10
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $context = $this->getContext();
         $site = $context->getLocale()->getSite()->getCode();
         if (($params = $context->getSession()->get('aimeos/catalog/detail/params/last' . $site)) !== null) {
             $target = $view->config('client/html/catalog/detail/url/target');
             $controller = $view->config('client/html/catalog/detail/url/controller', 'catalog');
             $action = $view->config('client/html/catalog/detail/url/action', 'detail');
             $config = $view->config('client/html/catalog/detail/url/config', array());
         } else {
             $params = $context->getSession()->get('aimeos/catalog/lists/params/last' . $site, array());
             $target = $view->config('client/html/catalog/list/url/target');
             $controller = $view->config('client/html/catalog/list/url/controller', 'catalog');
             $action = $view->config('client/html/catalog/list/url/action', 'list');
             $config = $view->config('client/html/catalog/list/url/config', array());
         }
         $view->standardParams = $this->getClientParams($view->param());
         $view->standardBackUrl = $view->url($target, $controller, $action, $params, array(), $config);
         $view->standardBasket = \Aimeos\Controller\Frontend\Factory::createController($context, 'basket')->get();
         $this->cache = $view;
     }
     return $this->cache;
 }
예제 #11
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $catItems = array();
         $context = $this->getContext();
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $currentid = (string) $view->param('f_catid', '');
         $currentid = $currentid != '' ? $currentid : null;
         /** 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
          * @see client/html/catalog/filter/tree/domains
          */
         $startid = $view->config('client/html/catalog/filter/tree/startid', '');
         $startid = $startid != '' ? $startid : null;
         /** client/html/catalog/filter/tree/domains
          * List of domain names whose items should be fetched with the filter categories
          *
          * The templates rendering the categories 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 2014.03
          * @category Developer
          * @see client/html/catalog/filter/tree/startid
          * @see client/html/catalog/filter/tree/levels-always
          * @see client/html/catalog/filter/tree/levels-only
          */
         $ref = $view->config('client/html/catalog/filter/tree/domains', array('text', 'media'));
         if ($currentid) {
             $catItems = $controller->getCatalogPath($currentid);
             if ($startid) {
                 foreach ($catItems as $key => $item) {
                     if ($key == $startid) {
                         break;
                     }
                     unset($catItems[$key]);
                 }
             }
         }
         if (($node = reset($catItems)) === false) {
             $node = $controller->getCatalogTree($startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE);
             $catItems = array($node->getId() => $node);
         }
         $search = $controller->createCatalogFilter();
         $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
          * @see client/html/catalog/filter/tree/domains
          */
         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
          * @see client/html/catalog/filter/tree/domains
          */
         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);
         $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE;
         $view->treeCatalogPath = $catItems;
         $view->treeCatalogTree = $controller->getCatalogTree($startid, $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;
 }
예제 #12
0
 /**
  * Returns the URL to the update page.
  *
  * @param \Aimeos\MW\View\Iface $view View object
  * @param array $params Parameters that should be part of the URL
  * @param array $config Default URL configuration
  * @return string URL string
  */
 protected function getUrlUpdate(\Aimeos\MW\View\Iface $view, array $params, array $config)
 {
     $target = $view->config('client/html/checkout/update/url/target');
     $cntl = $view->config('client/html/checkout/update/url/controller', 'checkout');
     $action = $view->config('client/html/checkout/update/url/action', 'update');
     $config = $view->config('client/html/checkout/update/url/config', $config);
     return $view->url($target, $cntl, $action, $params, array(), $config);
 }
예제 #13
0
 /**
  * Sets the necessary parameter values in the view.
  *
  * @param \Aimeos\MW\View\Iface $view The view object which generates the HTML output
  * @param array &$tags Result array for the list of tags that are associated to the output
  * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry)
  * @return \Aimeos\MW\View\Iface Modified view object
  */
 protected function setViewParams(\Aimeos\MW\View\Iface $view, array &$tags = array(), &$expire = null)
 {
     if (!isset($this->cache)) {
         $catItems = array();
         $context = $this->getContext();
         $controller = \Aimeos\Controller\Frontend\Factory::createController($context, 'catalog');
         $currentid = (string) $view->param('f_catid', '');
         $currentid = $currentid != '' ? $currentid : null;
         /** 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
          * @see client/html/catalog/filter/tree/domains
          */
         $startid = $view->config('client/html/catalog/filter/tree/startid', '');
         $startid = $startid != '' ? $startid : null;
         /** client/html/catalog/filter/tree/domains
          * List of domain names whose items should be fetched with the filter categories
          *
          * The templates rendering the categories 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 2014.03
          * @category Developer
          * @see client/html/catalog/filter/tree/startid
          * @see client/html/catalog/filter/tree/levels-always
          * @see client/html/catalog/filter/tree/levels-only
          */
         $ref = $view->config('client/html/catalog/filter/tree/domains', array('text', 'media'));
         if ($currentid !== null) {
             $catItems = $this->filterCatalogPath($controller->getCatalogPath($currentid), $startid);
         }
         if (($node = reset($catItems)) === false) {
             $node = $controller->getCatalogTree($startid, array(), \Aimeos\MW\Tree\Manager\Base::LEVEL_ONE);
             $catItems = array($node->getId() => $node);
         }
         $catIds = array_keys($catItems);
         $search = $this->addSearchConditions($controller->createCatalogFilter(), $catIds, $node->getId());
         $level = \Aimeos\MW\Tree\Manager\Base::LEVEL_TREE;
         $view->treeCatalogPath = $catItems;
         $view->treeCatalogTree = $controller->getCatalogTree($startid, $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;
 }