recently viewed product collection is empty in magento 2
-
03-03-2021 - |
سؤال
I have added a code in Magento_Catalog/layout/catalog_product_view.xml
<referenceBlock name="product.info.details">
<block class="Magento\Reports\Block\Product\Widget\Viewed" name="recently_viewed" template="Magento_Reports::widget/viewed/content/viewed_grid.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Recently Viewed</argument>
<argument name="sort_order" xsi:type="string">50</argument>
</arguments>
<action method="setPageSize">
<argument name="page_size" xsi:type="number">4</argument>
</action>
</block>
</referenceBlock>
The above code showing only the recently viewed tab, but products are not showing.
Here i am attaching the screenshot,
Please anyone look into it and update me. Thanks
المحلول
Try This :-
<block class="Magento\Catalog\Block\Widget\RecentlyViewed" name="recently_viewed" template="Magento_Catalog::product/widget/viewed/grid.phtml" after="-">
<arguments>
<argument name="uiComponent" xsi:type="string">widget_recently_viewed</argument>
<argument name="page_size" xsi:type="number">4</argument>
<argument name="show_attributes" xsi:type="string">name,image,price,learn_more</argument>
<argument name="show_buttons" xsi:type="string">add_to_cart,add_to_compare,add_to_wishlist</argument>
</arguments>
</block>
لا تنتمي إلى magento.stackexchange