当前位置: 首页>>代码示例>>PHP>>正文


PHP CCatalogSKU::getExistOffers方法代码示例

本文整理汇总了PHP中CCatalogSKU::getExistOffers方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSKU::getExistOffers方法的具体用法?PHP CCatalogSKU::getExistOffers怎么用?PHP CCatalogSKU::getExistOffers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CCatalogSKU的用法示例。


在下文中一共展示了CCatalogSKU::getExistOffers方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: makeItemsFromDbResult

 /**
  * @param  \CDBResult $dbResultList
  * @return array
  */
 protected function makeItemsFromDbResult(\CDBResult $dbResultList)
 {
     $arItemsResult = $arProductIds = array();
     while ($arItem = $dbResultList->Fetch()) {
         if ($arItem['TYPE'] != 'S') {
             $arProductIds[] = $arItem['ID'];
             $arItem['PROPERTIES'] = $this->getItemProperies($arItem['ID']);
         }
         $arItemsResult[$arItem['ID']] = $arItem;
     }
     if (!empty($arProductIds)) {
         $dbCatalogProduct = \CCatalogProduct::GetList(array(), array("ID" => $arProductIds));
         while ($arCatalogProduct = $dbCatalogProduct->fetch()) {
             $arItemsResult[$arCatalogProduct["ID"]]['PRODUCT'] = $arCatalogProduct;
         }
         $offersExistsIds = \CCatalogSKU::getExistOffers($arProductIds, $this->getIblockId());
         $noOffersIds = array();
         if ($offersExistsIds === false) {
             $noOffersIds = $arProductIds;
         } else {
             $this->loadAllSku(array_keys(array_filter($offersExistsIds)));
             foreach ($offersExistsIds as $id => $bExists) {
                 $arItem =& $arItemsResult[$id];
                 if ($bExists) {
                     $arItem['SKU_ITEMS'] = $this->getProductSku($arItem);
                 } else {
                     $noOffersIds[] = $id;
                 }
             }
         }
         if (!empty($noOffersIds)) {
             $priceIds = $this->getVisiblePrices();
             foreach ($priceIds as $priceId) {
                 $dbPrice = \CPrice::GetList(array(), array('PRODUCT_ID' => $noOffersIds, 'CATALOG_GROUP_ID' => $priceId), false, false, array('PRODUCT_ID', 'PRICE', 'CURRENCY'));
                 while ($arPrice = $dbPrice->fetch()) {
                     $arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId] = array('PRICE' => $arPrice['PRICE'], 'CURRENCY' => $arPrice['CURRENCY']);
                 }
             }
             if ($this->getStoreId()) {
                 $dbStoreProduct = \CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $noOffersIds, "STORE_ID" => $this->getStoreId()));
                 while ($arStoreProduct = $dbStoreProduct->Fetch()) {
                     $arItemsResult[$arStoreProduct["PRODUCT_ID"]]['PRODUCT']['STORE_AMOUNT'] = $arStoreProduct["AMOUNT"];
                 }
             }
             $groupsIterator = CCatalogProductSet::getList(array(), array('OWNER_ID' => $noOffersIds, 'SET_ID' => 0, 'TYPE' => \CCatalogProductSet::TYPE_GROUP), false, false, array('ID', 'OWNER_ID', 'ITEM_ID', 'SET_ID', 'TYPE'));
             while ($group = $groupsIterator->Fetch()) {
                 if ($group['OWNER_ID'] == $group['ITEM_ID']) {
                     $arItemsResult[$group['OWNER_ID']]['PRODUCT']['IS_GROUP'] = true;
                 }
             }
         }
     }
     return $arItemsResult;
 }
开发者ID:ASDAFF,项目名称:1C_Bitrix_info_site,代码行数:58,代码来源:class.php

