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

