My product pages are displaying a category graphical subheader, determined by the category.
<img src="<?php echo $_imageUrl ?>" width="470" />
<block type="catalog/category_view" name="catalog.category.subhdr" template="catalog/category/subhdr.phtml" />
this works perfectly when the product page is displayed the traditional method
however, when the product is navigated to via the search result / recently viewed products / send to friend link - basically any link that generates the URL rewrite OMITTING the category from the URL, i get errors. e.g.
“Fatal error: Call to a member function getMetaTitle() on a non-object”
If i change the block type to “catalog/navigation” the page will load, but still cannot access the category id, and fails with this message:
“Fatal error: Call to a member function getImageUrl() on a non-object”
Basically - how can i set / retreive the category ID when i’m in a product page that does not have the category in the url?
(i dont mind defining the first category if the product has been assigned to multiple cats - i just need one for the header)
thanks for any help, i’ve been at this for hours and just cant nail it