How to move static block in magento 2.1.8 at the bottom of product list in Category

▼魔方 西西 提交于 2019-12-24 06:45:27

问题


I am using MAgento 2.1.8 but i am stuck in moving static block to bottom of product list of a category page as i want to write the content Before and after to products.


回答1:


If you have child theme then override the catalog_category_view.xml. To override the xml file follow the below steps.

  1. Copy the file from path vendor/magento/mdoule-catalog/view/frontend/layout/catalog_category_view.xml
  2. paste it into the path app/design/frontend/vendor/theme/Magento_Catalog/layout/catalog_category_view.xml
  3. add the code below body tag

    <move element="category.cms" destination ="content" after="category.product"/>
    
  4. If you do not have child theme. Then you will have to create child from the given link below and repeat step from 1 to 3 http://devdocs.magento.com/guides/v2.2/frontend-dev-guide/themes/theme-create.html




回答2:


Go to product view phtml file and call your static block where you want to call

<?php echo $block->getLayout()->createBlock(‘Magento\Cms\Block\Block’)->setBlockId(‘block_identifier’)->toHtml();?>


来源:https://stackoverflow.com/questions/47699524/how-to-move-static-block-in-magento-2-1-8-at-the-bottom-of-product-list-in-categ

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!