I
I
Ilia Malashko2021-01-30 16:27:38
1C-Bitrix
Ilia Malashko, 2021-01-30 16:27:38

How to get a list of products added to comparison (catalog.compare.* component)?

Hello.

It is necessary to highlight the buttons in the main catalog for those products that are added to the basket, to favorites or comparison.

I figured out the basket and favorites, in component_epilog.php using CSaleBasket::GetList() I got the id of the goods and changed the button styles through js. It would not be bad to get a similar method and comparison, but I managed to google getting a list of products only through the catalog.compare.list component.

Is there an analogue of CSaleBasket::GetList() for catalog.compare? Or can you tell me another way to pull out goods from this list?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Emelyanov, 2021-01-30
@miv-men

They are simply stored in the session
$SESSION["name of the list of compared elements"]["Information block ID"]["ITEMS"]["Element ID"]

$_SESSION[COMPARE_NAME][IBLOCK_ID]['ITEMS'][ELEMENT_ID
]

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question