I like to do a cms page with all brands (subcategories) on it. We have a multistore wise set up. But at the moment, it shows me only subcategories and categories from one storeview.
I have this just copied and change the
->load(195); ->setStoreId(2)
But it seems that I need to do something else, as it shows me only from one store the list. See here:
https://www.outdoorequipped.com/allbrands/
Here is the code I use:
<div class="main row">
<div class="col-main col-xs-12">
<div class="row">
<?php
$parentCategory = Mage::getModel('catalog/category')->load(195);
$subcategoryCollection = Mage::getModel('catalog/category')
->getCollection()
->setStoreId(2)
->addFieldToFilter('level', ['lteq' => $parentCategory->getLevel() + 2])
/*->addFieldToFilter('level', $parentCategory->getLevel() + 1)*/
->addFieldToFilter('path', ['like' => $parentCategory->getData('path') . '%'])
->addAttributeToFilter('entity_id', array('neq' => '195'))
->addAttributeToFilter('entity_id', array('neq' => '136'))
->addAttributeToSelect(['name'])
->setOrder('name', Varien_Data_Collection_Db::SORT_ORDER_ASC);
?>
<?php $previous = null;?>
<?php foreach ($subcategoryCollection as $category): ?>
<?php $name = $category->getName();
$firstLetter = substr($name, 0, 1);
if($previous == null){
echo '<div class="col-sm-12">'."\n";
echo '<h4 style="margin-top:5px; margin-bottom:2px;">'.$firstLetter.'</h4>'."\n";
$previous = $firstLetter;
}
elseif ($previous !== $firstLetter){
echo '</div>'."\n";
echo '<div class="col-sm-12">'."\n";
echo '<h4 style="margin-top:5px; margin-bottom:2px;">'.$firstLetter.'</h4>'."\n";
$previous = $firstLetter;
}
echo '<a href="'.$category->getUrl().'" style="margin:10px">'.$category->getName().'</a>'."\n";
?>
<?php endforeach; ?>
</div>
</div>
</div>
</div>
It not gives what I like to have. Here is the link from this page:
[link]https://www.outdoorequipped.com/allbrands/
I like to show on this CMS page from all storeviews (4 of them) all categories under a specific given category id.
so should be something similar to this:
ACTIVE / OUTDOOR / WORK
Cat 1 / Cat 11 / Cat 21
Cat 2 / Cat 12 / Cat 22
Cat 3 / Cat 13 / Cat 23
As Active, Outdoor and Work are the storeviews.