Author Topic: module VM - Category only shows 2nodes not the 3de one.  (Read 16354 times)

janis

  • Beginner
  • *
  • Posts: 41
module VM - Category only shows 2nodes not the 3de one.
« on: January 22, 2012, 17:36:50 pm »
hi

why i only see 2node's?



Uploaded with ImageShack.us
Files:  http://dev.virtuemart.net/projects/virtuemart/files

Updates:
https://github.com/VirtueMart/virtuemart/commits/master


love virtuemart when it's 10000% stable like in version 4.5 in the year 2015

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10412
  • VirtueMart Version: 3+
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #1 on: January 22, 2012, 19:27:06 pm »
the module is only a 2 level module.

J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

janis

  • Beginner
  • *
  • Posts: 41
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #2 on: January 22, 2012, 19:44:43 pm »
hi

this is really bad..

uuu... what can i do to have more levels?? maybe other ways?

because i really need more levels..


gr.
Files:  http://dev.virtuemart.net/projects/virtuemart/files

Updates:
https://github.com/VirtueMart/virtuemart/commits/master


love virtuemart when it's 10000% stable like in version 4.5 in the year 2015

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10412
  • VirtueMart Version: 3+
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #3 on: January 23, 2012, 02:38:15 am »
janis, if you have 1000 categories, or 50, 000 categories. THE page would be soooo slow. So, thats why its not in the core.

I'm sure there will be 0a 3rd party module developed.

YOPU can always use thje joomla menu system, and make your own
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

patrickit

  • Beginner
  • *
  • Posts: 13
    • Dubai web design
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #4 on: February 06, 2012, 05:37:46 am »
Hi,

@BanquetTables.pro - using the joomla menu system - wouldn't that be fixed? What if we add new categories/sub categories to it?

@Janis There is a module but it didn't work in my vm2.0, if you have an earlier version of vm it may work - http://extensions.joomla.org/extensions/extension-specific/virtuemart-extensions/virtuemart-categories/9902

If it doesn't, and since there are no modules then I have a temporary workaround hack for you. Note that my workaround goes 1 extra level deep (3rd node), you can customize it for more nodes if required.
You can see a working demo here http://x-doria.ae/
Hope it helps!

go to modules/mod_virtuemart_category/mod_virtuemart_category.php
find  (around line 46)
foreach ($categories as $category) {

      $category->childs = $cache->call( array( 'VirtueMartModelCategory', 'getChildCategoryList' ),$vendorId, $category->virtuemart_category_id );
add after it
//PL temp hack show 3rd node
      if($category->childs){
         foreach($category->childs as $child){
            $child->childs = $cache->call( array( 'VirtueMartModelCategory', 'getChildCategoryList' ),$vendorId, $child->virtuemart_category_id );
         }
      }
      //PL end

go to modules/mod_virtuemart_category/tmpl/all.php
find  (around line 32)
<div ><?php echo JHTML::link($caturl, $cattext); ?></div>

add after it
<?php if ($child->childs ) {   //PL temp hack show 3rd node
   ?>
      <ul class="menu<?php echo $class_sfx; ?>">
      <?php
         foreach ($child->childs as $grandchild) {      
            $caturl = JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$grandchild->virtuemart_category_id);
            $cattext = $grandchild->category_name;
            ?>
      <li>
         <div ><?php echo JHTML::link($caturl, $cattext); ?></div>
      </li>
      <?php } ?>
      </ul>
   <?php    } //PL end ?>
I adore Joomla & Virtuemart!

alex_corba

  • Beginner
  • *
  • Posts: 1
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #5 on: February 10, 2012, 15:40:31 pm »
Thank you for that great workaround hack! But I have still a little problem with it: I don't want to display all the categories, 1 level subcategories and 2nd level subcategories at once (i have too much subcategories!). I prefer using the accordion effect or only the current category effect, so when I click on a category only the subcategories of the parent category is shown and when I click on a subcategory first level the subcategory 2nd level is shown. Here is the link: http://cmss.planetmuscle.de/

