Skip to content

Instantly share code, notes, and snippets.

@d1i1m1o1n
Last active April 2, 2016 13:41
Show Gist options
  • Save d1i1m1o1n/1baefa5edf57e4c1e1cf to your computer and use it in GitHub Desktop.
Save d1i1m1o1n/1baefa5edf57e4c1e1cf to your computer and use it in GitHub Desktop.
Bitrix add product to last viewed
//добавление товара в просмотренные
CModule::IncludeModule("sale");
use \Bitrix\Catalog\CatalogViewedProductTable as CatalogViewedProductTable;
$user_id = CSaleBasket::GetBasketUserID();
if($user_id > 0) {
$product_id = $arResult['ID'];
CatalogViewedProductTable::refresh($product_id, $user_id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment