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


PHP CCatalogProduct::GetList方法代码示例

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


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

示例1: addCatalogProducts

	protected function addCatalogProducts($arParams){
		if (!CModule::IncludeModule("iblock") && !CModule::IncludeModule("catalog") && !CModule::IncludeModule("sale")):
			return false;
		endif;
		$arFields = array(
			"ID" => $arParams["PRODUCT_ID"],
			"QUANTITY" => $arParams["BALANCE"],
			"CAN_BUY_ZERO" => "Y",
			"NEGATIVE_AMOUNT_TRACE" => "Y",
			"QUANTITY_TRACE" => "Y"
			);
		$db_res = CCatalogProduct::GetList(
			array(),
			array("ID" => $arParams["PRODUCT_ID"]),
			false,
			array()
			);
		if ($ar_res = $db_res->Fetch()):
			if (!CCatalogProduct::Update($ar_res["ID"], $arFields)):
				return false;
			endif;
		else:
			if(!CCatalogProduct::Add($arFields)):
				return false;
			endif;
		endif;
		return true;
	}
开发者ID:akniyev,项目名称:arteva.ru,代码行数:28,代码来源:addProductsPrice.php

示例2: OnProductCatalogHandler

function OnProductCatalogHandler($ID, $arFields)
{
    Bitrix\Main\Loader::includeModule('iblock');
    Bitrix\Main\Loader::includeModule('catalog');
    define('IBLOCK_ID_PRODUCTS', 2);
    define('IBLOCK_ID_OFFERS', 3);
    $query = new \Bitrix\Main\Entity\Query(Bitrix\Iblock\ElementTable::getEntity());
    $query->setSelect(array("ID", "IBLOCK_ID"))->setFilter(array("ID" => $ID))->setOrder(array("ID" => "ASC"));
    $resElement = $query->exec()->fetch();
    if ($resElement['IBLOCK_ID'] == IBLOCK_ID_PRODUCTS) {
        CIBlockElement::SetPropertyValuesEx($ID, $resElement['IBLOCK_ID'], array("AVAILABLE_QUANTITY_CATALOG" => $arFields['QUANTITY']));
    } elseif ($resElement['IBLOCK_ID'] == IBLOCK_ID_OFFERS) {
        //1
        $rsElementOffer = CIBlockElement::GetList(array(), array("ID" => $ID), false, false, array("ID", "IBLOCK_ID", 'NAME', "PROPERTY_CML2_LINK"))->fetch();
        $resElemOfferProduct = (int) $rsElementOffer['PROPERTY_CML2_LINK_VALUE'];
        //2
        $resOffersCML2 = CIBlockElement::GetList(array(), array("PROPERTY_CML2_LINK" => $resElemOfferProduct, 'IBLOCK_ID' => IBLOCK_ID_OFFERS), false, false, array("ID", "IBLOCK_ID", 'NAME'));
        //3
        $arrOffersIDs = array();
        while ($res = $resOffersCML2->fetch()) {
            $arrOffersIDs[] = $res['ID'];
        }
        //4
        $availQuant = array();
        foreach ($arrOffersIDs as $k => $v) {
            $ar_res_cat = CCatalogProduct::GetList(array("ID" => "DESC"), array("ID" => (int) $v), false, false, array("ID", "QUANTITY", 'ELEMENT_IBLOCK_ID', 'ELEMENT_NAME'))->fetch();
            $availQuant[] = $ar_res_cat['QUANTITY'];
        }
        //5
        $minAvailQuant = (int) min($availQuant);
        //6
        $resUpdateSCU = CIBlockElement::SetPropertyValuesEx($resElemOfferProduct, IBLOCK_ID_PRODUCTS, array("AVAILABLE_QUANTITY_CATALOG" => $minAvailQuant));
    }
}
开发者ID:VitaliiSestrenskyi,项目名称:sest,代码行数:34,代码来源:scu_sort_available.php

