Announcement

Collapse
No announcement yet.

Truncated full description in search and filtering

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

    Truncated full description in search and filtering

    Hi does anyone know if it is possible to have the truncated description code from the AUG "Only Displaying the First Ten Words of the Full Description " to be applied in the Search and filter results?

    Or if there is a better way to achieve this.

    Code:
    <actinic:block php="true" >
    $sShort = "";
    $nCount = 0;
    $sOriginal = '<actinic:variable encoding="perl" name="ProductDescription"
    selectable="false" />';
    foreach(explode(" ", $sOriginal) as $sWord)
     {
     if ($nCount > 10)
     {
     $sShort .= "...";
     break;
     }
     $sShort .= $sWord . " "; 
    Advanced Users Guide - 58
     $nCount++;
     }
    echo $sShort;
    </actinic:block>

    #2
    The above code is for when static HTML pages (like the Product Page) are being generated.

    Search and Filter results are generated dynamically via Perl scripts from data held on the server.
    So the above code won't work there.

    Possible solutions:

    Use jQuery to truncate the text that is shown after each product loads. See https://www.jqueryscript.net/tags.ph...%20Truncating/ for some possible ways.

    Use CSS to limit the size of the area that displays the description.

    Use CSS to limit the size of the area that displays the description but add a vertical scrollbar to get at all the text.
    Norman - www.drillpine.biz
    Edinburgh, U K / Bitez, Turkey

    Comment


      #3
      Thank you Norman, thanks for pointing me in the right direction. I'll try it on a demo site! A little bit to wade through there. Main issue seems to be that I would want the Read More text to go to the main product rather than just show all the Product text as we still have not got Add to Basket on filtered results.

      Comment

      Working...
      X