Random Display of Banners in Zen Cart Banner Box
Monday, July 21st, 2008Zen Cart’s “Banner Box All” sidebox is a great way to generate some extra income for your site by selling advertising or displaying affiliate banners. However, by default, the banners are displayed by their sort order.
I like to display the banners randomly. I’ve found that this 1. cuts down on “ad fatigue” and 2. enables you to ensure prospective clients their ads will be randomly placed and gives each advertiser and equal chance of their banners being displayed at the top.
To achieve a random order of banners in the sidebox:
1. Open includes/templates/template_default/sideboxes/tpl_banner_box_all.php and find:
$sql = “select banners_id from ” . TABLE_BANNERS . ” where status = 1 ” . $new_banner_search . $my_banner_filter . ” order by banners_sort_order”;
$banners_all = $db->Execute($sql);
2. Change to:
$sql = “select banners_id from ” . TABLE_BANNERS . ” where status = 1 ” . $new_banner_search . $my_banner_filter . ” order by RAND()”;
$banners_all = $db->Execute($sql);
3. Save and upload the file to: includes/templates/YOUR_CUSTOM_TEMPLATE/sideboxes/
Easy fix!
