Zen Cart Logo
Forums / Setting Up Categories, Products, Attributes / Random Products Display on Homepage

Random Products Display on Homepage

Locked

Views: 4,920

Results 1 to 15 of 15
This thread is locked. New replies are disabled.
21 Dec 2006, 1:45 PM
#1
fbzencart avatar

fbzencart

New Zenner

Join Date:
Jun 2004
Location:
United Kingdom London
Posts:
54
Plugin Contributions:
0

Random Products Display on Homepage

Hi

Can someone tell me how to stop the random display of products on the homepage . Ideally I will like it to display the new products added recently not just displaying randomly.

Thanks

21 Dec 2006, 2:23 PM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Random Products Display on Homepage

All of the Centerboxes are based on random display ... which is based on the maximum number of products to look at and the maximum number of products to be displayed ...

You would have to recode them to not have them work in that manner ...

How are you wanting them to display?

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!

21 Dec 2006, 4:53 PM
#3
fbzencart avatar

fbzencart

New Zenner

Join Date:
Jun 2004
Location:
United Kingdom London
Posts:
54
Plugin Contributions:
0

Re: Random Products Display on Homepage

Ajeh:

All of the Centerboxes are based on random display ... which is based on the maximum number of products to look at and the maximum number of products to be displayed ...

You would have to recode them to not have them work in that manner ...

How are you wanting them to display?

I would like the homepage to just display the first five new products at all times

21 Dec 2006, 6:29 PM
#4
fbzencart avatar

fbzencart

New Zenner

Join Date:
Jun 2004
Location:
United Kingdom London
Posts:
54
Plugin Contributions:
0

Re: Random Products Display on Homepage

How do I recode them and what template?

22 Dec 2006, 9:45 AM
#5
fbzencart avatar

fbzencart

New Zenner

Join Date:
Jun 2004
Location:
United Kingdom London
Posts:
54
Plugin Contributions:
0

Re: Random Products Display on Homepage

fbzencart:

How do I recode them and what template?

PLEASE HELP WITH THIS RECODE... I want just new product to display on the homepage at all time and not randomly.

23 Dec 2006, 5:26 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Random Products Display on Homepage

Have you an URL to your site that we can peek at perhaps? It helps to better understand your current display vs what you are trying to accomplish ...

Note: there are settings to set the time period of New Products and settings to select of these New Products how many should be looked at and then settings to set from the New Products found how many should be displayed ...

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!

19 Apr 2007, 7:19 PM
#7
poosk avatar

poosk

Totally Zenned

Join Date:
Mar 2005
Location:
Helsinki
Posts:
477
Plugin Contributions:
0

Re: Random Products Display on Homepage

I was wondering something similar.. I'd need somekind of random product module... I would just need to get four random products (any category,date so on) images and links ofcourse to the product...
I need it to my product display page instead of the customers also bought list.. can I somehow fetch the products from all listing?

2 May 2007, 4:09 PM
#8
cjjune avatar

cjjune

Zen Follower

Join Date:
Apr 2007
Posts:
139
Plugin Contributions:
0

Re: Random Products Display on Homepage

Hi Linda

I too want to disable random display? The disadvantage of random display is that it ALSO display my Gift Certificate.

How do I change this?

Thanks

2 May 2007, 4:46 PM
#9
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Random Products Display on Homepage

If the problem with Random is based on New Products ... check your setting for what New Products are really defined as in the Configuration ... Maximum Values ...

New Product Listing - Limited to ...
Limit the New Product Listing to
0= All Products
1= Current Month
7= 7 Days
14= 14 Days
30= 30 Days
60= 60 Days
90= 90 Days
120= 120 Days

You could then edit the products that you do not want to ever show in there by changing the products_date_added field in the products table to older than your setting ... this can be done via phpMyAdmin ...

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!

2 May 2007, 4:49 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Random Products Display on Homepage

fbzencart:

I would like the homepage to just display the first five new products at all times

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 ...

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;
}

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!

3 May 2007, 2:12 PM
#11
cjjune avatar

cjjune

Zen Follower

Join Date:
Apr 2007
Posts:
139
Plugin Contributions:
0

Re: Random Products Display on Homepage

Great. At least I got the gift certificate removed.:clap: :flex:

6 May 2007, 7:07 AM
#12
battra avatar

battra

New Zenner

Join Date:
May 2007
Posts:
24
Plugin Contributions:
0

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:
$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
$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
$new_products = $db->ExecuteRandomMulti($new_products_query, MAX_DISPLAY_NEW_PRODUCTS);
``` to
```php
$new_products = $db->Execute($new_products_query, MAX_DISPLAY_NEW_PRODUCTS);
```3. Scroll down and find this line:
```php
$new_products->MoveNextRandom();
```and change it to
```php
$new_products->MoveNext();

My showcase/gallery using Zen Cart - Summerdew

7 May 2007, 4:16 AM
#13
cjjune avatar

cjjune

Zen Follower

Join Date:
Apr 2007
Posts:
139
Plugin Contributions:
0

Re: Random Products Display on Homepage

Hi Battra,

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

8 May 2007, 6:43 AM
#14
battra avatar

battra

New Zenner

Join Date:
May 2007
Posts:
24
Plugin Contributions:
0

Re: Random Products Display on Homepage

My Zen cart is still at my local PC :laugh: 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.

My showcase/gallery using Zen Cart - Summerdew

16 May 2007, 6:01 AM
#15
meltdown avatar

meltdown

Totally Zenned

Join Date:
Jun 2006
Location:
My family and I live in Brighton, England
Posts:
947
Plugin Contributions:
0

Re: Random Products Display on Homepage

Ajeh:

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 ...

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](http://www.beadedlily.com/shop/) 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.