/** * Sets the necessary parameter values in the view. * * @param MW_View_Interface $view The view object which generates the HTML output * @param array &$tags Result array for the list of tags that are associated to the output * @param string|null &$expire Result variable for the expiration date of the output (null for no expiry) * @return MW_View_Interface Modified view object */ protected function _setViewParams(MW_View_Interface $view, array &$tags = array(), &$expire = null) { if (!isset($this->_cache)) { $context = $this->_getContext(); $manager = MShop_Factory::createManager($context, 'order'); $orderId = $view->param('his_id', null); if ($orderId !== null) { $search = $manager->createSearch(true); $expr = array($search->getConditions(), $search->compare('==', 'order.id', $orderId), $search->compare('==', 'order.base.customerid', $context->getUserId())); $search->setConditions($search->combine('&&', $expr)); $orderItems = $manager->searchItems($search); if (($orderItem = reset($orderItems)) === false) { $msg = $view->translate('client/html', 'Order with ID "%1$s" not found'); throw new Client_Html_Exception(sprintf($msg, $orderId)); } $baseManager = MShop_Factory::createManager($context, 'order/base'); $view->summaryBasket = $baseManager->load($orderItem->getBaseId()); } $this->_cache = $view; } return $this->_cache; }