Jump to content

[SOLVED] Including a feature in search listing results "title"


Recommended Posts

We have Part No. as one of the features.

We'd like our search listings to show this feature as well as the manufacturer name, i.e.

Here is how one part shows in the search results listing:

108V-14-Hex-Drill-and-Impact-Dri...
10.8 Volt 1/4" Hex Drill, Impact Driver and Light Kit



Here is how it shows when you view the product:

MAKLCT302W - Makita - 108V-14-Hex-Drill-and-Impact-Driver-Light-Kit



We'd also like to provide the Part No and manufacturer in the list in the
search results but I can't find a way to do that.

The product.tpl has this code:

{if $features.0.name eq "Part No."}{$features.0.value} -{/if} {$product_manufacturer->name|escape:'htmlall':'UTF-8'} - {$product->name|escape:'htmlall':'UTF-8'}



The product-list.tpl has this code:

{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}



Now, when I place "similar" code in product-list.tpl:

{if $product.features.0.name eq "Part No."}{$product.features.0.value} -{/if} {$product.manufacturer_name|escape:'htmlall':'UTF-8'} - {$product.name|escape:'htmlall':'UTF-8'}



I get this:

MAKLCT302W - Makita - 108V-14-Hex-Drill-and-Impact-Driver-Light-Kit



I also want to truncate the value to 50 chars so it shows like this:

MAKLCT302W - Makita - 108V-14-Hex-Drill-and-Imp...


but I have been unable to do that.

How would I concatenate the values into one variable and truncate it?

Link to comment
Share on other sites

Even though I thought I already tried it with no success, capture works brilliantly,
plus, I only had to truncate the product_name:

{capture name=full_product}
{if $product.features.0.name eq "Part No."}{$product.features.0.value|trim} - {/if} {$product.manufacturer_name|trim|escape:'htmlall':'UTF-8'} - {$product.name|truncate:30:'...'|escape:'htmlall':'UTF-8'}
{/capture}

{$smarty.capture.full_product}

Link to comment
Share on other sites

  • 7 months later...
×
×
  • Create New...