Forums / Templates, Stylesheets, Page Layout / Why does this only work in the product listing - CSS puzzle

Why does this only work in the product listing - CSS puzzle

Locked

Views: 1,819

Results 1 to 5 of 5
This thread is locked. New replies are disabled.
26 Feb 2007, 7:19 PM
#1
budfox avatar

budfox

Zen Follower

Join Date:
Aug 2006
Posts:
88
Plugin Contributions:
0

Why does this only work in the product listing - CSS puzzle

Hi again.

Sorry for posting something that someone else might have asked, but it's so hard getting the right question.:(

Anyway, I want 'While Stocks Last!!!!!!!' in bold red.

I've done it by applying an inline style to my listing:

<p style="color: red; font-weight: bold"> WHILE STOCKS LAST!!!!! </p>

That works fine

but........why doesn't the style work in the category listing?

Here's where it works:

http://www.wheredidyougetit.co.uk/shop/index.php?main_page=product_info&cPath=3&products_id=9

Here's where it doesn't:

http://www.wheredidyougetit.co.uk/shop/index.php?main_page=index&cPath=3

As a side issue, I don't really want to type that inline style, but I don't know how
to write the code and modify the stylesheet to achieve this. Ideally I just want to type something along the lines of <p style=boldred > and define 'boldred' in my css.

Cheers everyone, a little donation once my eBay auction finishes tonight :-)

26 Feb 2007, 8:49 PM
#2
jamesm avatar

jamesm

New Zenner

Join Date:
Jan 2007
Posts:
27
Plugin Contributions:
0

Re: Why does this only work in the product listing - CSS puzzle

I'm pretty sure the product listing page doesn't read the html/css from product descriptions, so you wont be able to bold just part of the description.

26 Feb 2007, 8:57 PM
#3
clydejones avatar

clydejones

Deceased

Join Date:
Nov 2005
Location:
Colorado Springs, CO USA
Posts:
7,017
Plugin Contributions:
12

Re: Why does this only work in the product listing - CSS puzzle

To answer your question about styling the paragraph so it shows as red without using an inline style;

Use this instead:

<p class="alert">WHILE STOCKS LAST!!!!!</p>

NOTE: We are sorry that Clyde is no longer with us.
We are grateful for all his contributions to the Zen Cart community.

26 Feb 2007, 10:02 PM
#4
gjh42 avatar

gjh42

Black Belt

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

Re: Why does this only work in the product listing - CSS puzzle

You can make HTML display in the product listing description.

In /includes/modules/your_template/product_listing.php around line 95, find this section:php 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'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(/*zen_clean_html gjh42 4/29/06*/(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>'; } break; and comment out the zen_clean_html like this /zen_clean_html/ to get this:```php
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'] > 0 ? 'cPath=' . $_GET['cPath'] . '&' : '') . 'products_id=' . $listing->fields['products_id']) . '">' . $listing->fields['products_name'] . '</a></h3><div class="listingDescription">' . zen_trunc_string(/zen_clean_html gjh42 4/29/06/(stripslashes(zen_get_products_description($listing->fields['products_id'], $_SESSION['languages_id']))), PRODUCT_LIST_DESCRIPTION) . '</div>';
}
break;

A caution: if you have extensive html in your description and a limited description length, some code may be truncated giving errors.
27 Feb 2007, 7:28 AM
#5
budfox avatar

budfox

Zen Follower

Join Date:
Aug 2006
Posts:
88
Plugin Contributions:
0

Re: Why does this only work in the product listing - CSS puzzle

Perfect, thanks.