method
public
BasketItemCollection::getItemById()
Сигнатура
public getItemById(mixed $id) : BasketItemBase|null
Параметры
$id
mixed
Возвращаемое значение
BasketItemBase|null
Как применяется в BasketItemCollection
BasketItemCollection::getItemById() — метод класса \Bitrix\Sale\BasketItemCollection модуля «Интернет-магазин».
Метод объекта: сначала нужен экземпляр BasketItemCollection.
use Bitrix\Main\Loader;
use Bitrix\Sale\BasketItemCollection;
Loader::includeModule('sale');
/** @var BasketItemCollection $object */
$id = null;
$result = $object->getItemById($id);
// $result: BasketItemBase|nullДругие методы BasketItemCollection
clearCollection()clearStartField()count()Подсчитывает количество элементов объекта.createItem()current()Возвращает текущий элемент.doFinalAction()getBasket()getBasketItems()getContext()getExistsItem()getExistsItems()Получает все элементы корзины для нужных moduleId, productId и свойств.getIndexById()
getItemById() есть и у других классов модуля «Интернет-магазин»: Basket, BasketBase, BasketPropertiesCollection, BasketPropertiesCollectionBase, EntityCollection, ShipmentCollection, ShipmentItemCollection, ShipmentItemStoreCollection.
Исходный файл: source/sale/lib/basketitemcollection.php:147

