View Full Version : Rotate Hotpicks??
Can not for the life of me find out how to rotate the hotpicks on every page refresh as in SW V1 tried lots of oHotPicksParams but without success. Any help please.
Top of my head:
you could assign each hotpick into an array, shuffle() (or whatever) and set it back as the original object. I seem to remember having a handy array to object function kicking about which would handle it. Ill be back...........
Yeah, here-ya:
function array_to_obj($array, &$obj){
foreach ($array as $key => $value){
if (is_array($value)){
$obj->$key = new stdClass();
array_to_obj($value, $obj->$key);
} else {
$obj->$key = $value;
}
}
return $obj;
}
function obj_to_array($object) {
$array = array();
if (is_object($object)) {
$array = get_object_vars($object);
}
return $array;
}
stick em somewhere accessible (I have a seperate "Handy functions" file included in my constants.inc)
usage:
$aNewArray = obj_to_array($YOUROBJECT);
shuffle($aNewArray);
$oNewObject= new stdClass();
array_to_obj($aNewArray,$oNewObject);
$YOUROBJECT = $oNewObject
Top of the head though, you'll have to play around alittle
You could try order by "random" on the hotpick parameters. This worked in V1 but random sort was taken out of V2 and has now been reintroduced for V3.
Thank you both. It would be lovely to be able to test these methods but unfortunately my quota is running out so fast I am unable to test as yet. My Quota updates at 5pm and is back to 0 at around 5.05pm, so I have a blank site after maybe 5-6 page views. I will have to wait and see tonight at 5pm to see if the quota problems have been resolved. :(
I'm having big quota issues too. I was under the impression that I was the only one. George and the dev guys are looking into it hopefully.
Out of interest how much does you quota drop per page load? Are we talking hundreds?