Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1. #11
    Join Date
    Apr 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: Random Products Display on Homepage

    Great. At least I got the gift certificate removed.

  2. #12
    Join Date
    May 2007
    Posts
    29
    Plugin Contributions
    0

    Default Re: Random Products Display on Homepage

    I just made changes to remove random display for new products so I thought of posting it here.

    File to change: /includes/modules/YOUR_TEMPLATE/new_products.php

    1. Add sort by date to the $new_products_query variable (around line 19 & 25). Mine looks like this:
    PHP Code:
    $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 .
                               
    " order by p.products_date_added desc"
    PHP Code:
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
                                               p.products_price
                               from " 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_SPECIALS " s
                               on p.products_id = s.products_id, " 
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
                               
    TABLE_CATEGORIES " c
                               where p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" 
    . (int)$new_products_category_id "'
                               and p.products_status = 1 " 
    $display_limit .
                               
    " order by p.products_date_added desc"
    2. Around line 38, change
    PHP Code:
    $new_products $db->ExecuteRandomMulti($new_products_queryMAX_DISPLAY_NEW_PRODUCTS); 
    to
    PHP Code:
    $new_products $db->Execute($new_products_queryMAX_DISPLAY_NEW_PRODUCTS); 
    3. Scroll down and find this line:
    PHP Code:
    $new_products->MoveNextRandom(); 
    and change it to
    PHP Code:
    $new_products->MoveNext(); 

  3. #13
    Join Date
    Apr 2007
    Posts
    139
    Plugin Contributions
    0

    Default Re: Random Products Display on Homepage

    Hi Battra,

    Nice...May I have look at your URL?

  4. #14
    Join Date
    May 2007
    Posts
    29
    Plugin Contributions
    0

    Default Re: Random Products Display on Homepage

    My Zen cart is still at my local PC I plan to use it as a gallery/showcase instead of shopping cart and that's why I need to put the latest item (chronological, not random) on the main page.

  5. #15
    Join Date
    Jun 2006
    Location
    My family and I live in Brighton, England
    Posts
    982
    Plugin Contributions
    0

    Default Re: Random Products Display on Homepage

    Quote Originally Posted by Ajeh View Post
    You could customize the file:
    /includes/modules/new_products.php

    And change the select statements to add an order by products_date_added so the new ones are at the top ...
    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 {
      
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
                                               p.products_price
                               from " 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_SPECIALS " s
                               on p.products_id = s.products_id, " 
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
      
    TABLE_CATEGORIES " c
                               where p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" 
    . (int)$new_products_category_id "'
                               and p.products_status = 1 " 
    $display_limit;

    Is it possible to do this with all products randomly instead of new products? I've used javascript to create that effect on the main page of my BeadedLily site, with active links imbedded in each of the product photos. However, the process is not, of course, very time-efficient. I like the idea of all products randomly presenting themselves because it takes potential customers deeper into your inventory, shifting focus from just the new, specials or featured.

 

 
Page 2 of 2 FirstFirst 12

Similar Threads

  1. v151 Random display of products on Product Listing
    By Kevin205 in forum General Questions
    Replies: 2
    Last Post: 16 Mar 2013, 08:42 PM
  2. 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
  3. Remove 'New Products' and display random products
    By xman888 in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 19 Apr 2011, 06:48 AM
  4. Homepage Wont Display Featured Products
    By limelites in forum General Questions
    Replies: 4
    Last Post: 26 Feb 2010, 02:17 AM
  5. Display Random products instead of New Products on Index
    By vegascoug in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 17 Sep 2009, 09:35 AM

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