0

I'm just making my own Magento website and I was wondering if it is possible to display a specific category? I have two categories and I would like to display them separately.

I'm using this CMS code:

<p>{{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="4"}}</p>
<div class="page-title">
<h2>Alle producten</h2>
</div>
<p>{{block type="catalog/navigation" name="catalog.category" template="catalog/category/merken.phtml"}}</p>

<p>{{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="4"}}</p>
<div class="page-title">
<h2>Alle producten</h2>
</div>
<p>{{block type="catalog/navigation" name="catalog.category" template="catalog/category/merken.phtml"}}</p>

and the merken.phtml contains the following information:

<?php
    $class_check=1;
?>
<?php foreach ($this->getStoreCategories() as $_category): ?>

<?php $open = $this->isCategoryActive($_category); ?>
<?php

$cur_category=Mage::getModel('catalog/category')->load($_category->getId());
$layer = Mage::getSingleton('catalog/layer');
$layer->setCurrentCategory($cur_category);
if ($immagine = $this->getCurrentCategory()->getImageUrl()):
?>
<div class="col-md-2 col-sm-4 col-xs-3 merken-holder <?php if($class_check == 1){echo 'class_first';}?>">
<a href="<?php echo $this->getCategoryUrl($_category); ?>" class="link-img">
<!-- <h1><?php echo $this->htmlEscape($this->getCurrentCategory()->getName()); ?></h1> -->
<img  src="<?php echo $immagine; ?>" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()); ?>" class="merk-image"/>
</a>
</div>



<?php else: ?>
<div class="col-md-2 col-sm-4 col-xs-3 merken-holder <?php if($class_check == 1){echo 'class_first';}?>">
<a href="<?php echo $this->getCategoryUrl($_category); ?>" class="link-img">
<h1><?php echo $this->htmlEscape($this->getCurrentCategory()->getName()); ?></h1>
<!-- <img  src="<?php echo $immagine; ?>" alt="<?php echo $this->htmlEscape($this->getCurrentCategory()->getName()); ?>" class="merk-image"/> -->
</a>
</div>
<?php 
endif;
$class_check++;
endforeach; ?>

I have 2 of dose codes and also 2 cat ID's

Can anyone help me?

1
  • Do you want to show all categories on home page ? – Pawan Jul 23 '18 at 3:33
0

Replace your code

<p>{{block type="catalog/navigation" name="catalog.category" template="catalog/category/merken.phtml"}}</p>

To

<p>{{block type="catalog/navigation" name="catalog.category" template="catalog/category/merken.phtml" ids="4,3,5"}}</p>

I hope it will work for you

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.