示例2: foreach

     $arCatalogProduct[] = $arItems["ID"];
     $arItems['DETAIL_PAGE_URL'] = CIBlock::ReplaceDetailUrl($arItems['DETAIL_PAGE_URL'], $arItems, false, "E");
     $arItemsResult[$arItems['ID']] = $arItems;
 }
 if (!empty($arCatalogProduct)) {
     foreach ($arPrices as $price) {
         $dbPrice = CPrice::GetList(array(), array('PRODUCT_ID' => $arCatalogProduct, 'CATALOG_GROUP_ID' => $price['ID']), false, false, array('PRODUCT_ID', 'PRICE'));
         while ($arPrice = $dbPrice->fetch()) {
             $arPricesResult[$price['ID']][$arPrice["PRODUCT_ID"]] = $arPrice["PRICE"];
         }
     }
     $dbCatalogProduct = CCatalogProduct::GetList(array(), array("ID" => $arCatalogProduct));
     while ($oneProduct = $dbCatalogProduct->fetch()) {
         $arCatalogProductResult[$oneProduct["ID"]] = $oneProduct;
     }
     $existSku = CCatalogSKU::getExistOffers($arCatalogProduct);
     foreach ($existSku as $productID => $existOffers) {
         if (isset($arCatalogProductResult[$productID])) {
             $arCatalogProductResult[$productID] = array();
         }
         $arCatalogProductResult[$productID]['EXIST_SKU'] = $existOffers;
     }
     unset($existOffers, $productID, $existSku);
 }
 foreach ($arItemsResult as $productId => $arItems) {
     $arCatalogProduct = array('EXIST_SKU' => false);
     if (isset($arCatalogProductResult[$productId])) {
         $arCatalogProduct = $arCatalogProductResult[$productId];
     }
     //only for store documents skip sets
     if ($caller == "storeDocs" && isset($arCatalogProduct["TYPE"]) && $arCatalogProduct["TYPE"] == CCatalogProduct::TYPE_SET) {
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:cat_store_product_search.php

示例3: makeItemsFromDbResult

 /**
  * @param  \CDBResult $dbResultList
  * @return array
  */
 protected function makeItemsFromDbResult(\CDBResult $dbResultList)
 {
     $arItemsResult = $arProductIds = array();
     while ($arItem = $dbResultList->Fetch()) {
         if ($arItem['TYPE'] != 'S') {
             $arProductIds[] = $arItem['ID'];
             $arItem['PROPERTIES'] = $this->getItemProperies($arItem['ID']);
             $arItemsResult[$arItem['ID']] = $arItem;
         } else {
             $arItemsResult['S' . $arItem['ID']] = $arItem;
         }
     }
     if (!empty($arProductIds)) {
         $dbCatalogProduct = \CCatalogProduct::GetList(array(), array('@ID' => $arProductIds));
         while ($arCatalogProduct = $dbCatalogProduct->fetch()) {
             $arItemsResult[$arCatalogProduct['ID']]['PRODUCT'] = $arCatalogProduct;
         }
         $offersExistsIds = \CCatalogSKU::getExistOffers($arProductIds, $this->getIblockId());
         $noOffersIds = array();
         if (empty($offersExistsIds)) {
             $noOffersIds = $arProductIds;
         } else {
             $this->loadAllSku(array_keys(array_filter($offersExistsIds)));
             foreach ($offersExistsIds as $id => $bExists) {
                 $arItem =& $arItemsResult[$id];
                 if ($bExists) {
                     $arItem['SKU_ITEMS'] = $this->getProductSku($arItem);
                 } else {
                     $noOffersIds[] = $id;
                 }
             }
             unset($id, $bExists);
         }
         if (!empty($noOffersIds)) {
             $productRatioList = Catalog\ProductTable::getCurrentRatioWithMeasure($noOffersIds);
             if (!empty($productRatioList)) {
                 foreach ($productRatioList as $productId => $productRatio) {
                     if (!isset($arItemsResult[$productId]['PRODUCT'])) {
                         continue;
                     }
                     $arItemsResult[$productId]['PRODUCT']['MEASURE_RATIO'] = $productRatio['RATIO'];
                     $arItemsResult[$productId]['PRODUCT']['MEASURE'] = $productRatio['MEASURE'];
                 }
                 unset($productRatio, $productId);
             }
             unset($productRatioList);
             $priceIds = $this->getVisiblePrices();
             foreach ($priceIds as $priceId) {
                 $dbPrice = \CPrice::GetListEx(array(), array('PRODUCT_ID' => $noOffersIds, 'CATALOG_GROUP_ID' => $priceId), false, false, array('PRODUCT_ID', 'PRICE', 'CURRENCY', 'QUANTITY_FROM', 'QUANTITY_TO'));
                 while ($arPrice = $dbPrice->fetch()) {
                     $arPrice['QUANTITY_FROM'] = (int) $arPrice['QUANTITY_FROM'];
                     $arPrice['QUANTITY_TO'] = (int) $arPrice['QUANTITY_TO'];
                     if (!isset($arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId]) || $arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId]['QUANTITY_FROM'] > $arPrice['QUANTITY_FROM']) {
                         $arItemsResult[$arPrice["PRODUCT_ID"]]['PRICES'][$priceId] = array('PRICE' => $arPrice['PRICE'], 'CURRENCY' => $arPrice['CURRENCY'], 'QUANTITY_FROM' => $arPrice['QUANTITY_FROM'], 'QUANTITY_TO' => $arPrice['QUANTITY_TO']);
                     }
                 }
                 unset($arPrice, $dbPrice);
             }
             if ($this->getStoreId()) {
                 $dbStoreProduct = \CCatalogStoreProduct::GetList(array(), array("PRODUCT_ID" => $noOffersIds, "STORE_ID" => $this->getStoreId()));
                 while ($arStoreProduct = $dbStoreProduct->Fetch()) {
                     $arItemsResult[$arStoreProduct["PRODUCT_ID"]]['PRODUCT']['STORE_AMOUNT'] = $arStoreProduct["AMOUNT"];
                 }
             }
             $groupsIterator = CCatalogProductSet::getList(array(), array('OWNER_ID' => $noOffersIds, 'SET_ID' => 0, 'TYPE' => \CCatalogProductSet::TYPE_GROUP), false, false, array('ID', 'OWNER_ID', 'ITEM_ID', 'SET_ID', 'TYPE'));
             while ($group = $groupsIterator->Fetch()) {
                 if ($group['OWNER_ID'] == $group['ITEM_ID']) {
                     $arItemsResult[$group['OWNER_ID']]['PRODUCT']['IS_GROUP'] = true;
                 }
             }
         }
     }
     return $arItemsResult;
 }
