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

سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى magento.stackexchange
scroll top