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
  •  | 
  •  

Pergunta

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

Foi útil?

Solução

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.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a magento.stackexchange
scroll top