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

