1С-Битрикс
209
Вклад в тег
$obItem = $obBasket->getExistsItem('catalog', $productId, [
0 => ['CODE' => 'PROP1', 'VALUE' => 'electron'],
//......
]);
$obItem = $obBasket->getExistsItem('catalog', $productId, [
0 => ['CODE' => 'ARTNUMBER', 'VALUE' => '235-81-03'],
1 => ['CODE' => 'COLOR_REF', 'VALUE' => 'Черный'],
2 => ['CODE' => 'SIZES_CLOTHES', 'VALUE' => 'XS'],
3 => ['CODE' => 'CATALOG.XML_ID', 'VALUE' => 'clothes_offers_s1'],
4 => ['CODE' => 'PRODUCT.XML_ID', 'VALUE' => '332#337'],
]);
\Bitrix\Main\Loader::includeModule('sale');
$siteId = 's1';
$fUserId = \Bitrix\Sale\FUser::getId();
$productId = 139;
$productByBasketItem = null;
$bProductInBasket = false;
$basket = \Bitrix\Sale\Basket::loadItemsForFUser($fUserId, $siteId);
$basketItems = $basket->getBasketItems();
if($basketItems) {
foreach($basketItems as $basketItem) {
if($basketItem->getField('PRODUCT_ID') == $productId) {
$productByBasketItem = $basketItem;
$bProductInBasket = true;
break;
}
}
}
var_dump($bProductInBasket);
var_dump($productByBasketItem);
$prefilterCustom = array(
"ID" => $arElements,
);
$eventManager = \Bitrix\Main\EventManager::getInstance();
$eventManager->registerEventHandler('sale', 'OnSaleOrderSaved', $this->MODULE_ID, '\\Yolo\\Bonus\\EventHandler', 'myFunction');
if($arResult['ITEMS']) {
$arResult['FILE_TYPES'] = $filmTypes = [];
foreach($arResult['ITEMS'] as $key => $arItem) {
$filmTypesProp = isset($arItem['DISPLAY_PROPERTIES']['FILM_TYPES']) ? $arItem['DISPLAY_PROPERTIES']['FILM_TYPES'] : false;
$value = $filmTypesProp && $filmTypesProp['VALUE'] ? $filmTypesProp['VALUE'] : false;
$displayValue = $filmTypesProp && $filmTypesProp['DISPLAY_VALUE'] ? $filmTypesProp['DISPLAY_VALUE'] : false;
if($value && $displayValue) {
$filmTypes['VALUE'][] = $value;
$filmTypes['DISPLAY_VALUE'][] = $displayValue;
}
}
$arResult['FILE_TYPES'] = [
'VALUE' => array_values(array_unique($filmTypes['VALUE'])),
'DISPLAY_VALUE' => array_values(array_unique($filmTypes['DISPLAY_VALUE'])),
];
}
<?if(isset($arResult['FILE_TYPES']) && $arResult['FILE_TYPES']):?>
<select class="drop" id="regionDropdown">
<option value="All">Показать все</option>
<?foreach($arResult['FILE_TYPES']['DISPLAY_VALUE'] as $value):?>
<option value="<?=$value;?>"><?=$value;?></option>
<?endforeach;?>
</select>
<?endif;?>