예제 #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)) {
         $salutations = array(\Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MR, \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MRS, \Aimeos\MShop\Common\Item\Address\Base::SALUTATION_MISS);
         try {
             $salutation = '';
             $addr = $view->extAddressItem;
             if (in_array($addr->getSalutation(), $salutations)) {
                 $salutation = $view->translate('client/code', $addr->getSalutation());
             }
             /// E-mail intro with salutation (%1$s), first name (%2$s) and last name (%3$s)
             $view->emailIntro = sprintf($view->translate('client', 'Dear %1$s %2$s %3$s'), $salutation, $addr->getFirstName(), $addr->getLastName());
         } catch (\Exception $e) {
             $view->emailIntro = $view->translate('client/html/email', 'Dear Sir or Madam');
         }
         $this->cache = $view;
     }
     return $this->cache;
 }
예제 #2
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)) {
         if (($orderId = $view->param('his_id', null)) !== null) {
             $context = $this->getContext();
             $manager = \Aimeos\MShop\Factory::createManager($context, 'order');
             $baseManager = \Aimeos\MShop\Factory::createManager($context, 'order/base');
             $search = $manager->createSearch(true);
             $expr = array($search->getConditions(), $search->compare('==', 'order.id', $orderId), $search->compare('==', 'order.base.customerid', $context->getUserId()));
             $search->setConditions($search->combine('&&', $expr));
             $orderItems = $manager->searchItems($search);
             if (($orderItem = reset($orderItems)) === false) {
                 $msg = $view->translate('client', 'Order with ID "%1$s" not found');
                 throw new \Aimeos\Client\Html\Exception(sprintf($msg, $orderId));
             }
             if ($orderItem->getPaymentStatus() >= $this->getDownloadPaymentStatus()) {
                 $view->summaryShowDownloadAttributes = true;
             }
             $view->summaryBasket = $baseManager->load($orderItem->getBaseId());
             $view->summaryTaxRates = $this->getTaxRates($view->summaryBasket);
             $view->orderItem = $orderItem;
         }
         $this->cache = $view;
     }
     return $this->cache;
 }