0

Only problem I have : I want to make a link on the product page :/public_html/app/design/frontend/default/default/template/catalog/product/view.phtml

to the Category the products belong. I can get this gixed by

Problem ;

Most of products are in multiple Categories. I have 1 map in the root with the "Brands", so the url = /all_brands/brand

So product_a is in the list of eg : BrandA

But some products are also listed in for example the map Weeoffers (in Root) /weekoffer/

How can I determine the correct ID , If I want only to have the BRAND ID in de the url ?

id_path="all_brands/22" ?

1 Answers1

0

You can obtain current category from registry by invoking Mage::registry('current_category') . By default this will work as you expected only on CATALOG PAGE and PRODUCT PAGE

If you're viewing product, and you want to get category of viewed category you can use Mage::registry('current_category')->getId();.

Of course it will be wise if you ensure that current_category isn't null :)

xyz
  • 2,277
  • 2
  • 25
  • 41