Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default How do I display a single category listing on a defined page?

    Okay.. let me try this again..

    To display the top level category (category ID 0) on a custom "landing page" I have use this method documented here:
    http://www.zen-cart.com/forum/showpo...62&postcount=4

    PHP Code:
    <?php
    $cat_id
    =0;
     
        
    $categories_query "SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id
                              FROM   " 
    TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd
                              WHERE      c.parent_id = :parentID
                              AND        c.categories_id = cd.categories_id
                              AND        cd.language_id = :languagesID
                              AND        c.categories_status= '1'
                              ORDER BY   sort_order, cd.categories_name"
    ;
      
        
    $categories_query $db->bindVars($categories_query':parentID'$cat_id'integer');
        
    $categories_query $db->bindVars($categories_query':languagesID'$_SESSION['languages_id'], 'integer');
        
    $categories $db->Execute($categories_query);
        
    $number_of_categories $categories->RecordCount();
      
     require(
    $template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE,  $current_page_base,'templates'). '/tpl_modules_category_row.php');
    ?>
    I am having a devil of a time trying to figure out how to do something similar for a specific single category. I need a variation of this code to get a product list for one single category which I need to display on a custom defined page.. I have tried messing around with a variation of the code I've used before, but am not having any luck..

    So I admit I need a hand here.. Any experts care to tell me what I am doing wrong??
    Last edited by DivaVocals; 27 Feb 2012 at 06:44 AM.
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How do I display a single category listing on a defined page?

    That code is for listing categories and subcategories, not for listing products.

    You pulled that from some of the code in /includes/modules/pages/index/*.php and /includes/templates /xxxxxx/templates/tpl_index_xxxxxx_default.php.

    You'll need to ditch that code and instead steal the product-related code from the related files, instead of the category-related code.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How do I display a single category listing on a defined page?

    Quote Originally Posted by DrByte View Post
    That code is for listing categories and subcategories, not for listing products.

    You pulled that from some of the code in /includes/modules/pages/index/*.php and /includes/templates /xxxxxx/templates/tpl_index_xxxxxx_default.php.

    You'll need to ditch that code and instead steal the product-related code from the related files, instead of the category-related code.
    Honestly DrByte.. I did this sooooo long ago I don't remember where/how I pulled that code from.. But I am COMPLETELY clueless now as to what I am looking for.. I've been through the product related files, and I'll admit, I'm not seeing what I think I am looking for.. and that's either because I am not looking in the right places or what I am looking for isn't as OBVIOUS as I think it would be.. **sigh**
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  4. #4
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How do I display a single category listing on a defined page?

    So I've been through this forum and found similar questions from others, but no answer.. I'm stumped, and grasping at straws as nothing I'm doing is working.. **sigh**

    Hoping someone can help..
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

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

    Default Re: How do I display a single category listing on a defined page?

    Been looking at files, and the SQL for the product listing is spread out pretty well. product_listing.php does the call to build the listing content, but it depends on /includes/modules/pages/index/header_php.php to build the SQL statement. This has a lot of conditional ins & outs, and will take some unraveling to see exactly what is needed for your specific case.
    /includes/templates/template_default/templates/tpl_index_product_listing.php has some code you will need among a lot you won't, as does tpl_modules_product_listing.php.

  6. #6
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How do I display a single category listing on a defined page?

    Quote Originally Posted by gjh42 View Post
    Been looking at files, and the SQL for the product listing is spread out pretty well. product_listing.php does the call to build the listing content, but it depends on /includes/modules/pages/index/header_php.php to build the SQL statement.
    /includes/templates/template_default/templates/tpl_index_product_listing.php has some code you will need among a lot you won't, as does tpl_modules_product_listing.php.
    That's what I have discovered.. Having a bit of a fit trying to figure out what to pull together from these various sources to simply display a single category.. **sigh**
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

  7. #7
    Join Date
    Jan 2007
    Location
    Los Angeles, California, United States
    Posts
    10,023
    Plugin Contributions
    32

    Default Re: How do I display a single category listing on a defined page?

    Bumping my post in case anyone is interested in something similar to share my latest findings..

    I found an add-on which might provide a means to an acceptable solution to what I am after: Additional Multiple Featured Products (http://www.zen-cart.com/downloads.php?do=file&id=1247)

    Gonna play with this add-on and see if I can get these additional featured products listings to appear on a specific page.. If I can then I can simply copy the products from the category I want to display to one of these additional featured products lists. Would love to go a more direct route and not have to create separate product list, but it is what it is.. Hoping this solution works.. Will post an update if it does.. (pretty sure it will)


    Quote Originally Posted by DivaVocals View Post
    Okay.. let me try this again..

    To display the top level category (category ID 0) on a custom "landing page" I have use this method documented here:
    http://www.zen-cart.com/forum/showpo...62&postcount=4

    PHP Code:
    <?php
    $cat_id
    =0;
     
        
    $categories_query "SELECT c.categories_id, cd.categories_name, c.categories_image, c.parent_id
                              FROM   " 
    TABLE_CATEGORIES " c, " TABLE_CATEGORIES_DESCRIPTION " cd
                              WHERE      c.parent_id = :parentID
                              AND        c.categories_id = cd.categories_id
                              AND        cd.language_id = :languagesID
                              AND        c.categories_status= '1'
                              ORDER BY   sort_order, cd.categories_name"
    ;
      
        
    $categories_query $db->bindVars($categories_query':parentID'$cat_id'integer');
        
    $categories_query $db->bindVars($categories_query':languagesID'$_SESSION['languages_id'], 'integer');
        
    $categories $db->Execute($categories_query);
        
    $number_of_categories $categories->RecordCount();
      
     require(
    $template->get_template_dir('tpl_modules_category_row.php',DIR_WS_TEMPLATE,  $current_page_base,'templates'). '/tpl_modules_category_row.php');
    ?>
    I am having a devil of a time trying to figure out how to do something similar for a specific single category. I need a variation of this code to get a product list for one single category which I need to display on a custom defined page.. I have tried messing around with a variation of the code I've used before, but am not having any luck..

    So I admit I need a hand here.. Any experts care to tell me what I am doing wrong??
    My Site - Zen Cart & WordPress integration specialist
    I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.

 

 

Similar Threads

  1. How to display products inside a defined page?
    By whosleonard in forum General Questions
    Replies: 3
    Last Post: 7 Mar 2011, 04:23 PM
  2. Category - Product listing - displaying Defined Page
    By WHOSYOURDADDY in forum Basic Configuration
    Replies: 1
    Last Post: 28 Oct 2009, 07:31 PM
  3. Single File PHP Gallery into a Defined Page
    By Kite Force in forum Addon Templates
    Replies: 0
    Last Post: 27 Jan 2009, 03:28 AM
  4. How to display product listing on category page?
    By strobogirl in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 11 Nov 2007, 09:17 PM
  5. Replies: 3
    Last Post: 9 Jul 2007, 02:27 PM

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