Пример #1
0
 public static function getQuantityForAnyProductTypeFromOptions($productId, $startDate, $endDate, $options, $forceReal = false)
 {
     list($qtyPerProduct, $qtyArr) = ITwebexperts_Payperrentals_Helper_Inventory::getQuantityForAnyProductTypePerProduct($productId, $startDate, $endDate, isset($options['attributes']) ? $options['attributes'] : null, isset($options['bundle_option']) ? $options['bundle_option'] : null, isset($options['bundle_option_qty1']) ? $options['bundle_option_qty1'] : null, isset($options['bundle_option_qty']) ? $options['bundle_option_qty'] : null, false, $forceReal);
     $bundleQty = 0;
     $maxQty = 0;
     $isBundle = false;
     foreach ($qtyPerProduct as $iProduct => $iQty) {
         $typeId = ITwebexperts_Payperrentals_Helper_Data::getAttributeCodeForId($iProduct, 'type_id');
         if ($typeId == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_BUNDLE) {
             $bundleQty = $iQty;
             $isBundle = true;
             continue;
         }
         $maxQty = $iQty;
     }
     if ($isBundle) {
         $maxQty = $bundleQty;
     }
     if ($maxQty == 'is_overbook') {
         $maxQty = 10000000;
     }
     return $maxQty;
 }