MEG Venture Posted December 18, 2012 Share Posted December 18, 2012 (edited) Hi I am trying to build a new module and to do that I use the below php function to call product variables. function hookHome($params) { global $smarty, $cookie; $limit = (int)Configuration::get('VIDEO_PRODUCTS_NBR'); $videoProducts = Product::getProducts((int)$params['cookie']->id_lang, 0, ($limit ? $limit : 10), 'id_product', 'ASC', false, false); $videoProducts = Product::getProductsProperties((int)$params['cookie']->id_lang, $videoProducts); if ($videoProducts) { shuffle($videoProducts); } if ($videoProducts) foreach ($videoProducts AS $videoProduct) $video_products[] = $videoProduct; $smarty->assign('video_products', $video_products); } However, when I try to call image urls, some of them is with correct id_mage, but some of them is has id_image variable returns having "en-default". That's why, image is not displayed. Here is the code I use to call image links: <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home')}" alt="{$product.name|escape:html:'UTF-8'}" /> If anyone can help me to fix this problem, I'll appreciate a lot. P.S: My environment is Prestashaop 1.4.x but I am having the same issue on 1.5.x, too. UPDATE: SOLVED WITH A WORKAROUND. Edited December 19, 2012 by MEG Venture (see edit history) Link to comment Share on other sites More sharing options...
svierkant Posted November 6, 2013 Share Posted November 6, 2013 Can you post your solution/workaround? I'm facing the same problem. Link to comment Share on other sites More sharing options...
MEG Venture Posted November 7, 2013 Author Share Posted November 7, 2013 Hi I used the products assigned to the home category like the homefeatured products module. Here is my code for Prestashop 1.5.x function hookDisplayHome($params) { global $smarty; $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $limit = (int)(Configuration::get('VIDEO_PRODUCTS_NBR')); $video_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($limit ? $limit : 10)); $this->smarty->assign(array( 'video_products' => $video_products, 'homeSize' => Image::getSize('home_default'), )); return $this->display(__FILE__, 'productvideoslider.tpl'); } and on the tpl <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /> I hope that helps you. 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