Page 2 of 2 FirstFirst 12
Results 11 to 16 of 16
  1. #11
    Join Date
    Sep 2009
    Location
    California
    Posts
    148
    Plugin Contributions
    0

    Default Re: Random items on home page

    Quote Originally Posted by yoz8225 View Post
    I would like to set up "Featured Products" on my home page to appear in random order every time the page is refreshed. Can this be done with settings or by some other means?
    It is controlled via the Admin panel (Config/Max Values) and it has the same programming as the New Products... it'll pick a random product_id then increment from there. Just looking over the code in the featured_products.php - it appears akin to the new_products - so the same code mod should work.

    Remember to backup. Always.

  2. #12
    Join Date
    Sep 2010
    Posts
    64
    Plugin Contributions
    0

    Default Re: Random items on home page

    What if I wanted to Hard code a specific category say cat id = 1

    when i add a where it just defaults to random.. for some reason trying to specify a category in the admin gets me nowhere either!

    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.products_status = 1 WHERE p.master_categories_id = '1'
    and p.products_id in (" . $list_of_products . ")";

  3. #13
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Random items on home page

    You cannot have 2 WHERE statements in there;
    Code:
    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.products_status = 1 WHERE p.master_categories_id = '1'
    and p.products_id in (" . $list_of_products . ")";
    you want to add a new AND to that existing WHERE if you are trying to limit the Products to be those coming just from Products using master_categories_id 1 with:
    Code:
    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
    from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
    where p.products_id = pd.products_id
    and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
    and p.products_status = 1 
    and p.master_categories_id = '1'
    and p.products_id in (" . $list_of_products . ")";
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  4. #14
    Join Date
    Sep 2010
    Posts
    64
    Plugin Contributions
    0

    Default Re: Random items on home page

    Wow thank you.. That was the answer..

  5. #15
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Random items on home page

    Thanks for the update that this worked for you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  6. #16
    Join Date
    Jan 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Random items on home page

    I'm trying this aswell, but I don't think I'm using sideboxes. I was wondering what php file that I should look at editig with this code. I would like to show fully randimized products to.
    http://www.mutt-lover.com

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Need to add a random selection in a category to the home page
    By josee225 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 20 Feb 2010, 09:46 PM
  2. Random Items from All Products on Main Page
    By FarmGrrl in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 May 2007, 02:10 PM
  3. Random Products on Home Page
    By pal1lap in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 24 Jan 2007, 11:41 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