Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2005
    Posts
    68
    Plugin Contributions
    0

    Default How to limit Random display on main page to 1 category?

    Hello,

    The main page by default displays in a tabular format random selection from all categories in the store.
    This is perfect for my store, however, I would like to limit the random display to products from only one category.

    How can I do that?

    or

    as an alternative solution: how do I prevent Gift Certificates from showing up in the random selection on the main page?


    Thank you,
    dreamdaily

  2. #2
    Join Date
    Sep 2004
    Location
    Western Massachusetts
    Posts
    2,945
    Plugin Contributions
    5

    Default Re: How to limit Random display on main page to 1 category?

    To make the change to the new products set on the main page, edit includes/modules/new_products.php and when done, save it as includes/modules/your_template/new_products.php.

    Find this section of code:
    PHP Code:
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $new_products_query "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
                               from " 
    TABLE_PRODUCTS " p
                               where p.products_status = 1 " 
    $display_limit;
    } else { 
    and add a restriction to the category.
    To limit the selections to a single category, modify that code to this:
    PHP Code:
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $new_products_query "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
                               from " 
    TABLE_PRODUCTS " p
                               where p.products_status = 1 
                               and p.master_categories_id = xx " 
    $display_limit;
    } else { 
    where xx is the category id number of the category you want to select from.
    To simply remove the gift certificates from the selection, change the code to this:
    PHP Code:
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $new_products_query "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
                               from " 
    TABLE_PRODUCTS " p
                               where p.products_status = 1 
                               and p.master_categories_id <> yy " 
    $display_limit;
    } else { 
    where yy is the category id number of your gift certificates category.

    Similar changes can be made for featured products and specials by editing the module files featured_products.php and specials_index.php in the same way and saving them as overide copies.
    Neville
    An assumption is what you arrive at when you get tired of thinking...

  3. #3
    Join Date
    Apr 2005
    Posts
    68
    Plugin Contributions
    0

    Default Re: How to limit Random display on main page to 1 category?

    Thank you, Super Bunny!

  4. #4
    Join Date
    Dec 2008
    Posts
    36
    Plugin Contributions
    0

    Default Re: How to limit Random display on main page to 1 category?

    BonyIp,

    the same question but for Zen Cart 1.38a.

    The text in the program is slightly different.

    Thanks

 

 

Similar Threads

  1. Can I display a random collection of products on my main page?
    By canemasters in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 15 Apr 2012, 02:42 PM
  2. How Display subcategory images and links on Main category page?
    By windowla in forum Setting Up Categories, Products, Attributes
    Replies: 4
    Last Post: 19 Jun 2010, 06:16 PM
  3. Limit Category in Main Page Box
    By exnihilo0 in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 24 Oct 2008, 12:23 PM
  4. Limit number of category images main page
    By bigum in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 10 Jul 2008, 10:58 PM
  5. How to limit number of categories displayed on main page
    By MyGreyGoose in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 11 Feb 2008, 08:38 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