Forums / Templates, Stylesheets, Page Layout / Adding Description to Featured Products Sidebox

Adding Description to Featured Products Sidebox

Locked

Views: 2,872

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
27 Jan 2009, 9:53 AM
#1
baronsmagic avatar

baronsmagic

New Zenner

Join Date:
Aug 2008
Posts:
2
Plugin Contributions:
0

Adding Description to Featured Products Sidebox

I have tried looking at the other thread, adding description to new and featured products, but I don't think it solves my problem. I would basically like to alter the featured products sidebox (found at includes/templates/templates_default/sideboxes/tpl_featured.php) in order to show a SHORTENED description underneath the Products Name and before the Price. I imagine this is possible since the featured_products page also allows for shortened descriptions (length of description edited at Configuration/Featured Listing from the Zencart admin home) but as I am no code whizz I have no idea how to do this! Any help would be deeply appreciated, many thanks, Sophia

27 Jan 2009, 10:46 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: Adding Description to Featured Products Sidebox

Edit includes/templates/template_default/sideboxes/tpl_featured.php - insert this code where you want the description to be (I'd suggest just before the price)
```
$content .= '<br />' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_FEATURED_LIST_DESCRIPTION) . '<br />';

and save the edited file in your override folder - includes/templates/YOUR_TEMPLATE/sideboxes/tpl_featured.php

The code snippet above will use the length of the description you enter from Admin->Configuration->Featured Listing->Display Product Description

Neville
An assumption is what you arrive at when you get tired of thinking...

20 Feb 2009, 12:29 AM
#3
nicedreams avatar

nicedreams

New Zenner

Join Date:
Dec 2006
Location:
UK
Posts:
32
Plugin Contributions:
0

Re: Adding Description to Featured Products Sidebox

The addition of this code looked promising but it didn't work for me.

I've tried finding a way of displaying the description, price and add to cart button in the featured sidebox but amending tpl_featured.php seems to do nothing and I can't find any relevant admin switches.

This question comes up a lot but I've never found a satisfactory answer. :(

25 Feb 2009, 10:43 AM
#4
nannid avatar

nannid

New Zenner

Join Date:
Feb 2007
Posts:
17
Plugin Contributions:
0

Re: Adding Description to Featured Products Sidebox

If the question is to display in home page the complete list of the featured products, as it appear in the specific page, I did this way:

Copy the file:

includes\templates\template_default\templates\tpl_featured_products_default.php

in the following directory:

includes\templates\your_template\templates

and rename it:

tpl_modules_featured_products.php

At this point the featured produts should be displayed in home in the “extended mode”. But some messages (i.e. TEXT_PRODUCTS_WEIGHT) are not converted in the correct text.

To obtain this conversion, it is needed to call in the home page the file (my language is Italian – apply the modifications for your language):

includes\languages\italian\featured_products.php

To do this, I suggest:

Copy the file:

includes\languages\italian\featured_products.php

and rename it, i.e., as follows:

includes\languages\italian\featured_products_home.php

therefore, open file (in a text editor):

includes\languages\italian.php

insert the following lines (i.e. towards the end, after line 694):

// include speciale per prodotti in vetrina in home page
if (file_exists(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir . '/featured_products_home.php')) {
$template_dir_select = $template_dir . '/';
} else {
$template_dir_select = '';
}
require_once(DIR_WS_LANGUAGES . $_SESSION['language'] . '/' . $template_dir_select . 'featured_products_home.php');

save the file in your template:

includes\languages\your_template\italian.php

Since we have copied the file featured_products.phpeand renamed in featured_products_home.php we will be able to do all modification on the messages, without any alteration of the original meggases of the Featured Products

(Excuse me my poor english)

25 Feb 2009, 10:47 AM
#5
nannid avatar

nannid

New Zenner

Join Date:
Feb 2007
Posts:
17
Plugin Contributions:
0

Re: Adding Description to Featured Products Sidebox

After posted my previous messages, I realized that your need was to display the product description in the SIDEBOX.
What I have suggested is related to the centerbox.
Sorry

26 Feb 2009, 7:08 AM
#6
nicedreams avatar

nicedreams

New Zenner

Join Date:
Dec 2006
Location:
UK
Posts:
32
Plugin Contributions:
0

Re: Adding Description to Featured Products Sidebox

Thanks Nannid. Your explanation is very comprehensive and yes, it's the sidebox php file which requires the amendment. Thanks again. :smile:

26 Feb 2009, 8:27 AM
#7
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Adding Description to Featured Products Sidebox

Back up first
/includes/templates/nameofyourtemplate/sideboxes/tpl_featured.php
~~~~~~~~~~~~~~~~~~~~~~
..under

$content .= '<div>' . $featured_box_price . '</div>';

ADD

 $content .= '<br />' . zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($random_featured_product->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_FEATURED_LIST_DESCRIPTION) . '<br />';

Dezina ZenCart Templates
Please do not PM for support queries..Post in forums..help others

6 May 2009, 5:57 PM
#8
aly22 avatar

aly22

Zen Follower

Join Date:
Feb 2008
Posts:
174
Plugin Contributions:
0

Re: Adding Description to Featured Products Sidebox

Hmmm ... can't find the line you refer to in my tpl_featured

I have descriptions showing but they are truncated, I want full description on home page. Here is my file:

<?php
/**
 * Side Box Template
 *
 * @package templateSystem
 * @copyright Copyright 2003-2007 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: tpl_featured.php 6128 2007-04-08 04:53:32Z birdbrain $
 */
  $content = "";
  $featured_box_counter = 0;
  while (!$random_featured_product->EOF) {
    $featured_box_counter++;
    $featured_box_price = zen_get_products_display_price($random_featured_product->fields['products_id']);
    $content .= '<div class="sideBoxContent centeredContent">';
    $content .=  '
	
	
                <table style="width:100%;">
                	<tr>
                    	<td>
	
	
<table style="width:1px; margin:auto;" align="center">
	<tr>
    	<td>
        	
<div class="img_box1">
	<div class="bg_inner1">
	<div class="bg_inner2">
	<div class="bg_inner3">
	<div class="bg_inner4">
	<div class="bg_inner5">
	<div class="bg_inner6">
	<div class="bg_inner7">
	<div class="bg_inner8">
	<div class="bg_inner9"><a href="' . zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' . $random_featured_product->fields["products_id"]) . '">' . zen_image(DIR_WS_IMAGES . $random_featured_product->fields['products_image'], $random_featured_product->fields['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); 
    $content .= '</a></div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
    </div>
</div>
        </td>
    </tr>
</table>
	
						<div class="clear"></div>

                        </td>
                        <td>
                        	<div style="width:8px;"></div>
                        </td>
                        <td style="width:100%;">
	

	
	';
	
    $content .= '<div style="padding-top:5px; padding-left:0; " class="productSpecialPrice">' . $whats_new_price . '</div>
	
	
	
						</td>
                    </tr>
                </table>
				
	';


	
	 $content .= '<div style="padding-left:0; padding-top:0;  padding-bottom:0;"><b><a href="' . zen_href_link(zen_get_info_page($random_featured_product->fields["products_id"]), 'cPath=' . zen_get_generated_category_path_rev($random_featured_product->fields["master_categories_id"]) . '&products_id=' . $random_featured_product->fields["products_id"]) . '">' . $random_featured_product->fields['products_name'] . '</a></b></div>';
	
	
    $content .= '</div>';
    $random_featured_product->MoveNextRandom();
  }
?>

Where do I insert the zen_trunc_string???

6 May 2009, 6:23 PM
#9
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Adding Description to Featured Products Sidebox

That code is not the normal for featured sidebox...what
template are you using?
:wacko:

Dezina ZenCart Templates
Please do not PM for support queries..Post in forums..help others

6 May 2009, 6:25 PM
#10
aly22 avatar

aly22

Zen Follower

Join Date:
Feb 2008
Posts:
174
Plugin Contributions:
0

Re: Adding Description to Featured Products Sidebox

that's what I feared.
I'm using a Monster Template

And actually, I am not aiming to do sidebox, but center column featured products

6 May 2009, 7:51 PM
#11
misty avatar

misty

Inactive

Join Date:
Apr 2004
Location:
UK
Posts:
5,752
Plugin Contributions:
1

Re: Adding Description to Featured Products Sidebox

aly22:

that's what I feared.
I'm using a Monster Template

And actually, I am not aiming to do sidebox, but center column featured products
Template Monster - then anything is possible re coding..
This thread is for featured products sidebox...centre featured sidebox uses different file/coding..

Dezina ZenCart Templates
Please do not PM for support queries..Post in forums..help others