Hello everyone. I would like to know if the product page could be modified so that it always shows the same related products. I have 5 products that I want to always be shown as related products on the page of any other product on the page.
I have a catalog with more than 20,000 references and every day is updated with more products, so I am not interested in manually assigning these related products.
I work with Magento 2.2.3
Thanks
Javier
Solved! Go to Solution.
Hello @javier_rey
Add this code to any static block and call that block in to
app/design/frontend/{Packagename}/{themename}/Magento_Catalog/layout/catalog_product_view.xml
Hello @javier_rey
If you are looking for Magento native feature then Magento not includes. If you want to show new products as a related products you have to customized or you can check with any third party plugin.
If you are looking to customize then you can just show products based on created date of products.
Hi. Thanks for your response. I think the best way to do what I need would be to show, on the product page, a block that I have previously created and in which the products of a category are shown. Now I just need to know the code I have to enter to show this block.
Hi @javier_rey
I think best solution for this is:
"Write a script that will fetch 5 products from the same category and near by prices."
Hello @javier_rey
Try below code:
{{block type="catalog/product_list" column_count="5" category_id="4" template="catalog/product/list.phtml"}} |
Where the column_count value is the number of products. Navigate to System->Permissions->Blocks. Click on the Add new block. Specify your Block Name, which is: catalog/product_list. And allow the Block using the YES/No Dropdownlist
or follow this:
https://blog.landofcoder.com/display-products-of-specific-category-on-home-page/
@javier_reyHey,
Not sure how technical or comfortable you are in Magento coding. I would recommend to get a extension like below and configure it they way you want.
https://ecommerce.aheadworks.com/magento-2-extensions/automatic-related-products
It may look little expensive but takes care of a lot of time and money. You can keep your dynamic products dynamic/static or in whatever way you want. No limits on rules or configuration.
Finally I could do it, but in a slightly weird way. Where should I put this code?:
{{block type="catalog/product_list" column_count="5" category_id="4" template="catalog/product/list.phtml"}}
Hello @javier_rey
Add this code to any static block and call that block in to
app/design/frontend/{Packagename}/{themename}/Magento_Catalog/layout/catalog_product_view.xml
Thank you very much.