I have a difficult catalog of type:
Detail type
- Car brand
-- Car model
I can't change structure - it is unloaded from 1C, the Catalogue very big and goods is a lot of, manually I can't appropriate to each goods also parental categories...
I need to specify "Detail type", that is parental category of goods in a card of goods how to make it?
Help me, please.
solution here http://joomlaforum.ru/index.php/topic,315914.msg1572350.html#msg1572350 (http://joomlaforum.ru/index.php/topic,315914.msg1572350.html#msg1572350)
<?php
$cat = VmModel::getModel('category');
$parent = $cat->getParentCategory((int)$this->product->virtuemart_category_id);
if( $parent->virtuemart_category_id ){
$grandparent = $cat->getParentCategory((int)$parent->virtuemart_category_id);
if( $grandparent->category_name ){
echo $grandparent->category_name;
}else{
echo $parent->category_name;}
} else {
echo $product->category_name;}
?>