S
S
Superhero_a2019-06-18 18:41:38
1C-Bitrix
Superhero_a, 2019-06-18 18:41:38

How to display a list of pending products for an unregistered user?

Good afternoon! I display the number of selected products by the code from this link https://camouf.ru/blog-note/6076/
Faced a problem with displaying the list of favorite products by this code.
I withdraw through

// Выведем актуальную корзину для текущего пользователя

$arBasketItems = array();

$dbBasketItems = CSaleBasket::GetList(
    array(
            "NAME" => "ASC",
            "ID" => "ASC"
        ),
    array(
            "FUSER_ID" => CSaleBasket::GetBasketUserID(),
            "LID" => s1,
            "ORDER_ID" => "NULL",
            "DELAY" => "Y"
        ),
    false,
    false,
    array("ID",
          "CALLBACK_FUNC", 
          "MODULE", 
          "PRODUCT_ID", 
          "QUANTITY", 
          "DELAY", 
          "CAN_BUY", 
          "PRICE", 
          "WEIGHT")
    );

while ($arItems = $dbBasketItems->Fetch())
{
    if (strlen($arItems["CALLBACK_FUNC"]) > 0)
    {
        CSaleBasket::UpdatePrice($arItems["ID"],
                                 $arItems["CODE"], 
                                 $arItems["CALLBACK_FUNC"], 
                                 $arItems["MODULE"], 
                                 $arItems["PRODUCT_ID"], 
                                 $arItems["QUANTITY"]);
        $arItems = CSaleBasket::GetByID($arItems["ID"]);
    }

    $arBasketItems[] = $arItems[PRODUCT_ID];
}


?>








<?$APPLICATION->IncludeComponent(
  "bitrix:catalog.section", 
  "gopro", 
  array(
    "IBLOCK_TYPE" => "catalog",
    "IBLOCK_ID" => "20",
               "ELEMENT_ID" =>  $arBasketItems,
    "SECTION_ID" => "",
    "SECTION_CODE" => "",
// остальные настройки компонента
    
  ),
  false
);?>

Items are initially displayed without problems, but when an unregistered user continues to add products to favorites, the newly added items are not displayed on the favorites list page. How can this problem be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Roman Gritsuk, 2019-06-19
@winer

Are you sure you are adding to favorites for an unauthorized user? See response for ajax request. If you followed the instructions completely, then this is the /local/ajax/wishlist.php file.
You can do so.

<? 
if (CSaleBasket::Add($arFields)){
//...
} else {
    global $APPLICATION;
    echo $APPLICATION->LAST_ERROR;
}

This will not solve the problem, but it may help to find its cause.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question