0

I would like to display a CMS Static Block text box at the bottom of all product listings in Magento, but I would need the code to put in CMS -> Static Blocks in the admin panel in order to do so.

Any help would be appreciated, thank you.

0

You need a custom theme or a module to do this. In the case of a theme, create the following file:

/app/design/frontend/[Company]/[ThemeName]/Magento_Catalog/layout/catalog_category_view.xml

WIth the following content:

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2013-2017 Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-left" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
  <body>
    <referenceContainer name="content">
      <block class="Magento\Cms\Block\Block" name="yourblockname">
        <arguments>
          <argument name="block_id" xsi:type="string">id_defined_in_block_admin</argument>
        </arguments>
      </block>
    </referenceContainer>
  </body>
</page>

Your block will then appear at the bottom of all product listing (category) pages.

0

you can add code in your list.phtml from your theme(template\catalog\product).

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_identifier')->toHtml(); 
?>
  • Sorry about that, I forgot to mention this, but I am using Magento 1.9, not Magento 2.2. I am unfortunately not authorized to upgrade the Magento version from the Magento store of where I am asking this question... :( – Shahrooz May 16 '18 at 14:37
  • answer updated. – Yogesh May 16 '18 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.