当前位置: 首页>>代码示例>>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;未经允许,请勿转载。