Jump to content

[Solved] Short and full description on product-list page, how?


Recommended Posts

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

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 by Kerm (see edit history)
Link to comment
Share on other sites

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 by shokinro (see edit history)
  • Like 1
Link to comment
Share on other sites

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

(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

  • Like 1
Link to comment
Share on other sites

×
×
  • Create New...