Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Jul 2010
    Posts
    66
    Plugin Contributions
    0

    Default Random items on home page

    I am somewhat confused about something with the default setup for ZenCart.
    I have been populating my store by hand. (Major Issues with EZPopulate). And as I am adding the items, I am choosing the ones that I would like to have featured as well a specials.
    When I go to check the way that the home page looks, I see that the cycling of items is done by the category that the items are in.
    Since I sell seeds, it is very simple to tell that there are only tree, vegetable, or cacti seed on the home page, and not a blend of the other items in other categories.
    Is there a setting that I have to change to make a 'blend' of different items, or is this the default method that ZC displays home page items?
    I would much prefer that there is a way to display a random cross section of items that I have to offer rather than just the items in a single category of the site.


    Site: www.oaktreeseed.com
    Zen Cart: v1.3.9b (Clean install, no upgrade, only template added.)
    Host: GoDaddy.com
    Addons: No addons other than what came out of the box (GoDaddy) and the EZPopulate that I am asking about
    Customization: Nothing more than the template, some box sizing, and standard changes for esthetics. (I have not changed the /admin/ folder as yet, the site is not up and running live until 30SEPT0)
    Started: Immediately following the installation of EZ Populate v1.2.5.4

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Random items on home page

    What display are you referencing?
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Jul 2010
    Posts
    66
    Plugin Contributions
    0

    Default Re: Random items on home page

    On the home page of http://www.oaktreeseed.com It is listed as "New Products For XXXXXXXXXX", and the items that are listed there are the one that I am asking about.
    The template I am using employs the same basic layout as ZC out of the box. The center box is where the items that are listed, by it seem category, are cycling through.

    Thanks

    JT

    Site: www.oaktreeseed.com
    Zen Cart: v1.3.9b (Clean install, no upgrade, only template added.)
    Host: GoDaddy.com
    Addons: No addons other than what came out of the box (GoDaddy) and the EZPopulate that I am asking about
    Customization: Nothing more than the template, some box sizing, and standard changes for esthetics. (I have not changed the /admin/ folder as yet, the site is not up and running live until 30SEPT10)
    Started: Immediately following the installation of EZ Populate v1.2.5.4

  4. #4
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Random items on home page

    New products on home page are random selected by date -
    default is all

    check admin > config > maximum values > New Product Listing - Limited to ... > select from options
    Zen-Venom Get Bitten

  5. #5
    Join Date
    Sep 2009
    Location
    California
    Posts
    148
    Plugin Contributions
    0

    Default Re: Random items on home page

    Quote Originally Posted by kobra View Post
    check admin > config > maximum values > New Product Listing - Limited to ... > select from options
    I can see where he's coming from on this - as I've built up the database, I've noticed that the 'random' items are all pulled and showing on the side from the same category... it may be a different category on the bottom, but all the items are still in the same area. (new site - www.disastersupplycatalog.com)

    Anyone know where this 'random' gets seeded from?!?

    Or, does the random just mean random category - not item?

    Just curious.

  6. #6
    Join Date
    Sep 2009
    Location
    California
    Posts
    148
    Plugin Contributions
    0

    Idea or Suggestion Re: Random items on home page

    Quote Originally Posted by Fez-o Joe View Post
    Anyone know where this 'random' gets seeded from?!?

    Or, does the random just mean random category - not item?
    OK, after attempting to make sense of \whats_new.php - it appears that it does make a random number pull, then selects from that number, 'plus' to the max amount you've told it to display.

    But, it's not a random each time - it's pulling products_id - then just incrementing. ex: it pulls a 220, then displays item 220, 221, 222.

    What I'd like (and think the intent was) is a true random ... perhaps a pull of item 220, then 42, then 467 to fulfill the display request - that make sense?

    Just curious...

  7. #7
    Join Date
    Sep 2009
    Location
    California
    Posts
    148
    Plugin Contributions
    0

    bug Needing a RANDOM explaination...

    For the 'New Products' aspect of the page:

    Quote Originally Posted by Fez-o Joe View Post
    OK, after attempting to make sense of \whats_new.php - it appears that it does make a random number pull, then selects from that number, 'plus' to the max amount you've told it to display.

    But, it's not a random each time - it's pulling products_id - then just incrementing. ex: it pulls a 220, then displays item 220, 221, 222.

    What I'd like (and think the intent was) is a true random ... perhaps a pull of item 220, then 42, then 467 to fulfill the display request - that make sense?

    Just curious...
    I'm wondering if anyone can make sense of this - as it seems like a nice thing to have... be a shame to turn it all off.

    Tag.

  8. #8
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Needing a RANDOM explaination...

    Yes, this is how the current version of Zen Cart works, primarily because there isn't (or at least wasn't) a standard SQL way of extracting entries in a random order.

    However, this can be done with MySQL. It's been 2-3 years since I've done it but basically if you find the query that pulls the products out for this box and change (or add) to "ORDER BY RAND()" you'll have the result you want.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  9. #9
    Join Date
    Sep 2009
    Location
    California
    Posts
    148
    Plugin Contributions
    0

    Have a Drink Re: Random items on home page

    Thanks Kuroi - it works. Took a bit to find exactly where on the select it'd like it, but that goes back to my noob coding skills with PHP.

    And if in the future someone else is reading this - there's two files and multiple places to update in /includes/modules/new_products and /sideboxes/whats_new

    this is an example in the new_products:

    $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 order by rand()" . $display_limit;

    Watch that quotation mark! *chuckle*

  10. #10
    Join Date
    Feb 2007
    Posts
    22
    Plugin Contributions
    0

    Default Re: Random items on home page

    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?

 

 
Page 1 of 2 12 LastLast

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