Hi my issue is if I go to a product with the full url as in:
mysite.com/mycategory/myproduct
My code pulls back its top level category.
However, if I go to: mysite.com/myproduct
The product displays but with no breadcrumbs and my code to grab the category ID fails.
My code is:
<?php
$category = Mage::registry('current_category');
while ($category->getLevel() != 2) {
$category = Mage::getModel('catalog/category')->load($category->getParentId());
}
$catid = $category->getId();
?>
I am unsure what to do do I need the change my code to work universally or? Ver 1.9.2.2