chrilisa Posted May 12, 2010 Share Posted May 12, 2010 the specials block only can dispaly one product,how to make it display more Link to comment Share on other sites More sharing options...
rocky Posted May 12, 2010 Share Posted May 12, 2010 See my post here. Link to comment Share on other sites More sharing options...
chrilisa Posted May 12, 2010 Author Share Posted May 12, 2010 it work for 1.25 as what rocky said,Here is how I would do it. Rewrite the getRandomSpecial function to return more than one row as follows (change LIMIT 2 to how many specials you want): static public function getRandomSpecial($id_lang, $beginning = false, $ending = false) { global $link, $cookie; $currentDate = date('Y-m-d'); $result = Db::getInstance()->ExecuteS(' SELECT p.*, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, i.`id_image`, il.`legend`, t.`rate` FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1) LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'tax` t ON t.`id_tax` = p.`id_tax` WHERE (`reduction_price` > 0 OR `reduction_percent` > 0) '.((!$beginning AND !$ending) ? 'AND (`reduction_from` = `reduction_to` OR (`reduction_from` <= \''.$currentDate.'\' AND `reduction_to` >= \''.$currentDate.'\'))' : ($beginning ? 'AND `reduction_from` <= \''.$beginning.'\'' : '').($ending ? 'AND `reduction_to` >= \''.$ending.'\'' : '')).' AND p.`active` = 1 ORDER BY RAND() LIMIT 2'); if (!$result) return false; foreach ($result AS $row) $rows[] = Product::getProductProperties($id_lang, $row); return $rows; } Change the hookRightColumn function of modules/blockspecials/blockspecials.php to: function hookRightColumn($params) { global $smarty; if ($specials = Product::getRandomSpecial(intval($params['cookie']->id_lang))) $smarty->assign(array( 'specials' => $specials )); return $this->display(__FILE__, 'blockspecials.tpl'); } Replace modules/blockspecials/blockspecials.tpl with: <!-- MODULE Block specials --> {l s='Specials' mod='blockspecials'} {if $specials} {foreach from=$specials item=special name=products} {$special.name|escape:htmlall:'UTF-8'} {displayWtPrice p=$special.price_without_reduction} {if $special.reduction_percent}(-{$special.reduction_percent}%){/if} {displayWtPrice p=$special.price} {/foreach} {l s='All specials' mod='blockspecials'} {else} {l s='No specials at this time' mod='blockspecials'} {/if} <!-- /MODULE Block specials --> then rewrite the theme global.css (about 1175) /* Block specials */ .blockspecials li { float: left; clear: none; width: 100%; } cheers Link to comment Share on other sites More sharing options...
chrilisa Posted May 13, 2010 Author Share Posted May 13, 2010 oh my godit only word in local test ,when i did it to my website ,i have some wrong about CSS Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now