Announcement

Collapse
No announcement yet.

Displaying limited words for Filter / Search Result Product Name

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Displaying limited words for Filter / Search Result Product Name

    Hi there,
    I'm developing a site for a client at the moment who have long product names. I've tried to be clever and use the advanced user guide instructions to try and display the first 6 words of the search result product name however the PHP isn't recognised and the full name appears. I have the following code within my search result template:

    Code:
    <actinic:block if="%3cactinic%3avariable%20name%3d%22SearchResultShowsName%22%20%2f%3e">
    <h3 class="product-name"><script type="text/template"><Actinic:Variable Name="SearchResultLink"/><actinic:block php="true" >
    $sShort = "";
    $nCount = 0;
    $sOriginal = '<actinic:variable encoding="perl" name="SearchResultProductName" selectable="false" />';
    foreach(explode(" ", $sOriginal) as $sWord)
    {
    if ($nCount > 6)
    {
    $sShort .= "...";
    break;
    }
    $sShort .= $sWord . " ";
    $nCount++;
    }
    echo $sShort;
    </actinic:block></a></script></h3>
    </actinic:block>

    Do I have to add anything else in order for this PHP to kick in?

    Any help is, as always, greatly appreciated.
    Regards.

    Lee Jackson
    Creative Director

    Centurius Design & Marketing
    Centurius Website
    Portfolio of Work

    #2
    SellerDeck's built-in PHP is only of use when building static HTML pages.

    The search results are dynamically generted by Perl scripts so you'd need to patch the Perl (probably SearchScript.pl) or use JavaScript to process the names and snip bits off after the page is loaded.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Hi Norman,
      Thanks for your response. I'll take a look into your suggestions. Fingers crossed I get something sorted.
      Regards.

      Lee Jackson
      Creative Director

      Centurius Design & Marketing
      Centurius Website
      Portfolio of Work

      Comment


        #4
        Try http://viralpatel.net/blogs/dynamica...e-link-jquery/
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment

        Working...
        X