News:

Looking for documentation? Take a look on our wiki

Main Menu

module VM - Category only shows 2nodes not the 3de one.

Started by janis, January 22, 2012, 17:36:50 PM

Previous topic - Next topic

janis

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


janis

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

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

patrickit

#4
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

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

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

I'm having the same problem! Hack works but after dropdown all subcategories are shown.

Any updates on thisone?

mysmx

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

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".


<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

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

Quote from: hothotheat 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.

Same here, did anyone find a solution to this?

priyank2512

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

Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

balai

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