salomonsson Posted July 4, 2013 Share Posted July 4, 2013 Hi! I tride to creat a loop, but it doesn't work. Can anyone please help me to see what's wrong? <!-- MODULE Block specials --> <div id="special_block_right" class="block products_block exclusive blockspecials"> <h4><a href="{$link->getPageLink('prices-drop.php')}" title="{l s='Specials' mod='blockspecials'}">{l s='Specials' mod='blockspecials'}</a></h4> <div class="block_content"> {if $special !== false} <ul class="products clearfix"> {foreach from=$special item='product' name='specialProducts'} {if $smarty.foreach.specialProducts.index < 2} <li class="product_image"> <a href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'medium')}" alt="{$special.legend|escape:html:'UTF-8'}" height="{$mediumSize.height}" width="{$mediumSize.width}" title="{$special.name|escape:html:'UTF-8'}" /></a> </li> <li> <h5><a href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.name|escape:html:'UTF-8'}</a></h5> <span class="price-discount">{if !$priceDisplay}{displayWtPrice p=$special.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if}</span> {if $special.specific_prices} {assign var='specific_prices' value=$special.specific_prices} {if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))} <span class="reduction">(-{$specific_prices.reduction*100|floatval}%)</span> {/if} {/if} <span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span> </li> {/if} {/foreach} </ul> <p> <a href="{$link->getPageLink('prices-drop.php')}" title="{l s='All specials' mod='blockspecials'}" class="button_large">{l s='All specials' mod='blockspecials'}</a> </p> {else} <p>{l s='No specials at this time' mod='blockspecials'}</p> {/if} </div> </div> <!-- /MODULE Block specials --> Thanks in advance Link to comment Share on other sites More sharing options...
vekia Posted July 4, 2013 Share Posted July 4, 2013 sorry to bother you but i don't know what you exactly expect, so please clarify it a bit regards Link to comment Share on other sites More sharing options...
salomonsson Posted July 4, 2013 Author Share Posted July 4, 2013 Thank you for reply. Well, there's module called "blockspecials" which shows special products in the shop. When hook it to the left or right column, it shows only one product. I would like that it can show more than one products like the new products module. I hope that this explain what I mean. Link to comment Share on other sites More sharing options...
Valérie Assetskaya Posted July 5, 2013 Share Posted July 5, 2013 Hi, In Product::getRandomSpecial the line responsible for data is $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql); returns one inscription by default. It is necessary to use ->executeS($sql); instead of getRow and changes need to be taken into consideration in the code below. Best regards. Link to comment Share on other sites More sharing options...
salomonsson Posted July 5, 2013 Author Share Posted July 5, 2013 (edited) Hi, Thanks a lot. But i didn't find the lines you mentioned in my blockspecials.php. The lines seems to be involved are: if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); return $this->display(__FILE__, 'blockspecials.tpl'); Best regards Salomonsson Edited July 5, 2013 by salomonsson (see edit history) Link to comment Share on other sites More sharing options...
safa Posted July 5, 2013 Share Posted July 5, 2013 plese look this post. i think should be work http://www.prestashop.com/forums/index.php?/topic/117765-quick-tutorial-how-to-add-multiple-specials-to-specials-block/page__view__findpost__p__582775 Link to comment Share on other sites More sharing options...
Recommended Posts