コード例 #1
0
ファイル: OrderController.php プロジェクト: GregerA/livecart
 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')));
 }
コード例 #2
0
ファイル: OrderController.php プロジェクト: saiber/www
 /**
  *	@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');
 }
コード例 #3
0
ファイル: XCartImport.php プロジェクト: saiber/livecart
 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);
 }
コード例 #4
0
ファイル: SessionOrder.php プロジェクト: saiber/www
 public static function save(CustomerOrder $order)
 {
     // mark shipment data as modified - to force saving
     $order->getShipments();
     $order->save();
     self::setOrder($order);
 }
コード例 #5
0
 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'));
     }
 }
コード例 #6
0
ファイル: ShopScriptImport.php プロジェクト: saiber/www
 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);
 }
コード例 #7
0
 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();
 }