當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Shipment::getShippingService方法代碼示例

本文整理匯總了PHP中Shipment::getShippingService方法的典型用法代碼示例。如果您正苦於以下問題:PHP Shipment::getShippingService方法的具體用法?PHP Shipment::getShippingService怎麽用?PHP Shipment::getShippingService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Shipment的用法示例。


在下文中一共展示了Shipment::getShippingService方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: save

 private function save(OrderedItem $item, Shipment $shipment, $existingItem = false)
 {
     $validator = $this->createOrderedItemValidator();
     if ($validator->isValid()) {
         if ($count = (int) $this->request->get('count') && !(int) $this->request->get('downloadable')) {
             $item->count->set($count);
         }
         $shipment->loadItems();
         if (!$existingItem) {
             $shipment->addItem($item);
         }
         if ($shipment->getShippingService()) {
             $shipmentRates = $shipment->getDeliveryZone()->getShippingRates($shipment);
             $shipment->setAvailableRates($shipmentRates);
             $shipment->setRateId($shipment->getShippingService()->getID());
         }
         $shipment->recalculateAmounts();
         $shipment->save();
         return array('item' => array('ID' => $item->getID(), 'Product' => $item->getProduct()->toArray(), 'Shipment' => array('ID' => $shipment->getID(), 'amount' => (double) $shipment->amount->get(), 'shippingAmount' => (double) $shipment->shippingAmount->get(), 'taxAmount' => (double) $shipment->taxAmount->get(), 'total' => (double) $shipment->shippingAmount->get() + (double) $shipment->amount->get() + (double) $shipment->taxAmount->get(), 'prefix' => $shipment->getCurrency()->pricePrefix->get(), 'suffix' => $shipment->getCurrency()->priceSuffix->get(), 'Order' => $shipment->order->get()->toFlatArray()), 'count' => $item->count->get(), 'price' => $item->price->get(), 'priceCurrencyID' => $item->getCurrency()->getID(), 'isExisting' => $existingItem, 'variations' => $item->getProduct()->getParent()->getVariationData($this->application)));
     } else {
         return array('errors' => $validator->getErrorList());
         //return new JSONResponse(array('errors' => $validator->getErrorList()), 'failure', $this->translate('_unable_to_update_items_quantity'));
     }
 }
開發者ID:GregerA,項目名稱:livecart,代碼行數:24,代碼來源:OrderedItemController.php


注:本文中的Shipment::getShippingService方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。