本文整理汇总了PHP中CCatalogSKU::getOffersList方法的典型用法代码示例。如果您正苦于以下问题:PHP CCatalogSKU::getOffersList方法的具体用法?PHP CCatalogSKU::getOffersList怎么用?PHP CCatalogSKU::getOffersList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCatalogSKU
的用法示例。
在下文中一共展示了CCatalogSKU::getOffersList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadAllSku
protected function loadAllSku(array $productIds)
{
$arOffersIblock = $this->getOffersIblockId();
if ($arOffersIblock > 0 && $productIds) {
$propFilter = array();
$props = $this->getSkuProps(true);
if ($props) {
foreach ($props as $prop) {
$propFilter['ID'][] = $prop['ID'];
}
}
$select = array('NAME', "ACTIVE", 'CATALOG_QUANTITY');
$visible = $this->getVisibleColumns();
if (in_array('PREVIEW_PICTURE', $visible)) {
$select[] = 'PREVIEW_PICTURE';
}
if (in_array('DETAIL_PICTURE', $visible)) {
$select[] = 'DETAIL_PICTURE';
}
$this->offers = \CCatalogSKU::getOffersList($productIds, $this->getIblockId(), array(), $select, $propFilter);
if (!empty($this->offers)) {
$offersIds = array();
$offersLink = array();
foreach ($this->offers as $productId => $productOffers) {
if (empty($productOffers)) {
continue;
}
$productOffersIds = array_keys($productOffers);
foreach ($productOffersIds as &$oneId) {
$offersIds[] = $oneId;
$offersLink[$oneId] =& $this->offers[$productId][$oneId];
}
}
unset($productId, $productOffers);
if (!empty($offersIds)) {
$ratioResult = Catalog\ProductTable::getCurrentRatioWithMeasure($offersIds);
if (!empty($ratioResult)) {
foreach ($ratioResult as $oneOfferId => $ratioData) {
if (!isset($offersLink[$oneOfferId])) {
continue;
}
$offersLink[$oneOfferId]['MEASURE_RATIO'] = $ratioData['RATIO'];
$offersLink[$oneOfferId]['MEASURE'] = $ratioData['MEASURE'];
}
unset($oneOfferId, $ratioData);
}
unset($ratioResult);
}
unset($offersLink, $offersIds);
}
}
}
示例2: loadAllSku
protected function loadAllSku(array $productIds)
{
$arOffersIblock = $this->getOffersIblockId();
if ($arOffersIblock > 0 && $productIds) {
$propFilter = array();
$props = $this->getSkuProps(true);
if ($props) {
foreach ($props as $prop) {
$propFilter['ID'][] = $prop['ID'];
}
}
$select = array('NAME', "ACTIVE", 'CATALOG_QUANTITY');
$visible = $this->getVisibleColumns();
if (in_array('PREVIEW_PICTURE', $visible)) {
$select[] = 'PREVIEW_PICTURE';
}
if (in_array('DETAIL_PICTURE', $visible)) {
$select[] = 'DETAIL_PICTURE';
}
$this->offers = \CCatalogSKU::getOffersList($productIds, $this->getIblockId(), array(), $select, $propFilter);
}
}
示例3: getOffersSkuParams
public static function getOffersSkuParams(array $productsParams)
{
if (self::$catalogIncluded === null) {
self::$catalogIncluded = Main\Loader::includeModule('catalog');
}
if (!self::$catalogIncluded) {
return $productsParams;
}
foreach ($productsParams["ITEMS"] as &$params) {
if (!isset(self::$productsOffersSkuParams[$params["PRODUCT_ID"]])) {
$propFilter = array();
$props = static::getSkuProps(true, $params["IBLOCK_ID"]);
if ($props) {
foreach ($props as $prop) {
$propFilter['ID'][] = $prop['ID'];
}
}
$select = array('NAME', "ACTIVE", 'CATALOG_QUANTITY');
$offers = \CCatalogSKU::getOffersList(array($params["PRODUCT_ID"]), 0, array(), $select, $propFilter);
if ($offers) {
$tmpProps = static::getPropsFromOffers2($offers);
self::$productsOffersSkuParams[$params["PRODUCT_ID"]] = $tmpProps[$params["PRODUCT_ID"]];
}
}
if (intval($params["OFFERS_IBLOCK_ID"]) > 0 && !isset(self::$iblockPropsParams[$params["OFFERS_IBLOCK_ID"]])) {
self::$iblockPropsParams[$params["OFFERS_IBLOCK_ID"]] = static::getPropsParams($params["OFFERS_IBLOCK_ID"]);
}
// if(intval($params["IBLOCK_ID"]) > 0 && !isset($iblockPropsParams[$params["IBLOCK_ID"]]))
// $iblockPropsParams[$params["IBLOCK_ID"]] = static::getPropsParams($params["IBLOCK_ID"]);
$params["SKU_PROPS"] = self::$productsOffersSkuParams[$params["PRODUCT_ID"]][$params["OFFER_ID"]];
if (is_array($params["SKU_PROPS"])) {
foreach ($params["SKU_PROPS"] as $id => $skuProps) {
$params["SKU_PROPS"][$id] = array('ID' => $skuProps, 'NAME' => self::$iblockPropsParams[$params["OFFERS_IBLOCK_ID"]][$id]['NAME'], 'VALUE' => self::$iblockPropsParams[$params["OFFERS_IBLOCK_ID"]][$id]['VALUES'][$skuProps], 'CODE' => self::$iblockPropsParams[$params["OFFERS_IBLOCK_ID"]][$id]['CODE'], 'SORT' => self::$iblockPropsParams[$params["OFFERS_IBLOCK_ID"]][$id]['SORT']);
}
}
}
$productsParams["IBLOCKS_SKU_PARAMS"] = self::$iblockPropsParams;
$productsParams["PRODUCTS_OFFERS_SKU"] = self::$productsOffersSkuParams;
return $productsParams;
}