Forums / Templates, Stylesheets, Page Layout / Show product description on main-page?

Show product description on main-page?

Locked

Views: 19,523

Results 21 to 40 of 67
This thread is locked. New replies are disabled.
4 Nov 2008, 7:13 AM
#21
globie avatar

globie

Zen Follower

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

Show product description on main-page?

Can someone please tell me how to do this in the Specials centerbox??? I have tried everything I can think of.

4 Nov 2008, 8:40 AM
#22
misty avatar

misty

Inactive

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

Re: Show product description on main-page?

Globie:

Can someone please tell me how to do this in the Specials centerbox??? I have tried everything I can think of.
Have already given you details and code of how to achieve
at
http://www.zen-cart.com/forum/showthread.php?t=111556

PLEASE DON'T Double post..makes life so much more
complicated for forum volunteers

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

27 Apr 2009, 10:26 PM
#23
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Thanks to all for the clear description and coding here. Worked excellently. Could someone help point me to where I can control the size of the font in the description as well as how the text is wrapped. Is there a way to control the left and right margins? I looked through the CSS files as well as the featured_products.php and through the english folder, but cannot seem to locate where the font is described.

27 Apr 2009, 11:06 PM
#24
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show product description on main-page?

It is probably not specifically described for that element; an element inherits its parent's styling for many properties.

There are many classes and ids provided in the PHP files, ready for anyone who needs to style an element in a unique way to add to the stylesheet and customize.

28 Apr 2009, 10:44 AM
#25
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Thanks for your answer, gjh. I found the code in the stylesheet.css to affect the text size and weight (around line 475 .centerBoxContentsFeatured).

What I now do not understand is the following: the description used on the main page featured items is taken directly from the product description as entered in the admin page/catalog/categories-products. If I insert line breaks (<br/>) in the description, it shows up in the product itself, but it doesn't work on the main page featured items description. Text runs on instead of being properly broken according to the html commands (are they html commands?). Do I need to insert a command in the stylesheet.css to tell the template to use these html commands? I don't understand why they arent otherwise being picked up.

Here is an url if I am not being clear. The product descriptions on the main page run on, click on a product and the text is properly divided.

http://futureclassicsmusic/zen-cart

28 Apr 2009, 7:00 PM
#26
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show product description on main-page?

Only the product info page uses the HTML formatting you add to the description; the listings strip HTML before printing. You can make the product listing use HTML by changing two lines in product_listing.php - search the forum for "zen_clean_html" for full directions.

28 Apr 2009, 7:44 PM
#27
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Thank you so much for that! I've been searching all day for that piece of code! I simply commented it out and the html works. I'll paste it here so others can see. It is in includes/modules/my_template/featured_products.php around line 73. Just added the /* */ to zen_clean_html et voila!

