magento2: I cannot move the block
Preconditions
Magento 2.4-develop Php v. 7.2
Steps to reproduce
- Open catalog module -> catalog_category_view.xml
- Try to move a toolbar outside the block.
<referenceContainer name="content.top">
<container name="product_list_toolbar_container" htmlTag="div"/>
</referenceContainer>
<move element="product_list_toolbar" destination="product_list_toolbar_container"/>
(product_list_toolbar_container - my container).
Actual result
Fatal error: Uncaught Error: Call to a member function getSize() on null in \vendor\magento\module-catalog\view\frontend\templates\product\list\toolbar.phtml:26 Stack trace: ...
I think I know why the error occurs. The block cannot be found when he outside.
- https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Block/Product/ListProduct.php#L215
- https://github.com/magento/magento2/blob/develop/app/code/Magento/Catalog/Block/Product/ListProduct.php#L196

Expected Result
The block successfully moved
Additional information
This is a problem of the system architecture. How I can solve it?
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 9
- Comments: 32 (11 by maintainers)
@mbernabeu Working on the issue.
bad design
I have a custom layout, why do I need.
Also I cannot remove the block. How can I hide it?
Is there any news about these issues? I have the same problem