1
votes

I am unable to make magento display static CMS block under category > display settings.

Contents of app/design/frontend/base/default/template/catalog/category/view.phtml seem to be correct as per similar question on SE. Here you go:

<?php if($this->isContentMode()): ?>
    <?php echo $this->getCmsBlockHtml() ?>

<?php elseif($this->isMixedMode()): ?>
    <?php echo $this->getCmsBlockHtml() ?>
    <?php echo $this->getProductListHtml() ?>

<?php else: ?>
    <?php echo $this->getProductListHtml() ?>
<?php endif; ?>

I have configured 3 categories, lets say

  1. category_a (only products)
  2. category_b (both products and cms)
  3. category_c (only cms block).

Things I tried which don't work:

  1. Disabled custom theme and used default theme of magento.
  2. Replaced view.phtml from another magento installation (where its working fine).
  3. Replace the if-else block with

    <?php if($this->isContentMode()): ?>
    MODE: CMS
        <?php echo $this->getCmsBlockHtml() ?>
    
    <?php elseif($this->isMixedMode()): ?>
    MODE: MIXED
        <?php echo $this->getCmsBlockHtml() ?>
        <?php echo $this->getProductListHtml() ?>
    
    <?php else: ?>
    MODE: PRODUCTS
        <?php echo $this->getProductListHtml() ?>
    <?php endif; ?>
    

    This displayed MODE: PRODUCTS for all 3 cases (product / cms / mixed)

  4. Removing the if-else block and using only lines to force magento to display both cms and product blocks. Assuming the control was not flowing to correct block.

    <?php echo $this->getCmsBlockHtml() ?>  
    <?php echo $this->getProductListHtml() ?> 
    

    Only product block got displayed for all 3 categories mentioned above (product / cms / mixed)

  5. I can see that there are 2 problems here, or atleast I think so.

    1. category display mode is always coming as "products only"
    2. getCmsBlockHtml() does not return anything

so I tried following code snippet based on Mage_Catalog_Block_Category_View

Product: 
<?php echo $this->getCurrentCategory()->getDisplayMode()==Mage_Catalog_Model_Category::DM_PRODUCT; ?>
MIXED: 
<?php echo $this->getCurrentCategory()->getDisplayMode()==Mage_Catalog_Model_Category::DM_MIXED; ?>
CMS: 
<?php echo $this->getCurrentCategory()->getDisplayMode()==Mage_Catalog_Model_Category::DM_PAGE; ?>

and got response as >>Product: MIXED:1 CMS: for all three category display modes (product / cms / mixed).

Can someone help me out please. I have disabled caches and have tried reindexing also.

1

1 Answers

0
votes

I found a fix for my issue here Magento 1.9.2.0

App/Code/Core/Mage/Catalog/Block/Category/View.php inside function getCmsBlockHtml

On Line 109 it read return

but should read return $this->getData('cms_block_html');

Regards paul