Community Forums

[SOLVED][1.5] one more level of sub category!

Template support & advice for OpenCart v1.x

Re: [SOLVED][1.5] one more level of sub category!

Postby dunks » Sat Mar 31, 2012 6:10 am

can anyone build Vqmod version,, ;D i think will be usefull O0
User avatar
dunks
 
Posts: 139
Joined: Wed Apr 20, 2011 5:19 am
Location: Jakarta - Indonesia

Re: [SOLVED][1.5] one more level of sub category!

Postby FlySpartan » Wed Apr 04, 2012 3:21 am

In case anyone is trying to make this work for 1.5.2, this doesn't exactly work, but I made one minor modification after sifting through all the code, and it's merely another change in the stylesheet.css file.

Look for
Code: Select all
.box-category > ul > li ul {
   display: none;
}


Simply change to
Code: Select all
.box-category > ul > li ul {
   display: block;
}
FlySpartan
 
Posts: 1
Joined: Wed Apr 04, 2012 3:18 am


Re: [SOLVED][1.5] one more level of sub category!

Postby devplus » Wed Jun 06, 2012 3:07 pm

Any update for OC 1.5.3.1?
devplus
 
Posts: 18
Joined: Fri May 18, 2012 3:43 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby moscoiso » Tue Jul 24, 2012 4:17 am

pxdva wrote:Credit to the original poster chokoret for this post.

For 1.5.1.3 use the following:

STEP 1 Use this for catalog/controller/module/category.php:

Code: Select all
<?php
class ControllerModuleCategory extends Controller {
   protected function index() {
      $this->language->load('module/category');
     
       $this->data['heading_title'] = $this->language->get('heading_title');
     
      if (isset($this->request->get['path'])) {
         $parts = explode('_', (string)$this->request->get['path']);
      } else {
         $parts = array();
      }
     
      if (isset($parts[0])) {
         $this->data['category_id'] = $parts[0];
      } else {
         $this->data['category_id'] = 0;
      }
     
      if (isset($parts[1])) {
         $this->data['child_id'] = $parts[1];
      } else {
         $this->data['child_id'] = 0;
      }
            if (isset($parts[2])) {
         $this->data['sisters_id'] = $parts[2];
      } else {
         $this->data['sisters_id'] = 0;
      }         
      $this->load->model('catalog/category');
      $this->load->model('catalog/product');
     
      $this->data['categories'] = array();
               
      $categories = $this->model_catalog_category->getCategories(0);
     
          foreach ($categories as $category) {
         
             $children_data = array();
          $sister_data = array();
             
             $children = $this->model_catalog_category->getCategories($category['category_id']);
             
             foreach ($children as $child) {           
                $sister_data = array();
                $sisters = $this->model_catalog_category->getCategories($child['category_id']);
                if($sisters) {
                   foreach ($sisters as $sisterMember) {
                      $sister_data[] = array(
                         'category_id' =>$sisterMember['category_id'],
                         'name'        => $sisterMember['name'],
                         'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']. '_' . $sisterMember['category_id'])   
                      );                     
                                 
                   }
                   $children_data[] = array(
                         'category_id' => $child['category_id'],
                         'sister_id'   => $sister_data,
                         'name'        => $child['name'],
                         'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])   
                      );   
                }else{                     
                   $children_data[] = array(
                      'category_id' => $child['category_id'],
                      'sister_id'    =>'',
                      'name'        => $child['name'],
                      'href'        => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])   
                   );   
                }
             }         
             $data = array(
                'filter_category_id'  => $category['category_id'],
                'filter_sub_category' => true   
             );     
               
             $product_total = $this->model_catalog_product->getTotalProducts($data);
                     
             $this->data['categories'][] = array(
                'category_id' => $category['category_id'],
                'name'        => $category['name'],
                'children'    => $children_data,
                'sister'    => $sister_data,
                'href'        => $this->url->link('product/category', 'path=' . $category['category_id'])
             );
          }
     
      if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/category.tpl')) {
         $this->template = $this->config->get('config_template') . '/template/module/category.tpl';
      } else {
         $this->template = 'default/template/module/category.tpl';
      }
     
      $this->render();
     }
}
?>


