Author Topic: vm 3 display child categories on parent category  (Read 2034 times)

2dmaster

  • Jr. Member
  • **
  • Posts: 97
vm 3 display child categories on parent category
« on: June 27, 2018, 10:39:14 am »
why this code not work ?? vm 3  categories/default.php

Code: [Select]
<?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

  • Global Moderator
  • Full Member
  • *
  • Posts: 2473
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: vm 3 display child categories on parent category
« Reply #1 on: June 27, 2018, 13:28:24 pm »
Because ther is some error

Jörgen @ Kreativ Fotografi
Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2473
    • Kreativ Fotografi
  • VirtueMart Version: 3.4.x
Re: vm 3 display child categories on parent category
« Reply #2 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

Joomla 3.9.8
Virtuemart 3.4.x
Olympiantheme Hera (customized)

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: vm 3 display child categories on parent category
« Reply #3 on: June 27, 2018, 19:07:02 pm »
Os jorgen says, you should print_r the $category, perhaps no children exist ?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: vm 3 display child categories on parent category
« Reply #4 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.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: vm 3 display child categories on parent category
« Reply #5 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 ?

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: vm 3 display child categories on parent category
« Reply #6 on: October 31, 2018, 23:14:28 pm »
Sorry, but we are here to help, not to code for you.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: vm 3 display child categories on parent category
« Reply #7 on: November 01, 2018, 18:35:32 pm »
Do a var_dump or vmdebug.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4072
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: vm 3 display child categories on parent category
« Reply #8 on: November 01, 2018, 23:27:46 pm »
See original code, you have already a sample how to do in views/category folder