Exemple #1
0
 /**
  * @param \Bitrix\Sale\Shipment $shipment
  * @return float|int
  * @throws Main\ArgumentNullException
  * @throws SystemException
  */
 public static function getDeliveryPrice(\Bitrix\Sale\Shipment $shipment)
 {
     $totalPrice = 0;
     if ($shipment->getDeliveryId()) {
         $service = Services\Manager::getService($shipment->getDeliveryId());
         if ($service) {
             $extraServices = $shipment->getExtraServices();
             $extraServicesManager = $service->getExtraServices();
             $extraServicesManager->setValues($extraServices);
             $result = $service->calculate($shipment);
             $totalPrice = $result->getPrice();
         }
     }
     return $totalPrice;
 }
 /**
  * @internal
  * @param Shipment $parentShipment
  * @param Shipment $childShipment
  * @return Result
  * @throws Main\ArgumentOutOfRangeException
  */
 public function cloneShipment(Shipment $parentShipment, Shipment $childShipment)
 {
     foreach (static::getClonedFields() as $fieldName) {
         /** @var Result $r */
         $childShipment->setFieldNoDemand($fieldName, $parentShipment->getField($fieldName));
     }
     $childShipment->setExtraServices($parentShipment->getExtraServices());
     $childShipment->setStoreId($parentShipment->getStoreId());
     return new Result();
 }