I submit the hack in modules/mod_virtuemart_category/tmpl/current.php but the subcategories are shown at once.
Can you help me how to fix it?

patrickit

  • Beginner
  • *
  • Posts: 13
    • Dubai web design
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #6 on: February 12, 2012, 08:03:57 am »
Alex,

That can be set in the css/javascript. You can hide what you don't need and display them on click.
I adore Joomla & Virtuemart!

wnrdesign

  • Beginner
  • *
  • Posts: 10
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #7 on: June 04, 2012, 20:15:30 pm »
I'm having the same problem! Hack works but after dropdown all subcategories are shown.

Any updates on thisone?

mysmx

  • Beginner
  • *
  • Posts: 1
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #8 on: June 10, 2012, 02:29:50 am »
just change to this: (i added f($child->virtuemart_category_id==$active_category_id))

if($category->childs){      
      foreach($category->childs as $child){      
         if($child->virtuemart_category_id==$active_category_id){      
           $child->childs = $cache->call( array( 'VirtueMartModelCategory', 'getChildCategoryList' ),$vendorId, $child->virtuemart_category_id );         
          }
         }
      }

alexdixondesign

  • Beginner
  • *
  • Posts: 4
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #9 on: June 17, 2012, 15:03:28 pm »
I simply added the hack as above, and then inserted the second snippet of code into "current.php" (as below).

This seems to only expand any sub categories under the active parent without expanding the whole store. It also worked in "default.php".

Code: [Select]
<li>
<div ><?php echo JHTML::link($caturl$cattext); ?></div>

<?php if ($child->childs ) {   //PL temp hack show 3rd node
   
?>

      <ul class="menu<?php echo $class_sfx?>">
      <?php
         
foreach ($child->childs as $grandchild) {      
            
$caturl JRoute::_('index.php?option=com_virtuemart&view=category&virtuemart_category_id='.$grandchild->virtuemart_category_id);
            
$cattext $grandchild->category_name;
            
?>

      <li>
         <div ><?php echo JHTML::link($caturl$cattext); ?></div>
      </li>
      <?php ?>
      </ul>
   <?php    //PL end ?>

</li>

hothotheat

  • Beginner
  • *
  • Posts: 2
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #10 on: July 02, 2012, 16:11:17 pm »
Thanks for this hack!

It all works fine, there is just one small bug:
When I click on a 2nd node the sub-categories of the 3rd node are shown correct. But when I click on a 3rd node, this 3rd node categories are gone after page loaded. I couldn't find a solution, any ideas?

I tested it with the default and the current template, both the same bug.

nerfmarius

  • 3rd party VirtueMart Developer
  • Beginner
  • *
  • Posts: 14
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #11 on: February 05, 2013, 10:01:49 am »
Thanks for this hack!

It all works fine, there is just one small bug:
When I click on a 2nd node the sub-categories of the 3rd node are shown correct. But when I click on a 3rd node, this 3rd node categories are gone after page loaded. I couldn't find a solution, any ideas?

I tested it with the default and the current template, both the same bug.

Same here, did anyone find a solution to this?

priyank2512

  • Beginner
  • *
  • Posts: 2
  • No text
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #12 on: February 08, 2013, 07:48:33 am »
hello,
i am new in virtuemart,
can you please tell me that how to add 4th node in this module?
thank you
no signature

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3656
  • using Matomo instead of Google Analytics
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

balai

  • 3rd party VirtueMart Developer
  • Full Member
  • *
  • Posts: 1415
Re: module VM - Category only shows 2nodes not the 3de one.
« Reply #14 on: February 08, 2013, 10:11:18 am »
Custom Filters can be used too as category module for unlimited category tree depth
http://breakdesigns.net/extensions/custom-filters

Its in the free version