Page 1 of 2 12 LastLast
Results 1 to 10 of 16
  1. #1
    Join Date
    Mar 2005
    Location
    Helsinki
    Posts
    570
    Plugin Contributions
    0

    Idea or Suggestion cutting product descriptions manually (for listings)

    Okay there's this super handy function in wordpress which strips blog posts on the frontpage, whenever it runs in to <-- more --> command (or something similar)

    Anyway could we make similar thing to zen?

    Basic idea is that we'd add manually some command in the description from the admin and it would strip the product description in product listing pages instead of constant number of characters.

    is there a better way (aka simpler method to our html illiterate people) to make this happen besides using hidden css class in the listing pages?

  2. #2
    Join Date
    Mar 2005
    Location
    Helsinki
    Posts
    570
    Plugin Contributions
    0

    Default Re: cutting product descriptions manually (for listings)

    actually somehow the product listing page doesn't display html at all in the product description?!? so even I'd wrap the text I'd want to leave out into a div it won't display the div at all..

    any idea how to fix this? I'm using grid (column) mod

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

    Default Re: cutting product descriptions manually (for listings)

    See the Customizing Product Description Text Formatting on Category Page thread for a method with minimal coding to make different descriptions on listing and info pages, including enabling HTML in listing pages.

    If you only want to choose the point to truncate the description on the listing page, I believe this would work (not tested yet):

    In /includes/modules/your_template/product_listing.php, find this
    PHP Code:
            case 'PRODUCT_LIST_NAME':
            
    $lc_align '';
            if (isset(
    $_GET['manufacturers_id'])) {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>' ;
            } else {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 'cPath=' $_GET['cPath'] . '&' '') . 'products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
            }
            break; 
    and beginning at "zen_trunc_string" change to this
    PHP Code:
            case 'PRODUCT_LIST_NAME':
            
    $lc_align '';
            if (isset(
    $_GET['manufacturers_id'])) {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' str_replace(strstr(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id'])),"*more*")),"",(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))))) . '</div>' ;
            } else {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 'cPath=' $_GET['cPath'] . '&' '') . 'products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' str_replace(strstr(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id'])),"*more*")),"",(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))))) . '</div>';
            }
            break; 
    This will delete everything after *more* inclusive. It will not truncate the description to the set length if there is no *more*. That could be re-added to the code if desired (making it still more complex!)

    You would then need to remove the *more* from the description in the info page.
    FInd this
    PHP Code:
     <!--bof Product description -->
    <?php if ($products_description != '') { ?>
    <div id="productDescription" class="productGeneral biggerText"><?php echo stripslashes($products_description); ?></div>
    <?php ?>
    <!--eof Product description -->
    and change to this
    PHP Code:
     <!--bof Product description -->
    <?php if ($products_description != '') { ?>
    <div id="productDescription" class="productGeneral biggerText"><?php echo str_replace("*more*","",stripslashes($products_description)); ?></div>
    <?php ?>
    <!--eof Product description -->

  4. #4
    Join Date
    Mar 2005
    Location
    Helsinki
    Posts
    570
    Plugin Contributions
    0

    Default Re: cutting product descriptions manually (for listings)

    ah wonderful many thanks again G

  5. #5
    Join Date
    Mar 2005
    Location
    Helsinki
    Posts
    570
    Plugin Contributions
    0

    Default Re: cutting product descriptions manually (for listings)

    Actually I didnt have time to testi this until yet. I tried the *more* thing but first of all it didn't cut it and second

    Warning: Wrong parameter count for strstr() in /home/public_html/store/includes/modules/classic/product_listing.php on line 154

    Any idea? appreciate your help a lot though. many thanks

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

    Default Re: cutting product descriptions manually (for listings)

    OK... I think there is a misplaced close parenthesis in the code. There should be three before the "*more*" and one after, not two and two.
    PHP Code:
            case 'PRODUCT_LIST_NAME':
            
    $lc_align '';
            if (isset(
    $_GET['manufacturers_id'])) {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), 'products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' str_replace(strstr(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))),"*more*"),"",(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))))) . '</div>' ;
            } else {
              
    $lc_text '<h3 class="itemTitle"><a href="' zen_href_link(zen_get_info_page($listing->fields['products_id']), ($_GET['cPath'] > 'cPath=' $_GET['cPath'] . '&' '') . 'products_id=' $listing->fields['products_id']) . '">' $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' str_replace(strstr(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))),"*more*"),"",(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))))) . '</div>';
            }
            break; 
    Hopefully my bleary eyes are seeing this right. Try it and let me know how it works.

  7. #7
    Join Date
    Mar 2005
    Location
    Helsinki
    Posts
    570
    Plugin Contributions
    0

    Default Re: cutting product descriptions manually (for listings)

    works like a charm. many many thanks!

    an another thing is can this be used for the new listing as well? I tried but really couldn't make sense from the new_listing file since the structure is different

    and apparently new listing page strips all html from description? so I couldn't use div to hide the rest. if *more* can not be applied how can I remove html block?

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

    Default Re: cutting product descriptions manually (for listings)

    All of the listing pages strip HTML from the description, and currently each of them has its own file so each one will have to be edited to change this. Search on zen_clean_html and you should find a description of the process - very simple.

    The *more* code should be applicable to all of the listing pages, but as mentioned the files are different so it will take some rooting around to be sure of the right edit location.

    The centerboxes are very different, and may not include the description at all, so they would be much more involved to modify.

  9. #9
    Join Date
    Mar 2005
    Location
    Helsinki
    Posts
    570
    Plugin Contributions
    0

    Default Re: cutting product descriptions manually (for listings)

    thanks gjh actually figured out everything else but I'm still struggling how to remove *more* text from the new listing. I decided to go with the html so It wont need to cut it but I'd still like to hide the *more* text?

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

    Default Re: cutting product descriptions manually (for listings)

    This is adding another layer of code, but you could wrap the *more* tags in

    <span class="moreMarker">*more*</span>

    and style

    #newProductsDefault .moreMarker {display: none;}

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. truncated product descriptions in new product listings
    By discoverytdi in forum Templates, Stylesheets, Page Layout
    Replies: 15
    Last Post: 30 Jan 2012, 02:47 AM
  2. Replies: 5
    Last Post: 1 Sep 2010, 06:20 PM
  3. Manually enter price for product
    By tkelley66 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 12 Mar 2009, 11:33 PM
  4. How can I get my descriptions in product listings to show hyperlinks I've entered?
    By KiwiBrian in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 20 Sep 2008, 11:10 PM
  5. Descriptions in new product listings - main page
    By brianosc in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 28 Feb 2008, 12:08 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR