Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

css stylesheet - whats new box font color change?


Guest

Recommended Posts

hi,

 

just wondering if like how you can make the Specials price a different font color on its own using the css code

SPAN.productSpecialPrice

 

is there code thats written to do the same for the column box of 'WHAT'S NEW'..?

 

my site is www.alleywaymusic.com for reference..

 

So, example, how i have the specials text larger and in RED, what would i type to do so, just for the whats new box too, in my stylesheet css file..?

 

cheers for any help

:thumbsup:

Link to comment
Share on other sites

also..

 

i realise the

.boxtext in stylesheet changes it..

but can you add anything infront it it for a new definition such as..

whatsnew.boxtext

to be able to only change the color of the whats new PRICE text instead of all of them, such as shopping cart and others too..

 

cheers

:thumbsup:

 

hi,

 

just wondering if like how you can make the Specials price a different font color on its own using the css code

SPAN.productSpecialPrice

 

is there code thats written to do the same for the column box of 'WHAT'S NEW'..?

 

my site is www.alleywaymusic.com for reference..

 

So, example, how i have the specials text larger and in RED, what would i type to do so, just for the whats new box too, in my stylesheet css file..?

 

cheers for any help

:thumbsup:

Link to comment
Share on other sites

hi,

appreciate the link, as i know about w3 and it can teach me css..

 

But knowing the pages and code for osc will require knowing those things exactly, before implementing css right?

 

You wouldnt happen to know the code for whats new box?

cheers

:thumbsup:

Link to comment
Share on other sites

includes/boxes/whats_new.php:

	$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

new infoBoxHeading($info_box_contents, false, false);

includes/classes/boxes.php:

  class infoBoxHeading extends tableBox {
function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
  $this->table_cellpadding = '0';

  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif'
, ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }

  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="infoBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="infoBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}

stylesheet.css:

TD.infoBoxHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 11px;
 font-weight: bold;
 background: #bbc3d3;
 color: #000066;
}

For ALL problems, please review this link first -> osCommerce Knowledge Base

Link to comment
Share on other sites

thats all the codes for the whats new box..

But will any of this only be to..

change the font color for the PRICE when viewing the whats new box on the main page..

not, for when you've clicked in to view the actual whats new page..

but just the box that appears on the main page..?

 

cheers.

:thumbsup:

 

includes/boxes/whats_new.php:

	$info_box_contents = array();
$info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

new infoBoxHeading($info_box_contents, false, false);

includes/classes/boxes.php:

  class infoBoxHeading extends tableBox {
function infoBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
  $this->table_cellpadding = '0';

  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'infobox/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'infobox/arrow_right.gif'
, ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'infobox/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }

  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="infoBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="infoBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="infoBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}

stylesheet.css:

TD.infoBoxHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 11px;
 font-weight: bold;
 background: #bbc3d3;
 color: #000066;
}

Link to comment
Share on other sites

My bad. My previous reply only pertained to the box heading.

 

To modify the look of the price in the contents part, look at includes/boxes/whats_new.php:

	if (tep_not_null($random_product['specials_new_products_price'])) {
  $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rat
e($random_product['products_tax_class_id'])) . '</s><br>';
  $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['s
pecials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($rando
m_product['products_tax_class_id']));
}

I would modify the default '$whats_new_price' refering to the code from the condition above it and possibly add a new class to the stylesheet. Whether this will affect only the 'what's new' random box listing or the generated full page, I haven't looked into.

For ALL problems, please review this link first -> osCommerce Knowledge Base

Link to comment
Share on other sites

Thanks for the Tip.

I'll give it a go.

 

If anyone else has ideas, please let me know.

cheers

:thumbsup:

 

My bad. My previous reply only pertained to the box heading.

 

To modify the look of the price in the contents part, look at includes/boxes/whats_new.php:

	if (tep_not_null($random_product['specials_new_products_price'])) {
  $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rat
e($random_product['products_tax_class_id'])) . '</s><br>';
  $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['s
pecials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($rando
m_product['products_tax_class_id']));
}

I would modify the default '$whats_new_price' refering to the code from the condition above it and possibly add a new class to the stylesheet. Whether this will affect only the 'what's new' random box listing or the generated full page, I haven't looked into.

Link to comment
Share on other sites

hey awesome site, and easy to follow guide..

But.. for some reason it's not working for me, which makes this all the weirder to understand..

can code clash in css that would make one top priority?

could you tell me if i did something wrong..

i've blue highlighted the code i added..

 

my whatsnewbox code..

<?php
/*
 $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/

 if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- whats_new //-->
         <tr>
           [color="#0000FF"]<td id="whatsnewbox">[/color]
<?php
   $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
   $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

   if (tep_not_null($random_product['specials_new_products_price'])) {
     $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
     $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
   } else {
     $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
   }

   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'center',
                                'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price);

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- whats_new_eof //-->
<?php
 }
?>

 

the css code i inserted into the css page..

#whatsnewbox A { color: #ff0000;}

 

cheers

:thumbsup:

i'm just trying to change the Price text on the box..

 

 

Thanks for the Tip.

I'll give it a go.

 

If anyone else has ideas, please let me know.

cheers

:thumbsup:

Link to comment
Share on other sites

yeh thought so..

but i tried body, and .boxtext and few others..

didnt work..

do you know the correct code..?

:blush:

 

cheers

:thumbsup:

 

The price is not an "a href" link, hence using "#whatsnewbox A" will not affect it.
Link to comment
Share on other sites

You need to have a little more understanding of CSS: http://www.w3schools.com/css/

 

In short;

 

You need to wrap your price inside another <span>

 

Then you can use CSS as it's needed.

 

if (tep_not_null($random_product['specials_new_products_price'])) {
$whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
$whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
$whats_new_price = '<span class="productPrice">' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
}

 

#whatsnewbox .productSpecialPrice {
color: green;
}
#whatsnewbox .productPrice {
color: pink;
}

Link to comment
Share on other sites

hey,

yeh no doubt, i do understand, i have to do my research, which i will, as i want to understand css better.

so thankyou for your help.

:thumbsup:

 

 

You need to have a little more understanding of CSS: http://www.w3schools.com/css/

 

In short;

 

You need to wrap your price inside another <span>

 

Then you can use CSS as it's needed.

 

if (tep_not_null($random_product['specials_new_products_price'])) {
$whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
$whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
$whats_new_price = '<span class="productPrice">' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
}

 

#whatsnewbox .productSpecialPrice {
color: green;
}
#whatsnewbox .productPrice {
color: pink;
}

Link to comment
Share on other sites

Hey,

i put your code tips in, and it didnt work??

possible to walk me threw it..

i have been giving it a go myself though, trying different css code etc..

but it is easy to learn when someone else can help explain what i'm not doing..

cheers..

:blush:

 

hey,

yeh no doubt, i do understand, i have to do my research, which i will, as i want to understand css better.

so thankyou for your help.

:thumbsup:

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...