hurrican3 Posted May 17, 2011 Share Posted May 17, 2011 Hi there, i have been looking to the related posts on the forum but could not find a solution yet.Simply, i have duplicated blockbestsellers module and create new one to display all images/products in a specific category and hooked on the top of footer block.new block works good so far, but the prices is displayed incorrect. All the decimals are rounded to 00.For example the price must be 14,90 but it seems 14,00. or instead of 19.50 price seems as 19.00here u can see the php and tpl files i have changed so far, i would be appreciated if u could fix that problem. p.s. version 1.3.1 <?php class Tumfirsatlar extends Module { private $_html = ''; private $_postErrors = array(); function __construct() { $this->name = 'tumfirsatlar'; $this->tab = 'Blocks'; $this->version = '1.1'; parent::__construct(); $this->displayName = $this->l('Tum firsatlar'); $this->description = $this->l('Tum urunler'); } public function install() { if (!parent::install() OR !$this->registerHook('topoffooter') OR !$this->registerHook('updateOrderStatus') OR !ProductSale::fillProductSales()) return false; return true; } function hookRightColumn($params) { global $smarty; $currency = new Currency(intval($params['cookie']->id_currency)); $category = new Category(5, intval($params['cookie']->id_lang)); $products = $category->getProducts(intval($params['cookie']->id_lang), 1, 1, 'position', 'ASC', false, true, true, 18); $smarty->assign('products', $products); $best_sellers = array(); foreach ($products AS $bestseller) { $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic(intval($bestseller['id_product'])), $currency); $best_sellers[] = $bestseller; } $smarty->assign(array( 'best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'tumfirsatlar.tpl'); } function hookLeftColumn($params) { return $this->hookRightColumn($params); } function hooktopoffooter($params) { return $this->hookRightColumn($params); } } ?> tpl file <!-- MODULE Block best sellers --> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type"> </head> {if $best_sellers|@count > 0} {foreach from=$best_sellers item=product name=myLoop} getImageLink($product.link_rewrite, $product.id_image, 'medium')}" height="{$mediumSize.height}" width="{$mediumSize.width}" alt="{$product.legend}" /> {$product.name|truncate:50:'...'|escape:'htmlall':'UTF-8'} {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} {t text=$bestseller.description_short length='50' strip='true' encode='true'} {/foreach} {else} {l s='No best sellers at this time' mod='tumfirsatlar'} {/if} <!-- /MODULE Block best sellers --> thanks for your interest. Link to comment Share on other sites More sharing options...
hurrican3 Posted May 18, 2011 Author Share Posted May 18, 2011 Has anyone got an idea how to fix that problem? i am so stucked! 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