Thread: Categories tree

Results 1 to 6 of 6
  1. #1
    Join Date
    Jun 2010
    Posts
    5
    Plugin Contributions
    0

    Idea or Suggestion Categories tree

    Hello, I'm trying to build a shop on ZenCart. Store has over 1.5 million records in the categories table, and over 10 000 products. The problem start when i generating the category tree on the home page. When it generating a tree, it creates a field containing the name, image, path, etc. This makes the problem on the server, I get an error message out of memory. Memory limit is set to 150 megabytes This problem was alson in admin, but I solved it using some instructions on this forum. I would ask if there is a solution that would solve my problem with categories tree. Thanks for any ideas.

    Information about e-shop
    - version v1.3.9f
    - using mysql cache
    - without any addons

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Categories tree

    Do you have a mod that is displaying the entire categories tree in the sidebox or header dropdown menu? How many categories do you have? How many at the top level? Are you trying to show counts in the categories menu? That is a known resource hog and you should turn it off if you have memory/speed problems. What kind of host do you have?

    There are Zen Cart stores that have half a million products (with skillful setup), so you are not inherently reaching the limits of ZC.

  3. #3
    Join Date
    Jun 2010
    Posts
    5
    Plugin Contributions
    0

    Default Re: Categories tree

    Yes, I have a listing of categories over sideboxes / categories.php mod. This shop is without dropdown menu. It has approximately 1.5 million categories. The highest level consists of 60 categories. Count of products in categories is off. I have good hosting provider in the Czech Republic. With this provider we have good experience. The problem occurs when shop is loading the tree of categories in memory on the server (use array -> this takes lot of a memory). And it is a "car parts" store, so many brands and sub categories.

    Hosting info:
    On this page you can see server config: Yes = ANO, No = NE
    http://www.gigaserver.cz/nase-zazemi/nastaveni-serveru/

  4. #4
    Join Date
    Jun 2010
    Posts
    5
    Plugin Contributions
    0

    Have a Drink Re: Categories tree

    I solved this problem. If you need my help, write me PM.

  5. #5
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Categories tree

    It would be good if you would say something about how you solved the problem - even a general approach would be useful for others.

  6. #6
    Join Date
    Jun 2010
    Posts
    5
    Plugin Contributions
    0

    Default Re: Categories tree

    1) install sql cache query
    2) delete category_tree class
    3)edit tpl_categories.php sidebox in your template directory
    - write own categories_query
    - fetch result query
    Example:

    PHP Code:
    $content "";
      
       echo 
    '<div id="' str_replace('_''-'$box_id 'Content') . '" >' "\n";
       
    $categories_query "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image
                                   from " 
    TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd
                                   where c.parent_id = 0
                                   and c.categories_id = cd.categories_id
                                   and cd.language_id=" 
    . (int)$_SESSION['languages_id'] . "
                                   and c.categories_status= 1"
    ;
      
    $dotaz $db->execute($categories_query);
      while(!
    $dotaz->EOF) {
        
       
            echo 
    '<a  href="' zen_href_link(FILENAME_DEFAULT"cPath=".$dotaz->fields['categories_id']) . '"><div class=radek>';
            echo  
    $dotaz->fields['categories_name'];  
           echo 
    '<br /></div></a>';
            echo  
    "\n"
            
    $dotaz->MoveNext();
                                                                         
          

          
        }
       echo 
    $content '</div>'
    4) edit category_row in modules directory
    Example:

    PHP Code:
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    //$title = '';
    $num_categories $categories->RecordCount();


    if (
    $num_categories 0) {
      echo 
    "<table><tr>";
      while (!
    $categories->EOF) {
       if(
    $col%5==0) echo "</tr><tr>";
      echo 
    '<td><div class="categoryListBoxContents"><a href="' zen_href_link(FILENAME_DEFAULT"cPath=".$_GET['cPath'].'_'.$categories->fields['categories_id']) . '">' zen_image(DIR_WS_IMAGES $categories->fields['categories_image'], $categories->fields['categories_name'], SUBCATEGORY_IMAGE_WIDTHSUBCATEGORY_IMAGE_HEIGHT) . '<br />' $categories->fields['categories_name'] . '</a></div></td>' "\n"
         
    $col ++;
        
    $categories->MoveNext();
      }
      echo 
    "</tr></table>";

    The above codes are not optimal, I wrote it quickly. You have to create your own class, etc. But it works:)))

 

 

Similar Threads

  1. Ssimple categories tree
    By Laki in forum Addon Sideboxes
    Replies: 0
    Last Post: 15 Sep 2015, 04:32 PM
  2. Uncollapsed Categories Tree
    By fragfutter in forum Addon Sideboxes
    Replies: 36
    Last Post: 2 Feb 2014, 08:46 PM
  3. Categories tree modifications
    By Dan123 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 23 Mar 2012, 09:21 AM
  4. Hide categories and tree categories sidebox
    By adowty in forum Addon Sideboxes
    Replies: 1
    Last Post: 16 Aug 2011, 03:09 PM
  5. Css tree Categories
    By qingtianyu9 in forum General Questions
    Replies: 0
    Last Post: 28 Aug 2007, 01:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg