Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20
  1. #11
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Browsing through categories

    Quote Originally Posted by DigiBooks View Post
    Thanks, But this doesn't work in 155 just a white screen
    There may have been a typo. Whenever a whitescreen occurs, there likely is an error log generated: http://www.zen-cart.com/content.php?124-blank-page
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #12
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: Browsing through categories

    Ok thanks

    I am getting:


    WARNING: An Error occurred, please refresh the page and try again.
    WARNING: An Error occurred, please refresh the page and try again.

  3. #13
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Browsing through categories

    Quote Originally Posted by DigiBooks View Post
    Ok thanks

    I am getting:


    WARNING: An Error occurred, please refresh the page and try again.
    WARNING: An Error occurred, please refresh the page and try again.
    So, not a blank screen, but same basic troubleshooting process: https://www.zen-cart.com/content.php...-and-try-again
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #14
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Browsing through categories

    Oh, wait. I forgot that ZC 1.5.1 doesn't give as much resolution detail as more recent if not modern versions of ZC. If the issue is related to a SQL query, then will need to install mydebug backtrace in order to get some useful information about the problem.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  5. #15
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: Browsing through categories

    Quote Originally Posted by mc12345678 View Post
    Oh, wait. I forgot that ZC 1.5.1 doesn't give as much resolution detail as more recent if not modern versions of ZC. If the issue is related to a SQL query, then will need to install mydebug backtrace in order to get some useful information about the problem.
    I'm testing this on a newly installed V1.5.5 - that's where I am getting the error message. This is what the error log reads:

    [04-Feb-2019 20:04:58 Europe/London] Request URI: /db_155/index.php?main_page=index&cPath=31, IP address: 81.154.21.188
    #1 mysqli_query() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php:45]
    #2 queryFactory->query() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php:261]
    #3 queryFactory->Execute() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/functions/functions_categories.php:159]
    #4 zen_get_subcategories() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/functions/functions_categories.php:164]
    #5 zen_get_subcategories() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/modules/categories_tabs.php:33]
    #6 include(/home/sites/digibooks.org.uk/public_html/db_155/includes/modules/categories_tabs.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/template_default/templates/tpl_modules_categories_tabs.php:14]
    #7 require(/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/template_default/templates/tpl_modules_categories_tabs.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_header.php:133]
    #8 require(/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_header.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_main_page.php:119]
    #9 require(/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_main_page.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/index.php:97]

    [04-Feb-2019 20:04:58 Europe/London] PHP Warning: mysqli_query(): (HY000/2008): Out of memory in /home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php on line 45
    [04-Feb-2019 20:04:58 Europe/London] Request URI: /db_155/index.php?main_page=index&cPath=31, IP address: 81.154.21.188
    #1 trigger_error() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php:171]
    #2 queryFactory->show_error() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php:143]
    #3 queryFactory->set_error() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php:270]
    #4 queryFactory->Execute() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/functions/functions_categories.php:159]
    #5 zen_get_subcategories() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/functions/functions_categories.php:164]
    #6 zen_get_subcategories() called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/modules/categories_tabs.php:33]
    #7 include(/home/sites/digibooks.org.uk/public_html/db_155/includes/modules/categories_tabs.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/template_default/templates/tpl_modules_categories_tabs.php:14]
    #8 require(/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/template_default/templates/tpl_modules_categories_tabs.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_header.php:133]
    #9 require(/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_header.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_main_page.php:119]
    #10 require(/home/sites/digibooks.org.uk/public_html/db_155/includes/templates/responsive_classic/common/tpl_main_page.php) called at [/home/sites/digibooks.org.uk/public_html/db_155/index.php:97]

    [04-Feb-2019 20:04:58 Europe/London] PHP Fatal error: 2008:Out of memory :: select categories_id
    from categories
    where parent_id = '6122' ==> (as called by) /home/sites/digibooks.org.uk/public_html/db_155/includes/functions/functions_categories.php on line 159 <== in /home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php on line 171
    [04-Feb-2019 20:04:58 Europe/London] PHP Fatal error: Out of memory (allocated 15466496) (tried to allocate 2787 bytes) in /home/sites/digibooks.org.uk/public_html/db_155/includes/classes/db/mysql/query_factory.php on line 171
    Last edited by DigiBooks; 5 Feb 2019 at 10:17 AM.

  6. #16
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: Browsing through categories

    Just looking at the out of memory error message and wondering if the patch you posted is trying to browse the entire catalog or just a selected Top-level category?

    The Adult category does not have that many books linked to it but guessing this could be a problem later with things like Thrillers. At present we hold nearly 24,500 books on file so maybe the server will never be able to handle these quantities.

    If that is the case then would it be possible to browse in a similar way as the New Products sidebox but to restrict that to the selected Top-Level Category?

  7. #17
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: Browsing through categories

    Well, as I said, that was just a example to link the first category to the last.
    Ex: 36_34_56 ( 36 will link to 56)
    But I only tested with one product with a similar categories structure.

    If you remove that piece of code and everything is ok again, well, something is wrong inside that while loop.
    However, more or less, that's the process needed. This has some comments.
    Try to check that $subcategories_array with a print_r($subcategories_array) , or using a die(), to debug.
    Or maybe I did somthing wrong, but I can't test it write now.... and I don't have 24000 products to list

    PHP Code:
    while (!$categories_tab->EOF) {
        
    $path $categories_tab->fields['categories_id'];
        
    // currently selected category
        
    if ((int) $cPath == $categories_tab->fields['categories_id']) {
            
    $new_style 'category-top';
            
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';
        } else {
            
    $new_style 'category-top';
            
    $categories_tab_current $categories_tab->fields['categories_name'];
             
            
    $subcategories_array = array(); // this is gathering all subcategories in a array
            // using zen_get_subcategories
            
    zen_get_subcategories($subcategories_array$categories_tab->fields['categories_id']);

            if (!empty(
    $subcategories_array)) { // if there is a subcat
                // create a new path ex: 36_35_54 , so it will link to the last subcat found
                
    $path $categories_tab->fields['categories_id'] . '_' implode('_'$subcategories_array);
            }
        }

        
    // create link to according to the path
        
    $links_list[] = '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT'cPath=' $path) . '">' $categories_tab_current '</a> ';
        
    //$links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> ';

        
    $categories_tab->MoveNext();

    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  8. #18
    Join Date
    May 2014
    Location
    UK
    Posts
    317
    Plugin Contributions
    0

    Default Re: Browsing through categories

    Quote Originally Posted by mesnitu View Post
    Well, as I said, that was just a example to link the first category to the last.
    Ex: 36_34_56 ( 36 will link to 56)
    But I only tested with one product with a similar categories structure.

    If you remove that piece of code and everything is ok again, well, something is wrong inside that while loop.
    However, more or less, that's the process needed. This has some comments.
    Try to check that $subcategories_array with a print_r($subcategories_array) , or using a die(), to debug.
    Or maybe I did somthing wrong, but I can't test it write now.... and I don't have 24000 products to list

    PHP Code:
    while (!$categories_tab->EOF) {
        
    $path $categories_tab->fields['categories_id'];
        
    // currently selected category
        
    if ((int) $cPath == $categories_tab->fields['categories_id']) {
            
    $new_style 'category-top';
            
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';
        } else {
            
    $new_style 'category-top';
            
    $categories_tab_current $categories_tab->fields['categories_name'];
             
            
    $subcategories_array = array(); // this is gathering all subcategories in a array
            // using zen_get_subcategories
            
    zen_get_subcategories($subcategories_array$categories_tab->fields['categories_id']);

            if (!empty(
    $subcategories_array)) { // if there is a subcat
                // create a new path ex: 36_35_54 , so it will link to the last subcat found
                
    $path $categories_tab->fields['categories_id'] . '_' implode('_'$subcategories_array);
            }
        }

        
    // create link to according to the path
        
    $links_list[] = '<a class="' $new_style '" href="' zen_href_link(FILENAME_DEFAULT'cPath=' $path) . '">' $categories_tab_current '</a> ';
        
    //$links_list[] = '<a class="' . $new_style . '" href="' . zen_href_link(FILENAME_DEFAULT, 'cPath=' . (int)$categories_tab->fields['categories_id']) . '">' . $categories_tab_current . '</a> ';

        
    $categories_tab->MoveNext();

    Thanks very much for taking another look at this. I am a little confused though. The Adult category currently starts off with 56 sub-categories so I put a counter in to ensure I wasn't stuck in an infinite loop and the count stopped at 53 before crashing with the exception errors.

    I have explored the various products tables trying to identify the top-level category but none of the tables show a link back to Adult Top-Level category #31. I guess that it is a case of top-level passing to sub-category downwards etc.

    Thinking out of the box I am considering making an amendment to the Add / Edit products routine. At the top of the page it will show for example:

    Adult ==> A J Carella ==> The Game

    so Top-Level has already been identified somewhere along the line so if I can grab Top-Level #31 (for example) and automatically populate the Model No. field with that then I should be able to make a definite correlation between Top-Level and Products contained at bottom level.

    I will explore the coding and see if I can write a patch script to populate model for all products and see where that goes.

  9. #19
    Join Date
    Aug 2014
    Location
    Lisbon
    Posts
    594
    Plugin Contributions
    0

    Default Re: Browsing through categories

    That piece of code was to add a link in the index page. So one could return to the adult category.
    If you want to always link the first to the last, then instead try the changes below.
    Testing on a clean zc156 and replicating the adult category, for me works fine.
    If I click on "software" category that has more subcats, I'll go from 2 to 20. ( main_page=index&cPath=2_18_19_20)

    But there is no link back. Only breadcrumbs is available to list those subcats in the middle.

    PHP Code:
    while (!$categories_tab->EOF) {
        
    $path $categories_tab->fields['categories_id'];
        
    // currently selected category
        
    $subcategories_array = array();
            
    zen_get_subcategories($subcategories_array$categories_tab->fields['categories_id']);
            if (!empty(
    $subcategories_array)) {
                
    $path $categories_tab->fields['categories_id'] . '_' implode('_'$subcategories_array);
            }
        if ((int) 
    $cPath == $categories_tab->fields['categories_id']) {
            
    $new_style 'category-top';
            
    $categories_tab_current '<span class="category-subs-selected">' $categories_tab->fields['categories_name'] . '</span>';
        } else {
            
    $new_style 'category-top';
            
    $categories_tab_current $categories_tab->fields['categories_name'];
            
    // etc, etc, 
        

    But with thousands of products maybe is not the best way....
    “Though the problems of the world are increasingly complex, the solutions remain embarrassingly simple.” ― Bill Mollison

  10. #20
    Join Date
    Jul 2012
    Posts
    16,798
    Plugin Contributions
    17

    Default Re: Browsing through categories

    Quote Originally Posted by DigiBooks View Post
    Thanks very much for taking another look at this. I am a little confused though. The Adult category currently starts off with 56 sub-categories so I put a counter in to ensure I wasn't stuck in an infinite loop and the count stopped at 53 before crashing with the exception errors.

    I have explored the various products tables trying to identify the top-level category but none of the tables show a link back to Adult Top-Level category #31. I guess that it is a case of top-level passing to sub-category downwards etc.

    Thinking out of the box I am considering making an amendment to the Add / Edit products routine. At the top of the page it will show for example:

    Adult ==> A J Carella ==> The Game

    so Top-Level has already been identified somewhere along the line so if I can grab Top-Level #31 (for example) and automatically populate the Model No. field with that then I should be able to make a definite correlation between Top-Level and Products contained at bottom level.

    I will explore the coding and see if I can write a patch script to populate model for all products and see where that goes.
    Note, product won't be directly linked to a some top category from a sub-category. Going back to table relationships: product are assigned to a master category (this is primarily to support sale discounts). To support a one to many relationship they are related to a category: products_to_categories table. If the product exists in two categories then it is considered linked to the non-master category.

    Then categories have a parent. If the parent is 0 then the category is a main category at the top of the store. Otherwise, the category is a sub-category.

    So looking at a product, it can have one or more "parent" categories depending on if it is linked; however, the convention is to base the product in the master category as far as html identification of the canonical link so that search engines don't consider the displayed page a duplicate page. When the product appears in some other category then there is a separate "path" to get to it and it could have a different tree available.

    So in your search/review, would want to look at products_to_categories, products and categories tables.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Replies: 1
    Last Post: 9 May 2011, 05:12 PM
  2. Something is going wrong when browsing through categories
    By goalsurfer in forum General Questions
    Replies: 7
    Last Post: 7 Nov 2010, 06:00 AM
  3. Replies: 3
    Last Post: 13 Jul 2009, 05:23 PM
  4. Browsing Categories
    By tameboy in forum Templates, Stylesheets, Page Layout
    Replies: 8
    Last Post: 5 Feb 2008, 10:15 PM
  5. having trouble when browsing through categories
    By blackinches in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 20 Dec 2006, 01:05 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR