Ejemplo n.º 1
0
 protected function getUpdateResponse()
 {
     /////// @todo - should be a better way for recalculating taxes...
     ActiveRecord::clearPool();
     $this->config->resetRuntime('DELIVERY_TAX_CLASS');
     $this->order = CustomerOrder::getInstanceById($this->order->getID(), true);
     ///////
     $this->order->loadAll();
     $this->restoreShippingMethodSelection();
     ActiveRecordModel::clearArrayData();
     if ($paymentMethod = $this->session->get('OrderPaymentMethod_' . $this->order->getID())) {
         $this->order->setPaymentMethod($paymentMethod);
         $this->order->getTotal(true);
     }
     $this->setAnonAddresses();
     // @todo: sometimes the shipping address disappears (for registered users that might already have the shipping address entered before)
     if (!$this->order->shippingAddress->get() && $this->isShippingRequired($this->order) && $this->user->defaultShippingAddress->get()) {
         $this->user->defaultShippingAddress->get()->load();
         $this->order->shippingAddress->set($this->user->defaultShippingAddress->get()->userAddress->get());
         $this->order->shippingAddress->get()->load();
     }
     $response = new CompositeJSONResponse();
     $response->addAction('overview', 'onePageCheckout', 'overview');
     $response->addAction('cart', 'onePageCheckout', 'cart');
     if ($this->request->getActionName() != 'setPaymentMethod') {
         $response->addAction('payment', 'onePageCheckout', 'payment');
     }
     $response->set('order', $this->getOrderValues($this->order));
     foreach (func_get_args() as $arg) {
         $response->addAction($arg, 'onePageCheckout', $arg);
     }
     $this->session->unsetValue('noJS');
     $response = $this->postProcessResponse($response);
     return $response;
 }