Answer the question
In order to leave comments, you need to log in
Bitrix not adding product to cart?
Guys, after importing from 1s to Bitrix, the goods stopped being added to the cart. I have already checked everything, and the number of goods, and the currency, and a bunch of other things, but the product is not added, what else can I see?
Answer the question
In order to leave comments, you need to log in
Execute the code in the Bitrix PHP command line (substituting the product id with your own):
//<?php
$productId = -1;
if (!\Bitrix\Main\Loader::includeModule('catalog')) {
throw new \Bitrix\Main\SystemException('Ошибка подключения модуля "catalog"');
}
$addResult = Add2BasketByProductID(
$productId,
1,
[
'LID' => 's1',
],
[]
);
if (!$addResult) {
$strError = '';
/** @global $APPLICATION $ex */
if ($ex = $APPLICATION->GetException()) {
$strError = $ex->GetString();
}
echo sprintf('Ошибка добавления товара %s в корзину: %s', $productId, $strError);
} else {
echo sprintf('Товар %s успешно добавлен в корзину', $productId);
}
I can assume that the goods were not registered in the sales catalog module during import. To check, you can search for these products in the b_catalog_product table. If they are not there, then the goods are not registered in the sales catalog and cannot be added to the basket.
Also check if the infoblock is a trade catalog.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question