Ask Your Question
4

How can the layout update be utilized to display the newest or most recent products on the homepage of Magento?

asked 2022-02-22 11:00:00 +0000

devzero gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-09-19 20:00:00 +0000

lakamha gravatar image
  1. Go to the backend of Magento and access the CMS page where you want to add the new products.

  2. In the content section, insert the following code:

<referenceContainer name="content">


<block class="Magento\Catalog\Block\Product\NewProduct" name="new_products" template="Magento_Catalog::product/newproduct.phtml">

<arguments>

<argument name="products_count" xsi:type="number">12</argument>

</arguments>

</block>

</referenceContainer>

  1. Save the page.

This will add a new-products block on the homepage that will display the latest 12 products. You can customize the number of products you want to display by changing the value of the "products_count" argument.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-02-22 11:00:00 +0000

Seen: 10 times

Last updated: Sep 19 '22