You are here:  » Random featuredExternal

Support Forum



Random featuredExternal

Submitted by jonny5 on Sun, 2011-11-27 17:10 in

Hi david i have my featuredExternal set to randomly select a merchant then display 20 items from that merchant.

I want to change it back on one site so it just shows 20 random products from all the different merchants, can you please help as im stuck.

cheers

Submitted by support on Sun, 2011-11-27 17:48

Hi Jonny,

If you could post your current version (i'll remove the code from your reply) I'll describe the changes for you - should be a straight forward case of just removing the first query to select the random merchant..

Cheers,
David.
--
PriceTapestry.com

Submitted by jonny5 on Sun, 2011-11-27 17:56

{code saved}

Submitted by support on Sun, 2011-11-27 18:08

Thanks Jonny;

Where you have:

$sql = "SELECT merchant FROM `".$config_databaseTablePrefix."feeds` ORDER BY RAND() LIMIT 1";
database_querySelect($sql,$result);
$merchant = $result[0]["merchant"];
$sql = "SELECT name,1 AS sequence FROM `".$config_databaseTablePrefix."products` WHERE merchant='".database_safe($merchant)."' ORDER BY RAND() LIMIT 30";

...REPLACE with just:

$sql = "SELECT name,1 AS sequence FROM `".$config_databaseTablePrefix."products` ORDER BY RAND() LIMIT 30";

Cheers,
David.
--
PriceTapestry.com

Submitted by jonny5 on Sun, 2011-11-27 18:21

cheers