bitrix:catalog.viewed.products not working
The last notes
Website hosting
If you are choosing hosting for your project, I recommend Timeweb. Modern infrastructure, a wide range of plans from starter options to high-load VPS, and responsive tech support that actually helps instead of sending template replies. I host some of my own projects there and recommend it to my clients.
Go to site Affiliate link. The price remains the same for you.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