1

How to call new.phtml file in the home page admin Magento 2.2.6 version?

Please check my screenshot link here http://prntscr.com/lapiu7.

And also check my theme default.xml code.

<referenceBlock name="category.products.list"   >
    <action method="setTemplate">
        <argument name="template" xsi:type="string">Magento_Catalog::product/new.phtml</argument>
    </action>

Then after that, I put the code in my cms home page admin.

{{block class="Magento\Framework\View\Element\Template" name="new_file" template="Magento_Catalog::product/new.phtml"}}

http://prntscr.com/lapk4g

But it's not working.

Please let me know how to implement custom product slider in Magento 2.2.6

http://prntscr.com/lazzuu

10
  • your code is working..i have checked it. try to put die("hello") in your new.phtml file Commented Oct 27, 2018 at 3:58
  • ok let me check again
    – neha rani
    Commented Oct 27, 2018 at 4:02
  • check this link for custom product slider Commented Oct 27, 2018 at 4:04
  • yes" hello" print
    – neha rani
    Commented Oct 27, 2018 at 4:15
  • please check i make same slider like this "prntscr.com/lb04wn" please check screenshort.
    – neha rani
    Commented Oct 27, 2018 at 4:21

1 Answer 1

0

If you want to show New Product with default phtml, You can call below code to home page.

{{widget type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="new_products" show_pager="0" products_count="10" template="product/widget/new/content/new_list.phtml"}}

Above code will show new products. If you want to change design, you need to copy above phtml to your custom theme with following path.

app/design/frontend/Cloudways/m2-theme/Magento_Catalog/templates/product/widget/new/content/new_list.phtml

Please make sure there are new product available in admin with applicable date

IF found suitable accept and Up-vote as a token of appreciation

3
  • its working but how we can overwrite this file. after that "prntscr.com/lb0uis" please check all catelog files paste in our custom theme.
    – neha rani
    Commented Oct 27, 2018 at 6:40
  • You can copy file at : app/design/frontend/Cloudways/m2-theme/Magento_Catalog/templates/product/widget/new/content/new_list.phtml
    – Pawan
    Commented Oct 27, 2018 at 7:36
  • great, welcome :)
    – Pawan
    Commented Oct 27, 2018 at 10:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.