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
- category_a (only products)
- category_b (both products and cms)
- category_c (only cms block).
Things I tried which don't work:
- Disabled custom theme and used default theme of magento.
- Replaced view.phtml from another magento installation (where its working fine).
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)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)
I can see that there are 2 problems here, or atleast I think so.
- category display mode is always coming as "products only"
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.