Version imprimable du sujet

Cliquez ici pour voir ce sujet dans son format original

Forum osCommerce-fr _ Design _ petite question css prix et titre d'une couleur différentes

Écrit par : etuzien 18 Oct 2007, 15:07

bonjour

j'ai modifier mon fichier stylesheet pour afficher mon titre et mon prix en gras.

ici :

TD.productListing-data {
font-family: Verdana, Arial, sans-serif;
font-size: 10px;
font-weight: bold;
}

mais comment donnez une couleur differente aux prix ....

mon titre , mon prix

pour
mon titre mon prix

que dois je rajouter ?
d'avance merci

Écrit par : etuzien 18 Oct 2007, 15:14

ou peut etre dans mon fichier products listing ....

ici :

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing['specials_new_products_price'])) {

$lc_text = '&nbsp;<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>&nbsp;';

} else {

$lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '&nbsp;';

}

je réfléchi dry.gif

Écrit par : gentag 18 Oct 2007, 16:03

Bonjour,

Il suffit de rajouter un <span style="color: #141414;"> </span> à l'endroit où tu veux que cela s'affiche donc le prix pour toi.

Par contre je vois que c'est déjà fait pour ce qui est dans le if apparement...

CODE
;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>
Donc il suffit de changer la couleur de la police de la classe productSpecialPrice avec l'attribut color, sauf si ce n'est pas ça que tu dois changer...

Pour dans le else:
CODE
$lc_text = '&nbsp;<span style="color: #141414;">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>&nbsp;';
Ca devrait faire l'affaire...

Bon courage

Écrit par : etuzien 18 Oct 2007, 16:43

je crois que mon bout de code concerne l'admin mrgreen.gif

voici li fichier en complet :
product listing ;[codebox]<?php

/*

$Id: product_listing.php,v 1.44 2003/06/09 22:49:43 hpdl Exp $

*/



$listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id');



if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3') ) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}



$list_box_contents = array();



if ($listing_split->number_of_rows > 0) {

$listing_query = tep_db_query($listing_split->sql_query);



$row = 0;

$column = 0;

while ($listing = tep_db_fetch_array($listing_query)) {



$product_contents = array();



for ($col=0, $n=sizeof($column_list); $col<$n; $col++) {

$lc_align = '';



switch ($column_list[$col]) {

case 'PRODUCT_LIST_MODEL':

$lc_align = '';

$lc_text = '&nbsp;' . $listing['products_model'] . '&nbsp;';

break;

case 'PRODUCT_LIST_NAME':

$lc_align = '';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>';

} else {

$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>&nbsp;';

}

break;

case 'PRODUCT_LIST_MANUFACTURER':

$lc_align = '';

$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a>&nbsp;';

break;

case 'PRODUCT_LIST_PRICE':

$lc_align = 'right';

if (tep_not_null($listing['specials_new_products_price'])) {

$lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>&nbsp;&nbsp;<span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>&nbsp;';

} else {

$lc_text = '&nbsp;' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '&nbsp;';

}

break;

case 'PRODUCT_LIST_QUANTITY':

$lc_align = 'right';

$lc_text = '&nbsp;' . $listing['products_quantity'] . '&nbsp;';

break;

case 'PRODUCT_LIST_WEIGHT':

$lc_align = 'right';

$lc_text = '&nbsp;' . $listing['products_weight'] . '&nbsp;';

break;

case 'PRODUCT_LIST_IMAGE':

$lc_align = 'center';

if (isset($HTTP_GET_VARS['manufacturers_id'])) {

$lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';

} else {

$lc_text = '&nbsp;<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>&nbsp;';

}

break;

case 'PRODUCT_LIST_BUY_NOW':

$lc_align = 'center';

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a>&nbsp;';

break;

}

$product_contents[] = $lc_text;



}

$lc_text = implode('<br>', $product_contents);

$list_box_contents[$row][$column] = array('align' => 'center',

'params' => 'class="productListing-data"',

'text' => $lc_text);

$column ++;

if ($column >= 3) {

$row ++;

$column = 0;

}

}



new productListingBox($list_box_contents);

} else {

$list_box_contents = array();



$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][] = array('params' => 'class="productListing-data"',

'text' => TEXT_NO_PRODUCTS);



new productListingBox($list_box_contents);

}



if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}

?>

[/codebox]

j'ais essayer comme ça mais trouve pas.
merci pour ses pistes

Écrit par : slc974 9 Oct 2017, 16:10

Bonjour,
je réponds 10 ans après la première demande smile.gif mais bon si je le fais c'est que je cherchais moi aussi la réponse et que peut-être d'autres s'en serviront. Cela permet d'avoir un titre de produit d'une couleur et un prix d'une autre couleur (et pourquoi pas changer la taille aussi)

Voilà mon approche :

dans product_info.php ligne 113 il y a un appel PageHeading pour le nom du produit

Code
<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

et un autre appel pour le prix
Code
<td class="pageHeading2" align="right" valign="top"><?php echo $products_price; ?></td>


Les deux apparemment utilisent la même classe css. Il suffit donc de partir dans le fichier stylesheet.css et de chercher la classe d'appel, chez moi il ressemble à ça avec mes propres couleurs :

Code
TD.pageHeading, DIV.pageHeading {
  font-family: Verdana, Arial, sans-serif;
  font-size: 20px;
  font-weight: bold;
  color: #0000CC;
}


tu fais donc une autre class que tu nomes comme tu veux, moi j'ai fais très simple j'ai juste rajouté un 2 :

Code
TD.pageHeading2, DIV.pageHeading2 {
  font-family: Verdana, Arial, sans-serif;
  font-size: 20px;
  font-weight: bold;
  color: #0000CC;
}


Il faut donc faire pareil pour l'appel du css du prix :
Code
<td class="pageHeading2" align="right" valign="top"><?php echo $products_price; ?></td>


Voilà, bonne continuation si vous lisez ceci.



Propulsé par Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)