Kerm Posted September 7, 2012 Share Posted September 7, 2012 (edited) Hello i need short and full description on product-list page, but how? I try put this code in product-list.tpl: {if $product->description} <!-- full description --> {$product->description} </div> {/if} But this dont work... Edited September 11, 2012 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
nadie Posted September 7, 2012 Share Posted September 7, 2012 Hello i need short and full description on product-list page, but how? I try put this code in product-list.tpl: {if $product->description} <!-- full description --> {$product->description} </div> {/if} But this dont work... In product-list.tpl: Full Description {$product.description} Short Description {$product.description_short} Sorry for my English Link to comment Share on other sites More sharing options...
Kerm Posted September 7, 2012 Author Share Posted September 7, 2012 U try it? Link to comment Share on other sites More sharing options...
Kerm Posted September 7, 2012 Author Share Posted September 7, 2012 (edited) I have this error: Notice: Trying to get property of non-object in /var/www/site/tools/smarty/compile/41e4065787232fdf6dec07f208825cc0d4606688.file.product-list.tpl.phpon line 102 I also try: <div id="{$product.name|truncate:5:''|strip_tags:'UTF-8'}"></div> <script> $(document).ready(function(){ $('div#{$product.name|truncate:5:''|strip_tags:'UTF-8'}').load('{$product.link|escape:'htmlall':'UTF-8'} p#bdesc'); }); </script> But page load alot of time and if product have name like "AGP 281202, AGP 281203, AGP 281203 i have same description...more truncate cant do bc have products with short name... Edited September 7, 2012 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
shokinro Posted September 9, 2012 Share Posted September 9, 2012 (edited) nadie 's code will work only when the description is loaded from database. The error occurs if the description data is not loaded from database. But it should no problem on Category page, because the description field is included I guess the error is occurring at Search result page? Because I checked the SQL, it does not include the description $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT DISTINCT p.*, pl.`description_short`, pl.`link_rewrite`, pl.`name`, tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 new FROM `'._DB_PREFIX_.'product` p Edited September 9, 2012 by shokinro (see edit history) 1 Link to comment Share on other sites More sharing options...
Kerm Posted September 9, 2012 Author Share Posted September 9, 2012 Nope, have 1.4.9.0 installed, standard theme, put {$product->description} in product-list.tpl and got this error on product list page: Notice: Trying to get property of non-object in /var/www/site/tools/smarty/compile/41e4065787232fdf6dec07f208825cc0d4606688.file.product-list.tpl.phpon line 102 Link to comment Share on other sites More sharing options...
nadie Posted September 9, 2012 Share Posted September 9, 2012 (I've only tested with Prestashop 1.4) I've tried many times, and if you add in the product-list.tpl: {$product.description} will print the full product description in the listings correctly Nope, have 1.4.9.0 installed, standard theme, put {$product->description} in product-list.tpl and got this error on product list page: Notice: Trying to get property of non-object in /var/www/site/tools/smarty/compile/41e4065787232fdf6dec07f208825cc0d4606688.file.product-list.tpl.phpon line 102 In product-list.tpl {$product.description} You have inserted: {$product->description} But in the file "product-list.tpl", must be: {$product.description} Sorry for my English 1 Link to comment Share on other sites More sharing options...
shokinro Posted September 9, 2012 Share Posted September 9, 2012 I also confirmed {$product.description} works fine at category page without any problem at PrestaShop 1.4.9. Link to comment Share on other sites More sharing options...
Kerm Posted September 10, 2012 Author Share Posted September 10, 2012 (edited) Thx!!! I will try, don't look on dot in ur example :S All ok, thx! Edited September 11, 2012 by Kerm (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts