News:

Support the VirtueMart project and become a member

Main Menu

Conclusion in a goods card the name of parental category

Started by nastjushka, July 17, 2015, 11:22:10 AM

Previous topic - Next topic

nastjushka

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.

nastjushka

solution here  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;}
?>