示例3: getProductList

 /**
  * @param Basket $basketCollection
  * @param array $productList
  * @return array
  */
 public static function getProductList(Basket $basketCollection, array $productList = array())
 {
     $productBasketIndex = array();
     $result = array();
     foreach ($basketCollection as $basketKey => $basketItem) {
         $productId = intval($basketItem->getProductId());
         if (intval($productId < 0) || sizeof($productList) > 0 && in_array($productId, $productList)) {
             continue;
         }
         $productBasketIndex[$basketKey] = $productId;
     }
     $rsProducts = \CCatalogProduct::GetList(array(), array('ID' => $productBasketIndex), false, false, array('ID', 'CAN_BUY_ZERO', 'NEGATIVE_AMOUNT_TRACE', 'QUANTITY_TRACE', 'QUANTITY', 'QUANTITY_RESERVED'));
     while ($arProduct = $rsProducts->Fetch()) {
         $result[$arProduct['ID']] = $arProduct;
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:22,代码来源:reservation.php

示例4: updateAll

 public static function updateAll($page = 0, &$total, $perPage = CAutoPriceUpdater::LIMIT)
 {
     $list = CCatalogProduct::GetList(array(), array('IBLOCK_ID' => self::enabledCatalogs()), false, array('iNumPage' => $page + 1, 'nPageSize' => $perPage), array('ID'));
     $total = $list->NavPageCount;
     if ($page + 1 > $list->NavPageCount) {
         return false;
     }
     $priceType = COption::GetOptionInt('autoprice', 'priceTypes', 0);
     while ($res = $list->Fetch()) {
         $price = CPrice::GetBasePrice($res['ID'], false, false);
         $priseRub = floatval($price * self::$usdRate);
         if ($priseRub < 1000 && self::$extras[0]) {
             self::setExtra($res['ID'], $priceType, self::$extras[0]);
         } elseif ($priseRub < 10000 && self::$extras[1]) {
             self::setExtra($res['ID'], $priceType, self::$extras[1]);
         } elseif ($priseRub < 100000 && self::$extras[2]) {
             self::setExtra($res['ID'], $priceType, self::$extras[2]);
         }
     }
     return $page + 1 < $total;
 }
开发者ID:ASDAFF,项目名称:module.markup,代码行数:21,代码来源:CQuetzalMarkupPriceUpdate.php

示例5: getProductMeasures

 public static function getProductMeasures($productID)
 {
     if (!Main\Loader::includeModule('catalog')) {
         throw new Main\SystemException("Could not load 'catalog' module.");
     }
     $productIDs = is_array($productID) ? $productID : array($productID);
     $measure2product = array();
     if (!empty($productIDs)) {
         $productEntity = new \CCatalogProduct();
         $dbProductResult = $productEntity->GetList(array(), array('@ID' => $productIDs), false, false, array('ID', 'MEASURE'));
         if (is_object($dbProductResult)) {
             while ($productFields = $dbProductResult->Fetch()) {
                 $measureID = isset($productFields['MEASURE']) ? intval($productFields['MEASURE']) : 0;
                 if ($measureID <= 0) {
                     continue;
                 }
                 if (isset($measure2product[$measureID])) {
                     $measure2product[$measureID] = array();
                 }
                 $measure2product[$measureID][] = intval($productFields['ID']);
             }
         }
     }
     $result = array();
     if (!empty($measure2product)) {
         $dbMeasureResult = \CCatalogMeasure::getList(array(), array('@ID' => array_keys($measure2product)), false, false, array('ID', 'CODE', 'SYMBOL_RUS', 'SYMBOL_INTL', 'IS_DEFAULT'));
         if (is_object($dbMeasureResult)) {
             while ($measureFields = $dbMeasureResult->Fetch()) {
                 $measureID = intval($measureFields['ID']);
                 $measureInfo = array('ID' => $measureID, 'CODE' => intval($measureFields['CODE']), 'IS_DEFAULT' => isset($measureFields['IS_DEFAULT']) && $measureFields['IS_DEFAULT'] === 'Y', 'SYMBOL' => isset($measureFields['SYMBOL_RUS']) ? $measureFields['SYMBOL_RUS'] : $measureFields['SYMBOL_INTL']);
                 foreach ($measure2product[$measureID] as $productID) {
                     $result[$productID] = array($measureInfo);
                 }
             }
         }
     }
     return $result;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:38,代码来源:measure.php

示例6: getAvailableQuantity

function getAvailableQuantity($arBasketItems)
{
    if (empty($arBasketItems) || !is_array($arBasketItems)) {
        return array();
    }
    if ($catalogIncluded === null) {
        $catalogIncluded = Loader::includeModule('catalog');
    }
    if (!$catalogIncluded) {
        return false;
    }
    $arElementId = array();
    $productMap = array();
    foreach ($arBasketItems as $key => $arItem) {
        $arElementId[$arItem['PRODUCT_ID']] = $arItem['PRODUCT_ID'];
        if (!isset($productMap[$arItem['PRODUCT_ID']])) {
            $productMap[$arItem['PRODUCT_ID']] = array();
        }
        $productMap[$arItem['PRODUCT_ID']][] = $key;
    }
    unset($key, $arItem);
    if (!empty($arElementId)) {
        $productIterator = CCatalogProduct::GetList(array(), array('ID' => $arElementId), false, false, array('ID', 'QUANTITY'));
        while ($product = $productIterator->Fetch()) {
            if (!isset($productMap[$product['ID']])) {
                continue;
            }
            foreach ($productMap[$product['ID']] as $key) {
                $arBasketItems[$key]['AVAILABLE_QUANTITY'] = $product['QUANTITY'];
            }
            unset($key);
        }
        unset($product, $productIterator);
    }
    unset($productMap, $arElementId);
    return $arBasketItems;
}
开发者ID:Andreyjktl,项目名称:rezina74,代码行数:37,代码来源:result_modifier.php

示例7: fillSetItemsParams

 protected function fillSetItemsParams(&$items)
 {
     $productIterator = CCatalogProduct::GetList(array(), array('=ID' => array_keys($items)), false, false, array('ID', 'QUANTITY', 'QUANTITY_TRACE', 'CAN_BUY_ZERO', 'WEIGHT'));
     while ($product = $productIterator->Fetch()) {
         $product['ID'] = (int) $product['ID'];
         if (isset($items[$product['ID']])) {
             $items[$product['ID']] = array_merge($items[$product['ID']], $product);
         }
     }
 }
开发者ID:rasuldev,项目名称:torino,代码行数:10,代码来源:product_set.php

示例8: GetProductSku

/**
 * @param $userId
 * @param $lid
 * @param $productId
 * @param string $productName
 * @param string $currency
 * @param array $arProduct
 * @return array|bool
 */
function GetProductSku($userId, $lid, $productId, $productName = '', $currency = '', $arProduct = array())
{
    $userId = intval($userId);
    $productId = intval($productId);
    if ($productId <= 0) {
        return false;
    }
    $lid = trim($lid);
    if (strlen($lid) <= 0) {
        return false;
    }
    $productName = trim($productName);
    $arResult = array();
    static $arCacheGroups = array();
    if (!isset($arCacheGroups[$userId])) {
        $arCacheGroups[$userId] = CUser::GetUserGroup($userId);
    }
    $arGroups = $arCacheGroups[$userId];
    if (!isset($arProduct["IBLOCK_ID"]) || 0 >= intval($arProduct["IBLOCK_ID"])) {
        $arProduct["IBLOCK_ID"] = CIBlockElement::GetIBlockByID($arProduct["IBLOCK_ID"]);
    }
    static $arOffersIblock = array();
    if (!isset($arOffersIblock[$arProduct["IBLOCK_ID"]])) {
        $mxResult = CCatalogSKU::GetInfoByProductIBlock($arProduct["IBLOCK_ID"]);
        if (is_array($mxResult)) {
            $arOffersIblock[$arProduct["IBLOCK_ID"]] = $mxResult["IBLOCK_ID"];
        }
    }
    if ($arOffersIblock[$arProduct["IBLOCK_ID"]] > 0) {
        static $arCacheOfferProperties = array();
        if (!is_set($arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]])) {
            $dbOfferProperties = CIBlockProperty::GetList(array('SORT' => 'ASC', 'ID' => 'ASC'), array('IBLOCK_ID' => $arOffersIblock[$arProduct["IBLOCK_ID"]], 'ACTIVE' => 'Y', "!XML_ID" => "CML2_LINK"));
            while ($arOfferProperties = $dbOfferProperties->Fetch()) {
                if ('F' == $arOfferProperties['PROPERTY_TYPE']) {
                    continue;
                }
                $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]][] = $arOfferProperties;
            }
        }
        $arOfferProperties = $arCacheOfferProperties[$arOffersIblock[$arProduct["IBLOCK_ID"]]];
        $arIblockOfferProps = array();
        $arIblockOfferPropsFilter = array();
        if (is_array($arOfferProperties)) {
            foreach ($arOfferProperties as $val) {
                $arIblockOfferProps[] = array("CODE" => $val["CODE"], "NAME" => $val["NAME"]);
                $arIblockOfferPropsFilter[] = $val["CODE"];
            }
        }
        $arOffers = CIBlockPriceTools::GetOffersArray($arProduct["IBLOCK_ID"], $productId, array("ID" => "DESC"), array("NAME", "EXTERNAL_ID"), $arIblockOfferPropsFilter, 0, array(), 1, array(), $userId, $lid);
        $arSku = array();
        $arSkuId = array();
        $arImgSku = array();
        foreach ($arOffers as $arOffer) {
            $arSkuId[] = $arOffer['ID'];
        }
        if (!empty($arSkuId)) {
            $res = CIBlockElement::GetList(array(), array("ID" => $arSkuId), false, false, array("ID", "IBLOCK_ID", "NAME", "PREVIEW_PICTURE", "DETAIL_PICTURE", "DETAIL_PAGE_URL", "ACTIVE"));
            while ($arOfferImg = $res->GetNext()) {
                $arImgSku[$arOfferImg["ID"]] = $arOfferImg;
            }
        }
        $arOffersId = array();
        foreach ($arOffers as $arOffer) {
            $arOffersId[] = $arOffer['ID'];
        }
        $dbCatalogProduct = CCatalogProduct::GetList(array(), array("ID" => $arOffersId));
        while ($arCatalogProduct = $dbCatalogProduct->fetch()) {
            $arCatalogProductResult[$arCatalogProduct["ID"]] = $arCatalogProduct;
        }
        foreach ($arOffers as $arOffer) {
            $arSkuTmp = array();
            $active = '';
            $arOffer["CAN_BUY"] = "N";
            $arCatalogProduct = $arCatalogProductResult[$arOffer["ID"]];
            if (!empty($arCatalogProduct)) {
                if ($arCatalogProduct["CAN_BUY_ZERO"] != "Y" && ($arCatalogProduct["QUANTITY_TRACE"] == "Y" && doubleval($arCatalogProduct["QUANTITY"]) <= 0)) {
                    $arOffer["CAN_BUY"] = "N";
                } else {
                    $arOffer["CAN_BUY"] = "Y";
                }
            }
            $arSkuTmp["ImageUrl"] = '';
            if ($arOffer["CAN_BUY"] == "Y") {
                if (isset($arImgSku[$arOffer['ID']]) && !empty($arImgSku[$arOffer['ID']])) {
                    if ('' == $productName) {
                        $productName = $arImgSku[$arOffer['ID']]["~NAME"];
                    }
                    $active = $arImgSku[$arOffer['ID']]["ACTIVE"];
                    if ($arImgSku[$arOffer['ID']]["PREVIEW_PICTURE"] != "") {
                        $arSkuTmp["PREVIEW_PICTURE"] = $arImgSku[$arOffer['ID']]["PREVIEW_PICTURE"];
                    }
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:101,代码来源:cat_store_product_search.php

示例9: ExtendBasketItems

 public function ExtendBasketItems(&$arBasket, $arExtend)
 {
     $arFields = array('ID', 'IBLOCK_ID', 'CODE', 'XML_ID', 'NAME', 'DATE_ACTIVE_FROM', 'DATE_ACTIVE_TO', 'SORT', 'PREVIEW_TEXT', 'DETAIL_TEXT', 'DATE_CREATE', 'CREATED_BY', 'TIMESTAMP_X', 'MODIFIED_BY', 'TAGS', 'TIMESTAMP_X_UNIX', 'DATE_CREATE_UNIX');
     $arCatFields = array('ID', 'QUANTITY', 'WEIGHT', 'VAT_ID', 'VAT_INCLUDED');
     $boolFields = false;
     if (isset($arExtend['catalog']['fields'])) {
         $boolFields = (bool) $arExtend['catalog']['fields'];
     }
     $boolProps = false;
     if (isset($arExtend['catalog']['props'])) {
         $boolProps = (bool) $arExtend['catalog']['props'];
     }
     if ($boolFields || $boolProps) {
         $arMap = array();
         $arIDS = array();
         foreach ($arBasket as $strKey => $arOneRow) {
             if (isset($arOneRow['MODULE']) && 'catalog' == $arOneRow['MODULE']) {
                 $intProductID = (int) $arOneRow['PRODUCT_ID'];
                 if ($intProductID > 0) {
                     $arIDS[$intProductID] = true;
                     if (!isset($arMap[$intProductID])) {
                         $arMap[$intProductID] = array();
                     }
                     $arMap[$intProductID][] = $strKey;
                 }
             }
         }
         if (!empty($arIDS)) {
             $arBasketResult = array();
             $iblockGroup = array();
             $arIDS = array_keys($arIDS);
             self::SetProductSectionsCache($arIDS);
             CTimeZone::Disable();
             $rsItems = CIBlockElement::GetList(array(), array('ID' => $arIDS), false, false, $arFields);
             while ($arItem = $rsItems->Fetch()) {
                 $arBasketData = array();
                 $arItem['ID'] = (int) $arItem['ID'];
                 $arItem['IBLOCK_ID'] = (int) $arItem['IBLOCK_ID'];
                 if (!isset($iblockGroup[$arItem['IBLOCK_ID']])) {
                     $iblockGroup[$arItem['IBLOCK_ID']] = array();
                 }
                 $iblockGroup[$arItem['IBLOCK_ID']][] = $arItem['ID'];
                 if ($boolFields) {
                     $arBasketData['ID'] = $arItem['ID'];
                     $arBasketData['IBLOCK_ID'] = $arItem['IBLOCK_ID'];
                     $arBasketData['NAME'] = $arItem['NAME'];
                     $arBasketData['XML_ID'] = (string) $arItem['XML_ID'];
                     $arBasketData['CODE'] = (string) $arItem['CODE'];
                     $arBasketData['TAGS'] = (string) $arItem['TAGS'];
                     $arBasketData['SORT'] = (int) $arBasketData['SORT'];
                     $arBasketData['PREVIEW_TEXT'] = (string) $arBasketData['PREVIEW_TEXT'];
                     $arBasketData['DETAIL_TEXT'] = (string) $arBasketData['DETAIL_TEXT'];
                     $arBasketData['CREATED_BY'] = (int) $arBasketData['CREATED_BY'];
                     $arBasketData['MODIFIED_BY'] = (int) $arBasketData['MODIFIED_BY'];
                     $arBasketData['DATE_ACTIVE_FROM'] = (string) $arItem['DATE_ACTIVE_FROM'];
                     if (!empty($arBasketData['DATE_ACTIVE_FROM'])) {
                         $arBasketData['DATE_ACTIVE_FROM'] = (int) MakeTimeStamp($arBasketData['DATE_ACTIVE_FROM']);
                     }
                     $arBasketData['DATE_ACTIVE_TO'] = (string) $arItem['DATE_ACTIVE_TO'];
                     if (!empty($arBasketData['DATE_ACTIVE_TO'])) {
                         $arBasketData['DATE_ACTIVE_TO'] = (int) MakeTimeStamp($arBasketData['DATE_ACTIVE_TO']);
                     }
                     if (isset($arItem['DATE_CREATE_UNIX'])) {
                         $arBasketData['DATE_CREATE'] = (string) $arItem['DATE_CREATE_UNIX'];
                         if ($arBasketData['DATE_CREATE'] != '') {
                             $arBasketData['DATE_CREATE'] = (int) $arBasketData['DATE_CREATE'];
                         }
                     } else {
                         $arBasketData['DATE_CREATE'] = (string) $arItem['DATE_CREATE'];
                         if ($arBasketData['DATE_CREATE'] != '') {
                             $arBasketData['DATE_CREATE'] = (int) MakeTimeStamp($arBasketData['DATE_CREATE']);
                         }
                     }
                     if (isset($arItem['TIMESTAMP_X_UNIX'])) {
                         $arBasketData['TIMESTAMP_X'] = (string) $arItem['TIMESTAMP_X_UNIX'];
                         if ($arBasketData['TIMESTAMP_X'] != '') {
                             $arBasketData['TIMESTAMP_X'] = (int) $arBasketData['TIMESTAMP_X'];
                         }
                     } else {
                         $arBasketData['TIMESTAMP_X'] = (string) $arItem['TIMESTAMP_X'];
                         if ($arBasketData['TIMESTAMP_X'] != '') {
                             $arBasketData['TIMESTAMP_X'] = (int) MakeTimeStamp($arBasketData['TIMESTAMP_X']);
                         }
                     }
                     $arProductSections = self::__GetSectionList($arItem['IBLOCK_ID'], $arItem['ID']);
                     if ($arProductSections !== false) {
                         $arBasketData['SECTION_ID'] = $arProductSections;
                     } else {
                         $arBasketData['SECTION_ID'] = array();
                     }
                 }
                 if ($boolProps) {
                     $arBasketData['PROPERTIES'] = array();
                 }
                 $arBasketResult[$arItem['ID']] = $arBasketData;
             }
             CTimeZone::Enable();
             if ($boolProps && !empty($iblockGroup)) {
                 foreach ($iblockGroup as $iblockID => $iblockItems) {
                     $filter = array('ID' => $iblockItems, 'IBLOCK_ID' => $iblockID);
//.........这里部分代码省略.........
开发者ID:rasuldev,项目名称:torino,代码行数:101,代码来源:discount.php

示例10: array

                 $ar_res = CIBlockElement::GetByID($arItem["ITEM_ID"])->GetNextElement();
                 if ($ar_res) {
                     $field = $ar_res->GetFields();
                     $props = $ar_res->GetProperties();
                     if ($field['PREVIEW_PICTURE']) {
                         $arResult["SEARCH"][$i]["PREVIEW_PICTURE"] = CFile::GetPath($field['PREVIEW_PICTURE']);
                     }
                     $arResult["SEARCH"][$i]["FOR_ORDER"] = $props['FOR_ORDER'];
                     if (!is_array($arResult["SEARCH"][$i]["PRICES"]) && is_array($props['PRICE_BASE'])) {
                         $arResult["SEARCH"][$i]["PRICES"] = array();
                         $arResult["SEARCH"][$i]["PRICES"]["PRICE"] = $props['PRICE_BASE']["VALUE"] . " <span class='rubl'>" . GetMessage('RUB') . "</span>";
                     }
                 }
             }
             if (CModule::IncludeModule("catalog")) {
                 $db_res = CCatalogProduct::GetList(array(), array("ID" => $arItem["ITEM_ID"]), false, false, array("QUANTITY", "QUANTITY_TRACE", "CAN_BUY_ZERO"));
                 while ($ar_res = $db_res->Fetch()) {
                     $arResult["SEARCH"][$i]["QUANTITY"] = $ar_res["QUANTITY"];
                     $arResult["SEARCH"][$i]["QUANTITY_TRACE"] = $ar_res["QUANTITY_TRACE"];
                     $arResult["SEARCH"][$i]["CAN_BUY_ZERO"] = $ar_res["CAN_BUY_ZERO"];
                 }
             }
             /* preview end */
             break;
     }
 }
 $arParams['PHOTO_SIZE'] = $arParams['PHOTO_SIZE'] ? intval($arParams['PHOTO_SIZE']) : 5;
 if (!empty($arResult["CATEGORIES"])) {
     // ----- find photo ---------
     $arParams['IMAGE'] = 'MORE_PHOTO';
     $arParams['HEIGHT'] = '50';
开发者ID:akniyev,项目名称:itprom_dobrohost,代码行数:31,代码来源:result_modifier.php

示例11: QuantityTracer

	/**
	 * <p>Уменьшает количество на складе товара с кодом PRODUCT_ID на величину DELTA_QUANTITY, если указанное количество есть на складе и у товара установлен флаг "уменьшать количество товара при заказе" </p>
	 *
	 *
	 *
	 *
	 * @param int $PRODUCT_ID  Код товара.
	 *
	 *
	 *
	 * @param int $DELTA_QUANTITY  Число, на которое нужно уменьшить количество товара на складе.
	 *
	 *
	 *
	 * @return bool <p>Возвращает <i>true</i> в случае успешного уменьшения и <i>false</i> - в
	 * противном случае </p><a name="examples"></a>
	 *
	 *
	 * <h4>Example</h4> 
	 * <pre>
	 * &lt;?
	 * // Уменьшим количество на складе товара 5 на 12 штук
	 * CCatalogProduct::QuantityTracer(5, 12);
	 * ?&gt;
	 * </pre>
	 *
	 *
	 * @static
	 * @link http://dev.1c-bitrix.ru/api_help/catalog/classes/ccatalogproduct/ccatalogproduct__quantitytracer.8cc817fa.php
	 * @author Bitrix
	 */
	public static function QuantityTracer($ProductID, $DeltaQuantity)
	{
		global $DB;
		global $CACHE_MANAGER;

		$boolClearCache = false;

		$ProductID = intval($ProductID);
		if (0 >= $ProductID)
			return false;
		$DeltaQuantity = doubleval($DeltaQuantity);
		if ($DeltaQuantity==0)
			return false;

		$rsProducts = CCatalogProduct::GetList(
			array(),
			array('ID' => $ProductID),
			false,
			false,
			array('ID', 'CAN_BUY_ZERO', 'NEGATIVE_AMOUNT_TRACE', 'QUANTITY_TRACE', 'QUANTITY', 'ELEMENT_IBLOCK_ID')
		);
		if (($arProduct = $rsProducts->Fetch())
			&& ($arProduct["QUANTITY_TRACE"]=="Y"))
		{
			$strAllowNegativeAmount = $arProduct["NEGATIVE_AMOUNT_TRACE"];

			$arFields = array();
			$arFields["QUANTITY"] = doubleval($arProduct["QUANTITY"]) - $DeltaQuantity;

			if ('Y' != $arProduct['CAN_BUY_ZERO'])
			{
				if (defined("BX_COMP_MANAGED_CACHE"))
				{
					$boolClearCache = (0 >= $arFields["QUANTITY"]*$arProduct["QUANTITY"]);
				}
			}

			if ('Y' != $arProduct['CAN_BUY_ZERO'] || 'Y' != $strAllowNegativeAmount)
			{
				if (0 >= $arFields["QUANTITY"])
					$arFields["QUANTITY"] = 0;
			}

			$arFields['OLD_QUANTITY'] = $arProduct["QUANTITY"];
			CCatalogProduct::Update($arProduct["ID"], $arFields);

			if ($boolClearCache)
				$CACHE_MANAGER->ClearByTag('iblock_id_'.$arProduct['ELEMENT_IBLOCK_ID']);

			$arProduct['OLD_QUANTITY'] = $arFields['OLD_QUANTITY'];
			$arProduct['QUANTITY'] = $arFields['QUANTITY'];
			$arProduct['ALLOW_NEGATIVE_AMOUNT'] = $strAllowNegativeAmount;
			$arProduct['DELTA'] = $DeltaQuantity;
			foreach (GetModuleEvents("catalog", "OnProductQuantityTrace", true) as $arEvent)
			{
				ExecuteModuleEventEx($arEvent, array($arProduct["ID"], $arProduct));
			}

			return true;
		}

		return false;
	}
开发者ID:ASDAFF,项目名称:bxApiDocs,代码行数:94,代码来源:product.php

示例12: str_replace

     if (array_key_exists("QUANTITY_" . $val["ID"], $_POST)) {
         $_POST["QUANTITY_" . $val["ID"]] = str_replace(",", ".", $_POST["QUANTITY_" . $val["ID"]]);
         $dblQuantity = $arParams['QUANTITY_FLOAT'] == 'Y' ? DoubleVal($_POST["QUANTITY_" . $val["ID"]]) : intval($_POST["QUANTITY_" . $val["ID"]]);
         if ($dblQuantity != $val['QUANTITY']) {
             if ('catalog' == $val['MODULE']) {
                 $arProductIDs[$val["PRODUCT_ID"]] = $key;
                 $arNewQuantity[$val["PRODUCT_ID"]] = $dblQuantity;
             } else {
                 $arFields = array("QUANTITY" => $dblQuantity);
                 CSaleBasket::Update($val["ID"], $arFields);
             }
         }
     }
 }
 if (!empty($arProductIDs) && Loader::includeModule('catalog')) {
     $rsProducts = CCatalogProduct::GetList(array(), array('ID' => array_keys($arProductIDs)), false, false, $arSelect);
     while ($arProduct = $rsProducts->Fetch()) {
         if (array_key_exists($arProduct['ID'], $arProductIDs)) {
             $key = $arProductIDs[$arProduct['ID']];
             if ($arNewQuantity[$arProduct['ID']] > $arProduct['QUANTITY'] && 'Y' == $arProduct['QUANTITY_TRACE'] && 'N' == $arProduct['CAN_BUY_ZERO']) {
                 $arNewQuantity[$arProduct['ID']] = $arProduct['QUANTITY'];
                 $productLimit .= GetMessage("STOF_WARNING_LIMIT_PRODUCT") . " " . $arShoppingCart[$key]["NAME"] . "<br>";
             }
             if ($arNewQuantity[$arProduct['ID']] != $arShoppingCart[$key]['QUANTITY']) {
                 $arShoppingCart[$key]['QUANTITY'] = $arNewQuantity[$arProduct['ID']];
                 $arFields = array("QUANTITY" => $arNewQuantity[$arProduct['ID']], 'TYPE' => $arShoppingCart[$key]['TYPE'], 'SET_PARENT_ID' => $arShoppingCart[$key]['SET_PARENT_ID']);
                 CSaleBasket::Update($arShoppingCart[$key]["ID"], $arFields);
             }
         }
     }
 }
开发者ID:webgksupport,项目名称:alpina,代码行数:31,代码来源:component.php

示例13: floatval

						$arCatalogProduct[$val["PRODUCT_ID"]] = $val["TABLE_ROW_ID"];
					}
					$orderDiscount += $val["DISCOUNT_PRICE"] * $val["QUANTITY"];
					$arFilterRecommended[] = $val["PRODUCT_ID"];

					$priceBaseTotal += ($priceBase * $val["QUANTITY"]);
				}
			}


			if (!empty($arCatalogProduct) && $bUseCatalog)
			{
				$rsItems = CCatalogProduct::GetList(
					array(),
					array('ID' => array_keys($arCatalogProduct)),
					false,
					false,
					array('ID', 'QUANTITY')
				);
				while ($arItem = $rsItems->Fetch())
				{
					$strKey = $arCatalogProduct[$arItem['ID']];
					$arData[$strKey]["BALANCE"] = floatval($arItem['QUANTITY']);
				}
			}
		}
		$arData[0]["ORDER_ERROR"] = "N";

		//change delivery price
		$deliveryChangePrice = false;
		if ($delpricechange == "Y")
开发者ID:ASDAFF,项目名称:entask.ru,代码行数:31,代码来源:order_new.php

示例14: getProductDataToFillBasket

function getProductDataToFillBasket($productId, $quantity, $userId, $LID, $userColumns, $tmpId = "")
{
	if (!\Bitrix\Main\Loader::includeModule("catalog"))
		return array();

	$arParams = array();

	$productId = (int)$productId;
	if ($productId <= 0)
	{
		return $arParams;
	}
	$iblockId = (int)CIBlockElement::GetIBlockByID($productId);
	if ($iblockId <= 0)
	{
		return $arParams;
	}

	$arSku2Parent = array();
	$arElementId = array();

	$arElementId[] = $productId;
	$arParent = CCatalogSku::GetProductInfo($productId, $iblockId);
	if ($arParent)
	{
		$arElementId[] = $arParent["ID"];
		$arSku2Parent[$productId] = $arParent["ID"];
	}

	$arPropertyInfo = array();
	$userColumns = (string)$userColumns;
	$arUserColumns = ($userColumns != '') ? explode(",", $userColumns) : array();
	foreach ($arUserColumns as $key => $column)
	{
		if (strncmp($column, 'PROPERTY_', 9) != 0)
		{
			unset($arUserColumns[$key]);
		}
		else
		{
			$propertyCode = substr($column, 9);
			if ($propertyCode == '')
			{
				unset($arUserColumns[$key]);
				continue;
			}
			$dbres = CIBlockProperty::GetList(array(), array("CODE" => $propertyCode));
			if ($arPropData = $dbres->GetNext())
				$arPropertyInfo[$column] = $arPropData;
		}
	}

	$arSelect = array_merge(
		array("ID", "NAME", "LID", "IBLOCK_ID", "IBLOCK_SECTION_ID", "DETAIL_PICTURE", "PREVIEW_PICTURE", "DETAIL_PAGE_URL", "XML_ID", "IBLOCK_XML_ID"),
		$arUserColumns
	);

	$arProductData = getProductProps($arElementId, $arSelect);

	$defaultMeasure = CCatalogMeasure::getDefaultMeasure(true, true);

	if (!empty($arProductData))
	{
		$arElementInfo = array();
		foreach ($arProductData as $elemId => &$arElement)
		{
			foreach ($arElement as $key => $value)
			{
				if (strncmp($key, 'PROPERTY_', 9) == 0 && substr($key, -6) == "_VALUE")
				{
					$columnCode = str_replace("_VALUE", "", $key);
					$arElement[$key] = getIblockPropInfo($value, $arPropertyInfo[$columnCode], array("WIDTH" => 90, "HEIGHT" => 90));
				}
			}
		}
		unset($arElement);

		if (isset($arProductData[$productId]))
			$arElementInfo = $arProductData[$productId];

		if (isset( $arSku2Parent[$productId]))
			$arParent = $arProductData[$arSku2Parent[$productId]];

		if (!empty($arSku2Parent)) // if sku element doesn't have value of some property - we'll show parent element value instead
		{
			foreach ($arUserColumns as $field)
			{
				$fieldVal = $field."_VALUE";
				$parentId = $arSku2Parent[$productId];

				if ((!isset($arElementInfo[$fieldVal]) || (isset($arElementInfo[$fieldVal]) && strlen($arElementInfo[$fieldVal]) == 0))
					&& (isset($arProductData[$parentId][$fieldVal]) && !empty($arProductData[$parentId][$fieldVal]))) // can be array or string
				{
					$arElementInfo[$fieldVal] = $arProductData[$parentId][$fieldVal];
				}
			}
			if (strpos($arElementInfo["~XML_ID"], '#') === false)
			{
				$arElementInfo["~XML_ID"] = $arParent['~XML_ID'].'#'.$arElementInfo["~XML_ID"];
			}
//.........这里部分代码省略.........
开发者ID:akniyev,项目名称:arteva.ru,代码行数:101,代码来源:admin_tool.php

示例15: array_keys

$boolIBlockElementAdd = CIBlockSectionRights::UserHasRightTo($IBLOCK_ID, $find_section_section, "section_element_bind");

$arElementOps = CIBlockElementRights::UserHasRightTo(
                $IBLOCK_ID, array_keys($arRows), "", CIBlockRights::RETURN_OPERATIONS
);
$availQuantityTrace = COption::GetOptionString("catalog", "default_quantity_trace", 'N');
$arQuantityTrace = array(
    "D" => GetMessage("IBEL_DEFAULT_VALUE") . " (" . ($availQuantityTrace == 'Y' ? GetMessage("IBEL_YES_VALUE") : GetMessage("IBEL_NO_VALUE")) . ")",
    "Y" => GetMessage("IBEL_YES_VALUE"),
    "N" => GetMessage("IBEL_NO_VALUE"),
);
if ($bCatalog && !empty($arRows)) {
    $arRowKeys = array_keys($arRows);
    if ($strUseStoreControl == "Y" && in_array("CATALOG_BAR_CODE", $arSelectedFields)) {
        $rsProducts = CCatalogProduct::GetList(
                        array(), array('@ID' => $arRowKeys), false, false, array('ID', 'BARCODE_MULTI')
        );
        $productsWithBarCode = array();
        while ($product = $rsProducts->Fetch()) {
            if (isset($arRows[$product["ID"]])) {
                if ($product["BARCODE_MULTI"] == "Y")
                    $arRows[$product["ID"]]->arRes["CATALOG_BAR_CODE"] = GetMessage("IBEL_CATALOG_BAR_CODE_MULTI");
                else
                    $productsWithBarCode[] = $product["ID"];
            }
        }
        if (!empty($productsWithBarCode)) {
            $rsProducts = CCatalogStoreBarCode::getList(array(), array(
                        "PRODUCT_ID" => $productsWithBarCode,
            ));
            while ($product = $rsProducts->Fetch()) {
开发者ID:ASDAFF,项目名称:bitrix-modules-setprops,代码行数:31,代码来源:setprops.php


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