STEP 2: Use this for catalog/view/theme/default/template/module/category.tpl:
Code: Select all
<div class="box">
  <div class="box-heading"><?php echo $heading_title; ?></div>
  <div class="box-content">
    <div class="box-category">
      <ul>
        <?php foreach ($categories as $category) { ?>
        <li>
          <?php if ($category['category_id'] == $category_id) { ?>
          <a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
          <?php } else { ?>
          <a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
          <?php } ?>
          <?php if ($category['children']) { ?>
          <ul>
            <?php foreach ($category['children'] as $child) { ?>
            <li>
              <?php if ($child['category_id'] == $child_id) { ?>
              <a href="<?php echo $child['href']; ?>" class="active"> - <?php echo $child['name']; ?></a>
              <?php } else { ?>
              <a href="<?php echo $child['href']; ?>"> - <?php echo $child['name']; ?></a>
              <?php } ?>
                  <?php if($child['sister_id']){ ?>
    <ul>
    <?php foreach($child['sister_id'] as $sisters) { ?>

    <li>
    <?php if ($sisters['category_id'] == $sisters_id) { ?>
    <a href="<?php echo $sisters['href']; ?>" class="active"> - <?php echo $sisters['name']; ?></a>
    <?php } else { ?>
    <a href="<?php echo $sisters['href']; ?>"> - <?php echo $sisters['name']; ?></a>
    <?php } ?>
    </li>
    <?php } ?>
    </ul>
    <?php } ?>
           </li>
            <?php } ?>
          </ul>
          <?php } ?>
        </li>
        <?php } ?>
      </ul>
    </div>
  </div>
</div>


STEP 3:
FIND in catalog/view/theme/default/stylesheet/stylesheet.css
Code: Select all
.box-category > ul > li ul > li > a.active + ul {
display: block;
}


and UNDER THAT, ADD:
Code: Select all
.box-category > ul > li ul > li ul > li a.active {
font-weight: bold;
color: #06bcc3;
}
.box-category > ul > li ul > li ul > li a.active + ul {
display: block;
}


That worked for me using the default Opencart template.

perfect work with oc 1.5.3.1, except in show the sub sub sub.
eg:

Code: Select all
Components
  - Monitors
    - test 1
      -Sub 3 //This not show
João Mello
Follow me João Mello
Facebook João Mello
Skype suporte.multiarts
Image Image
Image
moscoiso
 
Posts: 3
Joined: Tue Jul 24, 2012 3:58 am

Re: [SOLVED][1.5] one more level of sub category!

Postby moxet » Sat Aug 04, 2012 11:58 am

Can somebody help in this:

i want to show category/sub-categories like

Hello 1 Hello 5 Hello 9
Hello 2 Hello 6 Hello 10
Hello 3 Hello 7 Hello 11
Hello 4 Hello 8 Hello 12

how to do that default style is

Hello1 Hello 2 Hello 3 Hello 4 Hello 5 Hello 6 Hello 7

Thanks
moxet
 
Posts: 11
Joined: Sat Jun 30, 2012 2:40 pm

one more level of sub category!

Postby moscoiso » Fri Aug 17, 2012 8:50 pm

This is dead? :'(
How to display the top menu?
João Mello
Follow me João Mello
Facebook João Mello
Skype suporte.multiarts
Image Image
Image
moscoiso
 
Posts: 3
Joined: Tue Jul 24, 2012 3:58 am

Re: [SOLVED][1.5] one more level of sub category!

Postby greensolef » Fri Aug 24, 2012 5:27 am

Hi all,, I have tried the earlier codes suggestions, and it works right to me,,..
But seems it that the number besides the category name was not now displayed after i have successfully followed the instructions...

