magento 2 how to create static block that contains categories need to display in home page

magento.stackexchange https://magento.stackexchange.com/questions/247483

  •  05-02-2021
  •  | 
  •  

Frage

I want to create an static block that contains categories and their products need to display in home page in magento2

War es hilfreich?

Lösung

In your static block you need to pass data like this.

{{block class="Magento\Framework\View\Element\Template" name="myblock" template="Vendor_Extension::test.phtml" mycats="1,2,3"}}

And now you can access this variable into your phtml file like this.

$myCat = $block->getData('mycats');

Or

$myCat = $block->getMycats();

Now phtml file, you can do what you like.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top