Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Change description trim

    Hi helpers!

    I want to change the truncate function on the descriptions in the category pages. Instead of stripping after a certain amount of characters and taking out all html.

    I want the function to simply trim everything after the first <br /> tag. Can this be done?

    Many thanks,
    Daniel

  2. #2
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Change description trim

    It could theoretically be done, but would be dangerous. It would absolutely require perfection in your description writing, making sure that no HTML tags are ever opened before the <br /> and closed after it.

  3. #3
    Join Date
    Dec 2011
    Posts
    287
    Plugin Contributions
    0

    Default Re: Change description trim

    Hi!

    I have just gone over my entire product list and redone all the descriptions so that they are all the same,

    the reason I was wanting to do this is that I wanted the first line from my description of the product to show in the shopping cart. I managed to do this by using

    PHP Code:
    <?php if (zen_products_lookup($product['id'], 'products_type')==5){ 
                  echo 
    strstr(zen_products_lookup($product['id'], 'products_description'), 'Size'true);
                  
                  }
    ?>
    The if statement is to make sure that it is only the product type of "5" that this happens to,
    Then the second bit takes the description and trims anything off after the word "size" and including size.

    I think this should work perfectly as I have made sure all my descriptions are perfect.

    It looks like it works too!

  4. #4
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: Change description trim

    Sounds like a good way to get the result you wanted.

 

 

Similar Threads

  1. Warning: trim() expects parameter 1 to be string, array given
    By jpietrowiak in forum General Questions
    Replies: 2
    Last Post: 8 Jun 2013, 07:06 PM
  2. PHP to trim first few words?
    By whitsolltd in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 2 Feb 2013, 10:20 AM
  3. Trim Order History
    By DogTags in forum Managing Customers and Orders
    Replies: 0
    Last Post: 25 Sep 2008, 03:33 PM
  4. Sidebox Trim Color
    By burelphotography in forum Basic Configuration
    Replies: 4
    Last Post: 11 Mar 2008, 01:29 PM
  5. Improved Trim e-mail archive..
    By reza in forum Customization from the Admin
    Replies: 1
    Last Post: 8 May 2007, 08:45 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg