Add Prodcut Description to Product Scroller

I’m using a Product Scroller on my homepage and would like to include the product description in with the displayed information.



Within the blocks/products_scroller.tpl you can see that it is including simple_list.tpl :

{include file="blocks/list_templates/simple_list.tpl" product=$product show_trunc_name=true show_price=true show_add_to_cart=$_show_add_to_cart but_role="text" }
```<br />
<br />
and within simple_list.tpl you can see that there is an option to display the prodcut description:<br />
```php
{if $show_features || $show_descr}<br />
<p class="product-descr"><strong>{assign var="product_features" value="product_features_`$obj_id`"}{$smarty.capture.$product_features}</strong>{assign var="prod_descr" value="prod_descr_'$obj_id'"}{$smarty.capture.$prod_descr}</p><br />
{/if}
```<br />
<br />
so I have changed the options that are passed when including simple_list.tpl to this:<br />
```php
{include file="blocks/list_templates/simple_list.tpl" product=$product show_name=true show_price=true show_descr=true }
```<br />
which successfully triggers ```php
{if $show_features || $show_descr}
``` which I have verified by typing some text within the IF block, but it unfortuantely does not actually display the product description.<br />
<br />
Specifically I would prefer to display the Short Description, and have tried variations of ```php
{$product.full_description|default:$product.short_description|unescape}
``` with no luck.<br />
<br />
Any ideas as to how to get this to actually display the Product Description?<br />
<br />
Thanks in advance for any and all help, it is greatly appreciated.

It looks like (from your snip) that $show_desc is really an alias of show_features.

You would have to adjust that part of the template to use the template variable you’ve defined.



I would add a {debug} tag below that if statement and see what data is being passed into the template.

show_desc is not an alias of show_features



show_desc is supposed to display the product description ( short if it exists, else full description )

and show_features displays the products features





Here’s the path that things are taking:



The [COLOR=“Blue”]products_scroller.tpl[/COLOR] file loads [COLOR=“Blue”]simple_list.tpl[/COLOR] via:

[COLOR=“Green”]{include file=“blocks/list_templates/simple_list.tpl” product=$product show_name=true show_descr=true show_price=true }[/COLOR]



[COLOR=“Blue”]simple_list.tpl[/COLOR] loads the [COLOR=“Blue”]product_data.tpl[/COLOR] file via:

[COLOR=“Green”]{include file=“common_templates/product_data.tpl” obj_id=$obj_id product=$product}[/COLOR] which is supposed to grab the product description here:


{capture name="prod_descr_`$obj_id`"}
{if $show_descr}
{if $product.short_description}
{$product.short_description|unescape}
{else}
{$product.full_description|unescape|strip_tags|truncate:160}{if !$hide_links && $product.full_description|strlen > 180} {$lang.more}{/if}
{/if}
{/if}
{/capture}






which should then get utilized by [COLOR=“Blue”]simple_list.tpl[/COLOR] here:

```php {if $show_features || $show_descr}


{assign var="prod_descr" value="prod_descr_`$obj_id`"}{$smarty.capture.$prod_descr}
{assign var="product_features" value="product_features_`$obj_id`"}{$smarty.capture.$product_features}


{/if} ```


Now...

if I add [COLOR="Green"]{$product|print_r}[/COLOR] (does the same thing as {debug} except I can zero in on exactly what I want) to any of those files, it prints out the product data that is being passed to these files. This data does not contain either the short or full description for the product, likewise it also does not contain the product features.

However, if I toggle the display of the product features within [COLOR="Blue"]products_scroller.tpl[/COLOR] by adding [COLOR="Green"]show_features=true[/COLOR] when including [COLOR="Blue"]simple_list.tpl[/COLOR] like so:
[COLOR="Green"]{include file="blocks/list_templates/simple_list.tpl" product=$product show_name=true show_features=true show_descr=true show_price=true }[/COLOR]
then it will correctly display the product features within the scroller, YET, the product features do not show up within the product data array as displayed by [COLOR="Green"]{$product|print_r}[/COLOR].

So even though the product description is not being passed within the product array, it seems like it should still be displayed in the same manner that the product features are.

I'm wondering if they have changed one of the functions that retreives the product description, but failed to update a necessary file somewhere else.

You could modify the block code that retrieves the product data and have it include the descriptions I’m guessing that wherever the call to get_product_data() is, that the parameter for $get_descriptions is false.

Hello Brent,

I have a similar problem. I added a product feature and it blocks the product “full” description from being displayed. But the short description can be seen. If you found a solution for your problem would you share it?



I am using v 2.2.4.



THank you,

Jay

found this in later versions of cs-cart 4+



{“$product.meta_description”}

by using the array of product, you can display the meta_description.

I added

{$product.short_description nofilter}
and that pulls in the short description