public function changeRecurringProductPeriod() { $request = $this->getRequest(); $orderedItemID = $request->get('id'); $billingPlandropdownName = $request->get('recurringBillingPlan'); $recurringID = $request->get($billingPlandropdownName); $orderedItem = ActiveRecordModel::getInstanceByID('OrderedItem', $orderedItemID, true); $recurringItem = RecurringItem::getInstanceByOrderedItem($orderedItem); if ($recurringItem) { $recurringItem->setRecurringProductPeriod(RecurringProductPeriod::getInstanceByID($recurringID)); $recurringItem->save(); $orderedItem->updateBasePriceToCalculatedPrice(); } $this->order->loadItemData(); $this->order->mergeItems(); $this->order->save(); return new ActionRedirectResponse('order', 'index', array('query' => 'return=' . $this->request->get('return'))); }
/** * @role login */ public function setMultiAddress() { if (!$this->config->get('ENABLE_MULTIADDRESS')) { return new ActionRedirectResponse('order', 'index'); } $this->order->isMultiAddress->set(true); $this->order->shippingAddress->set(null); // split items foreach ($this->order->getOrderedItems() as $item) { if ($item->count->get() > 1) { $count = $item->count->get(); $item->count->set(1); for ($k = 1; $k < $count; $k++) { $this->order->addItem(clone $item); } } } $this->order->save(); return new ActionRedirectResponse('order', 'multi'); }
public function saveCustomerOrder(CustomerOrder $order) { $order->shippingAddress->get()->save(); $order->billingAddress->get()->save(); $order->save(); $shipment = $order->getShipments()->get(0); $shipment->shippingAmount->set($order->rawData['shipping_cost']); $shipment->save(); if ($order->rawData['tax'] > 0) { $tax = ActiveRecordModel::getNewInstance('ShipmentTax'); $tax->shipment->set($shipment); $tax->amount->set($order->rawData['tax']); $tax->save(); $shipment->addFixedTax($tax); $shipment->status->set(Shipment::STATUS_SHIPPED); $shipment->save(); } return parent::saveCustomerOrder($order); }
public static function save(CustomerOrder $order) { // mark shipment data as modified - to force saving $order->getShipments(); $order->save(); self::setOrder($order); }
private function save(CustomerOrder $order) { $validator = self::createOrderFormValidator(); if ($validator->isValid()) { $existingRecord = $order->isExistingRecord(); $order->save(true); BackendToolbarItem::registerLastViewedOrder($order); return new JSONResponse(array('order' => array('ID' => $order->getID())), 'success', $this->translate($existingRecord ? '_order_status_has_been_successfully_changed' : '_new_order_has_been_successfully_created')); } else { return new JSONResponse(array('errors' => $validator->getErrorList()), 'failure', $this->translate('_error_updating_order_status')); } }
public function saveCustomerOrder(CustomerOrder $order) { $order->shippingAddress->get()->save(); $order->billingAddress->get()->save(); $order->save(); $shipment = $order->getShipments()->get(0); if ($shipment) { $shipment->shippingAmount->set($order->rawData['shipping_cost']); if ($order->status->get() == CustomerOrder::STATUS_SHIPPED) { $shipment->status->set(Shipment::STATUS_SHIPPED); } $shipment->save(); } return parent::saveCustomerOrder($order); }
public function saveCustomerOrder(CustomerOrder $order) { $order->isFinalized->set(true); $order->save(); if ($order->shippingAddress->get()) { $order->shippingAddress->get()->save(); } if ($order->billingAddress->get()) { $order->billingAddress->get()->save(); } $order->totalAmount->set($order->calculateTotal($order->currency->get())); return $order->save(); }