bitrix:catalog.viewed.products not working
The last notes
All English-language materials have been translated fully automatically using the Google service
In all the latest Bitrix templates, data about viewed products is transmitted using javascript. If your template does not have such a transfer, then it is easy to implement it yourself. It is enough to add the following code in template.php or script.js of your catalog.element component
<script type="text/javascript">
var viewedCounter = {
path: '/bitrix/components/bitrix/catalog.element/ajax.php',
params: {
AJAX: 'Y',
SITE_ID: "<?= SITE_ID ?>",
PRODUCT_ID: "<?= $arResult['ID'] ?>",
PARENT_ID: "<?= $arResult['ID'] ?>"
}
};
BX.ready(
BX.defer(function(){
BX.ajax.post(
viewedCounter.path,
viewedCounter.params
);
})
);
</script>
In the bitrix:catalog.viewed.products settings, make sure that the following parameter is set
"SHOW_PRODUCTS_".$arParams['IBLOCK_ID'] => "Y",
Based on material:
Comments