M
M
m4rty2018-08-22 13:17:00
1C-Bitrix
m4rty, 2018-08-22 13:17:00

How to take the number of products viewed by the user?

It is necessary to take the number (number) of viewed goods, I can’t figure out where to get it or calculate it. The catalog.products.viewed component is included. The page itself works, it is necessary to have a number of viewed goods on any page of the site.
As a result, the answer, as always, is in the comments, thanks to @s_panteleev

Still, it’s better not to make a selection with a direct query) but yes, from this table
\Bitrix\Catalog\CatalogViewedProductTable::getList(['filter' => ['FUSER_ID' => \Bitrix\Sale\Fuser::getId()]])->getSelectedRowsCount();

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Irina, 2018-08-22
@m4rty

DB query, table b_catalog_viewed_product
global $DB;
$results = $DB->Query("select count(PRODUCT_ID) as count from b_catalog_viewed_product where DATE_VISIT>'".date('Ymd 00:00:00')."' and FUSER_ID = '".$_REQUEST['id ']."'");

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question