VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: 2dmaster on June 27, 2018, 10:39:14 AM

Title: vm 3 display child categories on parent category
Post by: 2dmaster on June 27, 2018, 10:39:14 AM
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
    
}
    
?>
Title: Re: vm 3 display child categories on parent category
Post by: Jörgen on June 27, 2018, 13:28:24 PM
Because ther is some error

Jörgen @ Kreativ Fotografi
Title: Re: vm 3 display child categories on parent category
Post by: Jörgen on June 27, 2018, 14:52:22 PM
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

Title: Re: vm 3 display child categories on parent category
Post by: Studio 42 on June 27, 2018, 19:07:02 PM
Os jorgen says, you should print_r the $category, perhaps no children exist ?
Title: Re: vm 3 display child categories on parent category
Post by: Studio 42 on October 30, 2018, 18:18:13 PM
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.
Title: Re: vm 3 display child categories on parent category
Post by: Studio 42 on October 30, 2018, 19:53:58 PM
Have you child categories ?
have you disabled show child categories in the menu setting or Vm config ?
Title: Re: vm 3 display child categories on parent category
Post by: Studio 42 on October 31, 2018, 23:14:28 PM
Sorry, but we are here to help, not to code for you.
Title: Re: vm 3 display child categories on parent category
Post by: Studio 42 on November 01, 2018, 18:35:32 PM
Do a var_dump or vmdebug.
Title: Re: vm 3 display child categories on parent category
Post by: Studio 42 on November 01, 2018, 23:27:46 PM
See original code, you have already a sample how to do in views/category folder