Jump to content

Limit search display


Recommended Posts

Hi all,

I've got a problem using presta shop core module "search"

After clicking search button, it displays products according to my keyword

But I want to limit the display name of each product to 10 and replace the rest with "...."

Because if the name is too long, the container block takes more spaces than other....

 

Can you guys help me where to change this condition???

I don't know the whole structure of prestashop module.....

Link to comment
Share on other sites

Guest aritali

Ok, this is how the search works. It actually loads your product-list.tpl. So if you wanted to have a different search than your product list page you would need to copy your product-list.tpl file and name it something new, like product_searches.tpl.

 

Then open your search.tpl and look for this line,

{include file="$tpl_dir./product-list.tpl" products=$search_products}

 

Change that file to your new products_searches.tpl name. Now open the product_searches.tpl and look for this line.

<h3>{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>

 

Where it says truncate:35'... that is how many characters it will display before it displays the 3 periods. Just change that to 10.

Link to comment
Share on other sites

Ok, this is how the search works. It actually loads your product-list.tpl. So if you wanted to have a different search than your product list page you would need to copy your product-list.tpl file and name it something new, like product_searches.tpl.

 

Then open your search.tpl and look for this line,

{include file="$tpl_dir./product-list.tpl" products=$search_products}

 

Change that file to your new products_searches.tpl name. Now open the product_searches.tpl and look for this line.

<h3>{if isset($product.new) && $product.new == 1}<span class="new">{l s='New'}</span>{/if}<a href="{$product.link|escape:'htmlall':'UTF-8'}" title="{$product.name|escape:'htmlall':'UTF-8'}">{$product.name|truncate:35:'...'|escape:'htmlall':'UTF-8'}</a></h3>

 

Where it says truncate:35'... that is how many characters it will display before it displays the 3 periods. Just change that to 10.

it works.....

thanks man....

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...