Esempio n. 1
0
 /**
  * @param ShipmentItemStore $shipmentItemStore
  */
 public static function getStoresCount(ShipmentItemStore $shipmentItemStore)
 {
     $basketItem = $shipmentItemStore->getBasketItem();
     $siteId = $basketItem->getField('LID');
     //		$result = $provider::getStoresIdBySiteId($siteId);
 }
 /**
  * @param ShipmentItemStore $item
  * @return Result
  * @throws \Exception
  */
 public function checkAvailableQuantity(ShipmentItemStore $item)
 {
     $result = new Result();
     $shipmentItem = $this->getShipmentItem();
     $basketItem = $shipmentItem->getBasketItem();
     $itemStoreQuantity = floatval($this->getQuantityByBasketCode($shipmentItem->getBasketCode()));
     if ($shipmentItem->getQuantity() !== null && (floatval($item->getQuantity()) > floatval($shipmentItem->getQuantity()) || $itemStoreQuantity > floatval($shipmentItem->getQuantity()))) {
         if (isset(static::$errors[$basketItem->getBasketCode()][$item->getField('ORDER_DELIVERY_BASKET_ID')]['STORE_QUANTITY_LARGER_ALLOWED'])) {
             static::$errors[$basketItem->getBasketCode()][$item->getField('ORDER_DELIVERY_BASKET_ID')]['STORE_QUANTITY_LARGER_ALLOWED'] += $item->getQuantity();
         } else {
             $result->addError(new ResultError(Loc::getMessage('SALE_SHIPMENT_ITEM_STORE_QUANTITY_LARGER_ALLOWED', array('#PRODUCT_NAME#' => $basketItem->getField('NAME'))), 'SALE_SHIPMENT_ITEM_STORE_QUANTITY_LARGER_ALLOWED'));
             static::$errors[$basketItem->getBasketCode()][$item->getField('ORDER_DELIVERY_BASKET_ID')]['STORE_QUANTITY_LARGER_ALLOWED'] = $item->getQuantity();
         }
     }
     return $result;
 }