How can I get the block containing all the products using getLayout()->getBlock()? (or with another method, as long as I get the block).

And also - is there a list with all the options I can provide to getBlock()? or can I somehow find it from the XML files in a reasonable way?

I didn't find any decent docs for this function.

  • use getLayout()->getBlock('nameOfBlockInLayout') Commented Oct 15, 2015 at 12:11

1 Answer 1


Every block that is defined in the layout XML files has a name which must be unique for a single request. For example, in catalog.xml, within the catalog_category_layered (Anchor category page) and catalog_category_default (Category page) handles:

<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">

Use this name as parameter for getBlock().

Note that it's possible to have anonymous blocks without a name (technically they have a name but you cannot predict it), these are created dynamically from the code, with createBlock() and there is no generic way to retrieve them.

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.