How can be possible to display the number of items/products belongs to that category...
Currently, my sidebar categories displays like this:
Category Parent
- sub category a
- sub category b
- sub category c (

I want the result be like this:
Category Parent
- sub category a (10)
- sub category b (5)
- sub category c (15)

Please help..
Thanks
greensolef
 
Posts: 41
Joined: Tue Jul 03, 2012 6:20 am

Re: [SOLVED][1.5] one more level of sub category!

Postby skinnv » Mon Sep 03, 2012 11:15 pm

Please please help. :)
I couldn't seem to find an answer to my specific error...

RE: SUBCATEGORY TITLES AND PRODUCTS NOT LISTING CORRECTLY/MISSING

Top category menu title is "Shop", under it I have subcategories "Vitamin-Rich Facial Serums", then "Fizzing Bath Bombs", then "Air Fresheners".
Now if you click on "Vitamin-Rich Facial Serums" it shows "Vitamin-Rich Facial Serums" title at the top and then shows all the products in that category, this is what is supposed to happen. BUT then other categories are NOT WORKING. If you click on "Fizzing Bath Bombs" the title on that page says "Shop" when it should say "Fizzing Bath Bombs" AND the products showing are from 2 different categories!!

Currently in the admin panel I have checked the box "shop" and "shop>fizzing bath bombs". Now if I uncheck "shop" no products show up in the "shop>fizzing bath bombs" checked box.

So to recap, it looks like there is something wrong in the categories admin panel. A problem with the title of the category missing from the page (not menu bar) and something wrong with the products combining together.

Here is my website link: http://www.skin-nv.com
skinnv
 
Posts: 5
Joined: Tue Oct 11, 2011 9:15 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby jasonfleck » Sun Sep 09, 2012 9:10 pm

Does anyone know how to make this work for 1.5.3.1? I've tried this and it doesn't seem to show the 3rd level category in the side category menu.
jasonfleck
 
Posts: 3
Joined: Sun Sep 09, 2012 9:09 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby rajdeepr » Fri Sep 14, 2012 5:23 am

Hello Everyone,
I have got a template which supports 3 level menu ( as it is showing up in the html versioin of the template) but when i am trying to add 3 level ( that is sub sub category) it is not showing up.
Can anyone figure me out the real way to make sub sub category?
site is : www.levitechdisplays.com
Please answer fast as it is very urgent !
rajdeepr
 
Posts: 1
Joined: Fri Sep 14, 2012 4:55 am

Re: [SOLVED][1.5] one more level of sub category!

Postby cosmicx » Sun Sep 16, 2012 6:39 pm

Does anyone knows how to apply this one for 1.5.4.1? for a custom theme?
cosmicx
 
Posts: 47
Joined: Mon Jan 09, 2012 10:27 am

Re: [SOLVED][1.5] one more level of sub category!

Postby dydyt » Thu Oct 25, 2012 11:50 am

cosmicx wrote:Does anyone knows how to apply this one for 1.5.4.1? for a custom theme?


Yes, anyone knows? Please?!
dydyt
 
Posts: 15
Joined: Tue Oct 16, 2012 7:28 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby hispania » Thu Oct 25, 2012 3:11 pm

And for more levels??? 4, 5 ... Is it posible?????

Thanks.
hispania
 
Posts: 9
Joined: Sat Oct 20, 2012 4:19 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby Xciso » Fri Jan 04, 2013 12:46 pm

Any updates of this?
I really need to get more levels..
Xciso
 
Posts: 134
Joined: Thu Jul 14, 2011 9:20 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby pgt_gaming » Wed Jan 30, 2013 3:01 am

Does anyone know if this will work for version 1.5.4.1 or not?
pgt_gaming
 
Posts: 17
Joined: Mon Jan 28, 2013 7:38 pm

Re: [SOLVED][1.5] one more level of sub category!

Postby adriankoooo » Sat Feb 02, 2013 9:11 am

I have same problem. Funny, that it is working on the OC 1.4, but not on OC 1.5. :-\
adriankoooo
 
Posts: 146
Joined: Wed Mar 02, 2011 10:52 pm

Previous

Return to Template Support

Who is online

Users browsing this forum: No registered users and 18 guests

Hosted by Arvixe Web Hosting