I'm trying to get the Category URL in my Home page, I'm working in the file app/design/fronted/[package]/[theme]/template/catalog/product/widget/new/content/new_grid.phtml
I've got this code above the product title
<?php
/**
* get categories from a product
*/
$categoryIds = $this->helper('catalog/output')->productAttribute($_product, $_product->getCategoryIds());
/**
* looping through the array of category ids
*/
foreach($categoryIds as $categoryId) {
$category = Mage::getModel('catalog/category')->load($categoryId);
if($category->parent_id == 4):
?>
<h6 class="author"><a href="<?php echo $category->getUrlKey() ?>">De <?php echo $category->getName() ?></a></h6>
<?php
endif;
}
?>
Some times I use "getUrl" instead of "getUrlKey", and both give me a "404" page. I believe the error is in some Magento configuration, not in the code.
Some one have an answer to any approach?
Thanks in advence!