$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) {
$basketPropertyCollection = $basketItem->getPropertyCollection();
print_r($basketPropertyCollection->getPropertyValues());
}
}
}
class Basket {
protected $siteId;
protected $fUserId;
protected $basket;
protected $basketItems;
public function __construct($siteId = 's1', $fUserId = 0) {
$this->siteId = $siteId;
$this->setFUserId($fUserId);
$this->setBasket();
$this->setBasketItems();
}
protected function setFUserId($fUserId) {
$this->fUserId = $fUserId ? $fUserId : \Bitrix\Sale\FUser::getId();
}
protected function setBasket() {
$this->basket = \Bitrix\Sale\Basket::loadItemsForFUser($this->fUserId, $this->siteId);
}
protected function getBasket() {
return $this->basket;
}
protected function setBasketItems() {
$this->basketItems = $this->basket->getBasketItems();
}
public function isProductInBasket(int $productId) {
$basketItem = $this->getBasketItemByProductId($productId);
return $basketItem ? true : false;
}
public function getBasketItemByProductId(int $productId) {
$basketItem = null;
if($this->basketItems) {
foreach($this->basketItems as $item) {
if($item->getField('PRODUCT_ID') == $productId) {
$basketItem = $item;
break;
}
}
}
return $basketItem;
}
}
$siteId = 's1';
$fUserId = \Bitrix\Sale\FUser::getId();
$productId = 139;
$basket = new \Basket($siteId, $fUserId);
$basketItem = $basket->getBasketItemByProductId($productId);
$bProductInBasket = $basket->isProductInBasket($productId);
\Bitrix\Main\Loader::includeModule('iblock');
\Bitrix\Main\Loader::includeModule('catalog');
$iblocksId = [2, 3];
$iterator = \Bitrix\Iblock\ElementTable::getList([
'select' => ['IBLOCK_ID', 'ID'],
'filter' => ['IBLOCK_ID' => $iblocksId, '!PRODUCT.CAN_BUY_ZERO' => 'D', '!PRODUCT.TYPE' => \Bitrix\Catalog\ProductTable::TYPE_SKU],
'runtime' => [
'PRODUCT' => [
'data_type' => '\Bitrix\Catalog\ProductTable',
'reference' => ['=this.ID' => 'ref.ID']
]
]
]);
$elements = [];
while($row = $iterator->fetch()) {
$elements[] = $row;
}
foreach($elements as $element) {
CCatalogProduct::Update($element['ID'], ['CAN_BUY_ZERO' => 'D']);
}
echo 'Количество = '.count($elements);
$prefilterCustom = array(
"=ID" => $arElements,
);
echo '<pre>';
print_r($arFields);
echo '</pre>';
die();
Из модуля каталог
То есть пока напиши у себя
Дальше пока не вникал в твою писанину