开发者ID:Satariall,项目名称:izurit,代码行数:78,代码来源:class.php

示例4: checkFieldsToUpdate


//.........这里部分代码省略.........
                     }
                     if (isset($arProductInSet[$arOneItem['ITEM_ID']])) {
                         self::$arErrors[] = array('id' => 'ITEM_ID', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_ITEM_ID_DUBLICATE'));
                         continue;
                     }
                     $arProductInSet[$arOneItem['ITEM_ID']] = true;
                     $intRowID = self::searchItem($arOneItem['ITEM_ID'], $arCurrent['ITEMS']);
                     if (false === $intRowID) {
                         $arOneItem = array_merge($arDefItem, $arOneItem);
                     } else {
                         $arOneItem['ID'] = $intRowID;
                     }
                     if (array_key_exists('SORT', $arOneItem)) {
                         $arOneItem['SORT'] = (int) $arOneItem['SORT'];
                         if ($arOneItem['SORT'] <= 0) {
                             $arOneItem['SORT'] = 100;
                         }
                     }
                     if (array_key_exists('QUANTITY', $arOneItem)) {
                         $arOneItem['QUANTITY'] = doubleval($arOneItem['QUANTITY']);
                         if (0 >= $arOneItem['QUANTITY']) {
                             self::$arErrors[] = array('id' => 'QUANTITY', 'text' => self::TYPE_SET == $arFields['TYPE'] ? GetMessage('BT_CAT_PRODUCT_SET_ERR_QUANTITY_IS_BAD') : GetMessage('BT_CAT_PRODUCT_SET_ERR_QUANTITY_GROUP_IS_BAD'));
                             continue;
                         }
                     }
                     if (self::TYPE_SET == $arCurrent['TYPE']) {
                         if (array_key_exists('MEASURE', $arOneItem)) {
                             $arOneItem['MEASURE'] = (int) $arOneItem['MEASURE'];
                             if ($arOneItem['MEASURE'] < 0) {
                                 $arOneItem['MEASURE'] = 0;
                             }
                         }
                         if (array_key_exists('DISCOUNT_PERCENT', $arOneItem)) {
                             if (false !== $arOneItem['DISCOUNT_PERCENT']) {
                                 $arOneItem['DISCOUNT_PERCENT'] = doubleval($arOneItem['DISCOUNT_PERCENT']);
                                 if (0 > $arOneItem['DISCOUNT_PERCENT'] || 100 < $arOneItem['DISCOUNT_PERCENT']) {
                                     self::$arErrors[] = array('id' => 'DISCOUNT_PERCENT', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_DISCOUNT_PERCENT_IS_BAD'));
                                     continue;
                                 }
                                 $dblDiscountPercent += $arOneItem['DISCOUNT_PERCENT'];
                             }
                         } else {
                             if (false !== $intRowID) {
                                 if (false !== $arCurrent['ITEMS'][$intRowID]['DISCOUNT_PERCENT']) {
                                     $dblDiscountPercent += $arCurrent['ITEMS'][$intRowID]['DISCOUNT_PERCENT'];
                                 }
                             }
                         }
                     }
                     $arValidItems[] = $arOneItem;
                 }
                 unset($arOneItem);
                 if (empty($arValidItems)) {
                     self::$arErrors[] = array('id' => 'ITEMS', 'text' => GetMessage('BT_CAT_SET_ERR_EMPTY_VALID_ITEMS'));
                 } else {
                     $arFields['ITEMS'] = $arValidItems;
                     $boolItems = true;
                 }
                 unset($arValidItems);
                 if (100 < $dblDiscountPercent) {
                     self::$arErrors[] = array('id' => 'DISCOUNT_PERCENT', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_ALL_DISCOUNT_PERCENT_IS_BAD'));
                 }
             }
         }
         if (empty(self::$arErrors)) {
             $arProductList = array_keys($arProductInSet);
             if (!self::$disableCheckProduct) {
                 if ($arFields['TYPE'] == self::TYPE_GROUP) {
                     $checkProductList = $arProductInSet;
                     if ($arFields['ITEM_ID'] > 0) {
                         unset($checkProductList[$arFields['ITEM_ID']]);
                     }
                     $checkProductList = array_keys($checkProductList);
                 } else {
                     $checkProductList = $arProductList;
                 }
                 if (!CCatalogProduct::CheckProducts($checkProductList)) {
                     self::$arErrors[] = array('id' => 'ITEMS', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_ITEMS_IS_NOT_PRODUCT'));
                 }
                 unset($checkProductList);
             }
             if (empty(self::$arErrors) && self::TYPE_SET == $arFields['TYPE']) {
                 if (CCatalogProductSet::isProductHaveSet($arProductList, self::TYPE_SET)) {
                     self::$arErrors[] = array('id' => 'ITEMS', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_ITEMS_IS_SET'));
                 }
                 $existSKU = array_filter(CCatalogSKU::getExistOffers($arProductList));
                 if (!empty($existSKU)) {
                     self::$arErrors[] = array('id' => 'ITEMS', 'text' => GetMessage('BT_CAT_PRODUCT_SET_ERR_ITEMS_IS_SKU'));
                 }
                 unset($existSKU);
             }
         }
     }
     if (empty(self::$arErrors)) {
         if ($boolItems) {
             self::setItemFieldsForUpdate($arFields, $arCurrent);
         }
     }
     return empty(self::$arErrors);
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:product_set.php

示例5: array

                 $productsWithBarCode[] = $product["ID"];
             }
         }
     }
     if (!empty($productsWithBarCode)) {
         $rsProducts = CCatalogStoreBarCode::getList(array(), array("PRODUCT_ID" => $productsWithBarCode));
         while ($product = $rsProducts->Fetch()) {
             if (isset($arRows[$product["PRODUCT_ID"]])) {
                 $arRows[$product["PRODUCT_ID"]]->arRes["CATALOG_BAR_CODE"] = htmlspecialcharsEx($product["BARCODE"]);
             }
         }
     }
 }
 if (!empty($arProductIDs)) {
     $arProductKeys = array_keys($arProductIDs);
     $existOffers = CCatalogSKU::getExistOffers($arProductKeys, $IBLOCK_ID);
     foreach ($arProductKeys as &$intProductID) {
         if (!empty($existOffers[$intProductID])) {
             $arRows[$intProductID]->arRes['CATALOG_TYPE'] = CCatalogProduct::TYPE_SKU;
             if (isset($arSelectedFieldsMap['CATALOG_QUANTITY_RESERVED'])) {
                 $arRows[$intProductID]->arRes['CATALOG_QUANTITY_RESERVED'] = '';
             }
         }
     }
     unset($intProductID, $existOffers);
 }
 if (!empty($arProductGroupIDs)) {
     $rsSets = CCatalogProductSet::getList(array(), array('OWNER_ID' => array_keys($arProductGroupIDs), 'SET_ID' => 0, 'TYPE' => CCatalogProductSet::TYPE_GROUP), false, false, array('ID', 'OWNER_ID', 'ITEM_ID', 'SET_ID', 'TYPE'));
     while ($arSet = $rsSets->Fetch()) {
         $arSet['OWNER_ID'] = (int) $arSet['OWNER_ID'];
         $arSet['ITEM_ID'] = (int) $arSet['ITEM_ID'];
开发者ID:rasuldev,项目名称:torino,代码行数:31,代码来源:iblock_element_admin.php

示例6: array_merge

	'SHOW_OLD_PRICE' => 'N',
	'ADD_TO_BASKET_ACTION' => 'ADD',
	'SHOW_CLOSE_POPUP' => 'N',
	'MESS_BTN_BUY' => '',
	'MESS_BTN_ADD_TO_BASKET' => '',
	'MESS_BTN_SUBSCRIBE' => '',
	'MESS_BTN_DETAIL' => '',
	'MESS_NOT_AVAILABLE' => '',
	'MESS_BTN_COMPARE' => ''
);
$arParams = array_merge($arDefaultParams, $arParams);
foreach ($arResult['ITEMS'] as $key => $arItem) {

    //$arResult['ITEMS'][$key]['OFFERS_a']='123123';
    $offers = CCatalogSKU::getExistOffers(
        $arItem['ID']
    );
    if(!empty($offers[$arItem['ID']]))
    {
        $mxResult = CCatalogSKU::GetInfoByProductIBlock($arParams['IBLOCK_ID']);
        
        $arResult['ITEMS'][$key]['OFFERS'] = 'Y';
        $offer = array();

        $rsOffers = CIBlockElement::GetList(
            array("PRICE"=>"ASC"),
            array(
                'IBLOCK_ID' => $mxResult['IBLOCK_ID'],
                'PROPERTY_'.$mxResult['SKU_PROPERTY_ID'] => $arItem["ID"]
            ),
            false,
开发者ID:CheBurashka334,项目名称:zakrepi,代码行数:31,代码来源:result_modifier.php


注:本文中的CCatalogSKU::getExistOffers方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。