Page 1 of 3 123 LastLast
Results 1 to 10 of 30
  1. #1
    Join Date
    Jun 2007
    Posts
    44
    Plugin Contributions
    0

    Default adding description to new or featured products

    Has anyone been able to add product descriptions to new or featured products?

    Both new and featured pull from a db table that doesn't include a description.

    Note: It would seem logical that tpl_modules_whats_new.php could be overwritten by tpl_products_new_default.php (which includes descriptions), BUT that does not work for the front page - it can't find the products.

  2. #2
    Join Date
    Jun 2007
    Posts
    44
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    More info...

    In modules/featured_products.php, there is this line:

    left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id), " .

    So I think it's pulling from the table that holds product descriptions.

    But how do I add it to the 'text' => etc ?
    I tried adding: $featured_products->fields['products_description']
    but nothing appears.

  3. #3
    Join Date
    Jun 2007
    Posts
    44
    Plugin Contributions
    0

    Default Solution

    Solution add pd.products_description to the query, like so:

    $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, pd.products_description

  4. #4
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    163
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    I am trying to do this too, can you give me a little more detail?

    Thanks!


    here's what i have...

    Code:
    if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
      $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, pd.products_description
                               from (" . TABLE_PRODUCTS . " p
                               left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                               left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id )
                               where p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
    } else {
      $featured_products_query = "select distinct p.products_id, p.products_image, pd.products_name, pd.products_description
                               from (" . TABLE_PRODUCTS . " p
                               left join " . TABLE_FEATURED . " f on p.products_id = f.products_id
                               left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id), " .
      TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " .
      TABLE_CATEGORIES . " c
                               where p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" . (int)$featured_products_category_id . "'
                               and p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'";
    
    }

  5. #5
    Join Date
    Jun 2007
    Posts
    44
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    It looks like you are pulling the products_description from the database, so now you need to display it... ?


    This helped me a lot.
    http://www.kirkhamsystems.com/zencart_layout_changes
    I think what you want is in the second code box in that article.

  6. #6
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    163
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    Quote Originally Posted by winky3d View Post
    It looks like you are pulling the products_description from the database, so now you need to display it... ?


    This helped me a lot.
    http://www.kirkhamsystems.com/zencart_layout_changes
    I think what you want is in the second code box in that article.
    yes, its not displaying. look at my cart. no description for the featured product (daily spectacular).

  7. #7
    Join Date
    Aug 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    Ok thanks for the tip i was half way (the other half!)

    Here is the solution after adding the sql query you need to add the line

    PHP Code:
    $featured_products->fields['products_description'
    where you want the description to show.

    This is my file for your perusal.

    Hope it helps, seems to be working for me.

    Oh and strip out all those nasty <br /> tags and wrap the price, name etc in tags so you can control them, dont know why they still keep those nasty breaks in zen cart!

    PHP Code:
    <?php
    /**
     * featured_products module - prepares content for display
     *
     * @package modules
     * @copyright Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     * @version $Id: featured_products.php 4629 2006-09-28 15:29:18Z ajeh $
     */
    if (!defined('IS_ADMIN_FLAG')) {
      die(
    'Illegal Access');
    }
    if ( (!isset(
    $new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $featured_products_query "select distinct p.products_id, p.products_image, pd.products_name, pd.products_description
                               from (" 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_FEATURED " f on p.products_id = f.products_id
                               left join " 
    TABLE_PRODUCTS_DESCRIPTION " pd on p.products_id = pd.products_id )
                               where p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'";
    } else {
      
    $featured_products_query "select distinct p.products_id, p.products_image, pd.products_name
                               from (" 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_FEATURED " f on p.products_id = f.products_id
                               left join " 
    TABLE_PRODUCTS_DESCRIPTION " pd on p.products_id = pd.products_id), " .
      
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
      
    TABLE_CATEGORIES " c
                               where p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" 
    . (int)$new_products_category_id "'
                               and p.products_id = f.products_id and p.products_id = pd.products_id and p.products_status = 1 and f.status = 1 and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'";

    }
    $featured_products $db->ExecuteRandomMulti($featured_products_queryMAX_DISPLAY_SEARCH_RESULTS_FEATURED);

    $row 0;
    $col 0;
    $list_box_contents = array();
    $title '';

    $num_products_count $featured_products->RecordCount();

    // show only when 1 or more
    if ($num_products_count 0) {
      if (
    $num_products_count SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS || SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS == 0) {
        
    $col_width floor(100/$num_products_count);
      } else {
        
    $col_width floor(100/SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS);
      }
      while (!
    $featured_products->EOF) {

        
    $products_price zen_get_products_display_price($featured_products->fields['products_id']);

        
    $list_box_contents[$row][$col] = array('params' =>'class="centerBoxContentsFeatured centeredContent back"' ' ' 'style="width:' $col_width '%;"',
        
    'text' => (($featured_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'products_id=' $featured_products->fields['products_id']) . '">' zen_image(DIR_WS_IMAGES $featured_products->fields['products_image'], $featured_products->fields['products_name'], IMAGE_FEATURED_PRODUCTS_LISTING_WIDTHIMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'products_id=' $featured_products->fields['products_id']) . '">' $featured_products->fields['products_name'] . '</a><br />' $products_price $featured_products->fields['products_description'] );

        
    $col ++;
        if (
    $col > (SHOW_PRODUCT_INFO_COLUMNS_FEATURED_PRODUCTS 1)) {
          
    $col 0;
          
    $row ++;
        }
        
    $featured_products->MoveNextRandom();
      }

      if (
    $featured_products->RecordCount() > 0) {
        if (isset(
    $new_products_category_id) && $new_products_category_id !=0) {
          
    $category_title zen_get_categories_name((int)$new_products_category_id);
          
    $title '<h2 class="centerBoxHeading">' TABLE_HEADING_FEATURED_PRODUCTS . ($category_title != '' ' - ' $category_title '') . '</h2>';
        } else {
          
    $title '<h2 class="centerBoxHeading">' TABLE_HEADING_FEATURED_PRODUCTS '</h2>';
        }
        
    $zc_show_featured true;
      }
    }
    ?>

  8. #8
    Join Date
    Aug 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    Oh does anyone know how to limit the characters output from the description!!?!?

    It would be awesome to be able to limit it to a certain number of characters.

  9. #9
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    163
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    Thanks! Finally after 2 months I got it to work. You rock!

  10. #10
    Join Date
    Aug 2007
    Posts
    9
    Plugin Contributions
    0

    Default Re: adding description to new or featured products

    Ok worked out how to truncate the description too

    instead of using this code to get the description

    PHP Code:
    $featured_products->fields['products_description'
    You can add this

    PHP Code:
    zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($featured_products->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION
    And it will truncate the description, probably to the same amount of characters set in the product listing description admin setting.

    Not sure on that as yet but it works.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v151 Adding description to featured products on products listing page
    By khejit in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Oct 2014, 12:28 PM
  2. v139h Adding Featured Products under Product description
    By gifts4baby in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 20 Aug 2012, 09:43 PM
  3. Adding an image behind new products and featured products
    By missa425 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 14 Aug 2012, 08:46 PM
  4. Adding Description to Featured Products Sidebox
    By baronsmagic in forum Templates, Stylesheets, Page Layout
    Replies: 10
    Last Post: 6 May 2009, 08:51 PM
  5. Adding Category Name to the New Products/Featured/Specials Boxes on Main Page
    By chinchilla2 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 21 Aug 2006, 09:05 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