I have a website which is separated into two stores: Mens and Womens. I am trying to list the categories of both stores in the footer template which is shared by both sites.
Ideally I would have:
MENS
- -MensCat1
- -MensCat2
- -MensCat3
- -MensCat4
WOMENS
- -WomensCat1
- -WomensCat2
- -WomensCat3
- -WomensCat4
I can pull the categories of a particular store with the following:
$children = Mage::getModel('catalog/category')->load(306)->getChildrenCategories();
foreach($children as $child){
echo $child->getName() . " " . $child->getUrl() . "<br/>";
}
where 306 is the id of the Mens Root Category.
That will give me
- -MensCat1
- -MensCat2
- -MensCat3
- -MensCat4
The problem is the URLs will be http://{{base_url}}/womens/MensCat1 if I am in the womens store.
Is there a better way to do this so that the URLs are relative to the stores they belong to, or to force the store url to change in the getUrl request?