user500665 user500665 - 10 months ago 231
Smarty Question

CS-Cart feature values on the list pages

In CS-Cart how can I get separate feature values in the list views?
In the detail view you can get any feature that is available by doing something like this:

{$product.header_features.1.value}


But in the list views it seems the only way to get features is like this:

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


Which results in a comma separated list wrapped in a div. If the feature is a number it means you end up with a meaningless list of numbers without labels.

Is there any way to have each feature available to the template, so I can add icons before each?

Answer Source

With much investigation I finally found that the line:

{assign var="product_features" value="product_features_`$obj_id`"}

is getting it's information from the file templates/common/product_data.tpl

Looking at that file clearly shows it get features from the file views/products/components/product_features_short_list.tpl

Then to identify each feature all I needed to do was add a wrap in the foreach like this:

<span class="grid-feature feature_{$feature.description|lower|replace:' ':'-' nofilter}"></span>

and CSS can do the rest.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download