News:

Support the VirtueMart project and become a member

Main Menu

vm 3 display child categories on parent category

Started by 2dmaster, June 27, 2018, 10:39:14 AM

Previous topic - Next topic

2dmaster

why this code not work ?? vm 3  categories/default.php

<?php
    
foreach ($category->childs as $child) {
    
$caturl JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$child->virtuemart_category_id);
    
$cattext vmText::_($child->category_name);
    
?>

<a href="<?php echo $caturl ?>" title="<?php echo $child->category_name ?>"><?php echo $child->category_name ?></a>
<br />
    <?php
    
}
    
?>

Jörgen

Because ther is some error

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Jörgen

There should be code to look at and understand, I will not write your code for You. Maybe some one else will work for free for You.

Look at the category module and You should find some examples. Just saying this don´t work, taken out of context does not help much.

using print_r( ... ) helps to see what there is to use.

Jörgen @ Kreativ Fotografi

Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

Os jorgen says, you should print_r the $category, perhaps no children exist ?

Studio 42

Why you dont hire someone ?
And you say categories/default.php and after explain code from a Joomla module.
If you dont explain what you want we loose more time (and you) for simple things.

Studio 42

Have you child categories ?
have you disabled show child categories in the menu setting or Vm config ?

Studio 42

Sorry, but we are here to help, not to code for you.

Studio 42


Studio 42

See original code, you have already a sample how to do in views/category folder