$products_description = zen_trunc_string(/zen_clean_html/m(stripslashes(zen_get_products_description($featured_products->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);

28 Apr 2009, 8:29 PM
#28
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Oh dear! You can't edit posts. A stray "m" entered the code, it should read:

$products_description = zen_trunc_string(/zen_clean_html/(stripslashes(zen_get_products_description($featured_products->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);

28 Apr 2009, 9:01 PM
#29
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Cripes, I don't mean to hijack this thread, but after getting everything perfectly lined-up and working, I checked the site in Dutch and the alignment of the main page was screwed up. I hadn't touched any language files for the mail page or the mods for adding descriptions to the featured products on the main page, so that can't be the problem. I did the fix recommended in Known Bugs http://www.zen-cart.com/forum/showthread.php?t=82619&page=4 just to be on the safe side.

What happened? I had added some text that I had blanked out using the HTLMLarea editor so that the description on the products page wouldn't appear on the main page. That apparently was screwing up the alignment. I deleted the line of text and it now works perfectly. Very odd, but I thought I should report it should anyone else have that happen.

10 Sep 2009, 8:58 AM
#30
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Another question about the description of featured products used on the main page: how can I limit the length of the description on the main page? I assume I need to enter something in the includes/modules/my_template/featured_products.php? I thought there would be a flag somewhere in the includes/modules/featured_products.php, since you can control that via the admin page. Is there a code <limit length> or some such code? This question has been raised in various form over the last year or so, but no one seems to have been able to point to the solution? Thanks so much for any help.

10 Sep 2009, 9:23 AM
#31
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

Finally figured that out my searching "more info" in the development tool kit. Found the snippet of code I needed in includes/modules/new_product_php.

$info_link = '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'products_id=' . $featured_products->fields['products_id']) . '"> more info...</a>';

I added that to my includes/modules/my_template/featured_products.php after this code:

if (!isset($productsInCategory[$featured_products->fields['products_id']])) $productsInCategory[$featured_products->fields['products_id']] = zen_get_generated_category_path_rev($featured_products->fields['master_categories_id']);

and that did the trick. That took me about six months to figure out! Not that I understand how it works...

10 Sep 2009, 9:57 AM
#32
igor56 avatar

igor56

New Zenner

Join Date:
Apr 2009
Posts:
29
Plugin Contributions:
0

Re: Show product description on main-page?

I obviously had that completely wrong but am on the right track. Any help would greatly be appreciated!

10 Sep 2009, 12:43 PM
#33
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: Show product description on main-page?

zen_trunc_string() is the function that truncates output to a specified length (carefully trimming to leave full words), so looking for that in product_listing.php should help you get the functionality elsewhere.

3 Apr 2010, 4:05 AM
#34
jenniferuth avatar

jenniferuth

New Zenner

Join Date:
Oct 2009
Posts:
4
Plugin Contributions:
0

Re: Show product description on main-page?

Hi, I am in v. 1.3.8 (not 1.3.8a). I am using Featured Products on my main page. I need to add the manufacturer's name (not wanting it to read "manufacturer:suchandsuch", just wanting it to read "suchandsuch") below the image. Removed the price using the tips above and now have image + the product name (which I want to remove, too).

*Ultimately, want only image with manufacturer's name beneath to appear on page. *

Here's the code I have currently (as recommended above) that needs to be modified:

$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']), 'cPath=' . $productsInCategory[$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_WIDTH, IMAGE_FEATURED_PRODUCTS_LISTING_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($featured_products->fields['products_id']), 'cPath=' . $productsInCategory[$featured_products->fields['products_id']] . '&products_id=' . $featured_products->fields['products_id']) . '">' . $featured_products->fields['products_name'] . '</a><br />' . $products_price);

I think I also need a snippet similar to this example:

$products_description = zen_trunc_string(zen_clean_html(stripslashes(zen_get_products_description($featu red_products->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION);

except that I need it for manufacturer, instead of description.

Please help?
Thank you so much!

:hug:

31 Aug 2010, 9:33 AM
#35
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Show product description on main-page?

$product_info_str .= '</td><td class="productBoxContent" valign="top">';

  	$product_info_str .= '<table width="100%" cellspacing="0" cellpadding="0"><tr>';
  	$product_info_str .= '<td class="productBoxDescription" valign="top">';
  	$product_info_str .= (strlen($product->fields['products_description']) > 50) ? substr(strip_tags($product->fields['products_description']), 0, 50) . '…' : strip_tags($product->fields['products_description']);
  	$product_info_str .= '</td></tr><tr><td>';
  	$product_info_str .= '<a href="' . zen_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products->fields['products_id']) . '">' . '<img src="'. DIR_WS_TEMPLATE_IMAGES .'az_more_info.gif" class="noborder" alt="" />' . '</a>';
  	$product_info_str .= '</td></tr><tr><td height="4"></td></tr><tr><td>';
  	$product_info_str .= '<a href="' . zen_href_link(basename($PHP_SELF), zen_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products->fields['products_id']) . '">' . '<img src="'. DIR_WS_TEMPLATE_IMAGES .'az_buy_now.gif" class="noborder" alt="" />' . '</a>';
  	$product_info_str .= '</td></tr></table>';

  	$product_info_str .= '</td';
  	$product_info_str .= '</tr></table>'; // productBoxContent

Anyone see why the descriptions arnt showing on "New Products"....

31 Aug 2010, 2:04 PM
#36
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show product description on main-page?

This might not work too well:
$product->fields['products_description']

But later, you are using for the fields:
$new_products->fields['products_id']

Which one are you really using?

NOTE: you need to clean up a few things in there, if this is the case ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2010, 7:56 AM
#37
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Show product description on main-page?

Ajeh:

This might not work too well:
$product->fields['products_description']

But later, you are using for the fields:
$new_products->fields['products_id']

Which one are you really using?

NOTE: you need to clean up a few things in there, if this is the case ...

I am trying to get the descriptions to display in the New Products box on the main page...

1 Sep 2010, 4:01 PM
#38
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show product description on main-page?

You need to use the correct references to the fields that you pulled with your select statement ...

I think you have mixed references ...

I believe if you change all:
$product->fields

to read:
$new_products->fields

This would fix the problem ...

NOTE: if your SELECT statement does not pull the:
products_description

field, then you will need to customize things further ...

Look at the:
$new_products_query

and see if the:
products_description

field is being pulled from the database in the two selects for the:
$new_products_query

If not, you need to add it ... follow the references to:
products_name

to see where and how it is gathered ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

1 Sep 2010, 6:44 PM
#39
delights avatar

delights

Zen Follower

Join Date:
May 2006
Location:
Queensland, Australia
Posts:
254
Plugin Contributions:
0

Re: Show product description on main-page?

Okay, just to test a theory, i added the "new_products.php" from another template that does being up the description on the New Products box.

When i added that file it still didnt bring up the descriptions in the box, is it possible they have removed the coding from else where ?

1 Sep 2010, 6:59 PM
#40
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Show product description on main-page?

Make sure you are addressing the right code ...

The Centerbox for the New Products is different than the New Products page ...

In the module:
/includes/modules/new_products.php

you would copy to your templates and overrides directory ...

Then you need to customize the code ...

First, the two select statements:

  $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                p.products_date_added, p.products_price, p.products_type, p.master_categories_id, pd.products_description
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and   p.products_status = 1 " . $display_limit;
    $new_products_query = "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                  p.products_date_added, p.products_price, p.products_type, p.master_categories_id, pd.products_description
                           from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd
                           where p.products_id = pd.products_id
                           and pd.language_id = '" . (int)$_SESSION['languages_id'] . "'
                           and p.products_status = 1
                           and p.products_id in (" . $list_of_products . ")";

Then, to display the description cleanly, you can use:

    $list_box_contents[$row][$col] = array('params' => 'class="centerBoxContentsNew centeredContent back"' . ' ' . 'style="width:' . $col_width . '%;"',
    'text' => (($new_products->fields['products_image'] == '' and PRODUCTS_IMAGE_NO_IMAGE_STATUS == 0) ? '' : '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . zen_image(DIR_WS_IMAGES . $new_products->fields['products_image'], $new_products->fields['products_name'], IMAGE_PRODUCT_NEW_WIDTH, IMAGE_PRODUCT_NEW_HEIGHT) . '</a><br />') . '<a href="' . zen_href_link(zen_get_info_page($new_products->fields['products_id']), 'cPath=' . $productsInCategory[$new_products->fields['products_id']] . '&products_id=' . $new_products->fields['products_id']) . '">' . $new_products->fields['products_name'] . '</a><br />' . $products_price . '<br>' . zen_trunc_string(zen_clean_html(stripslashes($new_products->fields['products_description']))) );

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!