You are here:  » Different div for Different category

Support Forum



Different div for Different category

Submitted by technoarenasol on Wed, 2012-10-17 12:01 in

Hi David Can be possible to use Different DIV for Mobiles and Mobile Accessories Category.

I Create two Sub-category of mobile : Mobiles and Mobile Accessories....but problem is product title of mobiles is too short and product title of Mobiles Accessories is too long.

so large gap problem in search grid view result if I give more width size.and vice versa in Mobile Accessories images ...so can be possible to give Different DIV using Any If else statement or other technique.

Submitted by support on Wed, 2012-10-17 13:05

Hi technoarenasol,

Sure, the search results div class is set by the following HTML at line 4 in html/searchresults.php:

<div class='searchresults'>

So to override the class for specific categories; use something like:

<?php
  switch($parts[1])
  {
    case "Mobiles":
      $class = "searchresultsMobiles";
      break;
    case "Mobile Accessories":
      $class = "searchresultsMobileAccessories";
      break;
    default:
      $class = "searchresults";
      break;
  }
?>
<div class='<?php print $class?>'>

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Thu, 2012-10-18 07:57

technoarenasol

Thanx David...I think this trick not good...Best way to display limit character of product tile in search result

If title small display full title and if title long display limited character with ..... symbol

like this

Nokia asha 302 (full title display )
Nokia asha 302 Mobile Phone Screen... (Long title display with ... )

I try

<?php
 
print substr($product["name"],0,40); 
?>
but this trick apply on all title and not display "..."

Submitted by support on Thu, 2012-10-18 08:02

Hi Tony,

You can use Price Tapestry's built-in tidy substring function which breaks on a word boundary (first SPACE after the limit) and appends ... if the string is longer - have a go with:

  print tapestry_substr($product["name"],40,"...");

Cheers,
David.
--
PriceTapestry.com

Submitted by technoarenasol on Thu, 2012-10-18 08:06

technoarenasol

Ok David.Thank you