Example #1
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;
 }
Example #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->_cache)) {
         $mediaItems = array();
         $catPath = $view->get('stageCatPath', array());
         foreach (array_reverse($catPath) as $catItem) {
             $mediaItems = $catItem->getRefItems('media', 'default', 'stage');
             if (!empty($mediaItems)) {
                 break;
             }
         }
         $view->imageItems = $mediaItems;
         $this->_cache = $view;
     }
     return $this->_cache;
 }
Example #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');
         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;
 }
Example #4
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)) {
         $attributeTypes = array();
         $attrItems = $view->get('detailProductAttributeItems', array());
         $configAttributes = $view->detailProductItem->getRefItems('attribute', null, 'config');
         foreach ($configAttributes as $id => $attribute) {
             if (isset($attrItems[$id])) {
                 $attributeTypes[$attrItems[$id]->getType()][$id] = $attrItems[$id];
             }
         }
         $view->attributeConfigItems = $attributeTypes;
         $view->attributeCustomItems = $view->detailProductItem->getRefItems('attribute', null, 'custom');
         $view->attributeHiddenItems = $view->detailProductItem->getRefItems('attribute', null, 'hidden');
         $this->_cache = $view;
     }
     return $this->_cache;
 }