Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Showing only special price or deafult price but not both


di_stephano20

Recommended Posts

This is what i am looking for:

 

whenever i choose to see a category of products - for example: mainboards - i get 2 kind of prices for the products that have been marked as specials : the old price cut by a line and the special price marked in red. This is really annoying because i want to display only the old price for the products that are not marked as specials and the special price for the product that are marked as specials.

 

for the info_product.php file i did however managed to show one kind of price - only special price for special product and the usual price for usual product -

 

but i want to achive the same even when i choose to see a list of products, and not just for a certain one. This is kind of tricky and i dont know how to do it!!!

 

Sorry for my bad english..!! i hope you undersand what i am trying to say!!!

 

And i hope u have a solution to my problem!

Best regards!

Stephen!

:rolleyes:

Link to comment
Share on other sites

this done differently for most files ... but here is an example for product_listing.php that should get your started:

 

now:

case 'PRODUCT_LIST_PRICE':
 $lc_align = 'right';
 if (tep_not_null($listing['specials_new_products_price'])) {
$lc_text = ' <s>' .  $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s>  <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
 } else {
$lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
 }
 break;

 

change to:

case 'PRODUCT_LIST_PRICE':
 $lc_align = 'right';
 if (tep_not_null($listing['specials_new_products_price'])) {
$lc_text = ' <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span> ';
 } else {
$lc_text = ' ' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . ' ';
 }
 break;

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Hey Monika, nice to hear from u again...:)

 

The exemple that u showed me it's fair simple and I understand it perfectly... as a matter of fact that's exactly how i've done with product_info.php but what i am asking is how to modify the index.php

 

Somewhere in index.php i found this piece of code:

 

// show the products of a specified manufacturer
if (isset($HTTP_GET_VARS['manufacturers_id'])) {
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only a specific category
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, _price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.producducts_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'";
  }
} else {
// show the products in a given categorie
  if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) {
// We are asked to show only specific catgeory
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  } else {
// We show them all
	$listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'";
  }
}

 

what i saw there is an IF statement : IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price and i think this must be modified in order to get only one price - one column instead of 2 - special price for special products and ordinary price for ordinary products... but i don't have a clue what do delete or add....!!!

 

maybe u know how...:)

 

oh and another thing... product_listing.php i don't have it.... i only have a product_list.php file wich is part of the pc custom creator contribution!!!:)

 

my email address is [email protected]

If u have an yahoo mess id maybe u can give it to me so we can chat more!!

 

Thank u again ...

Hope to hear from u soon!!! :rolleyes:

Link to comment
Share on other sites

hmm i really am goofy... i said before that i don't find product_listing.php wich is a lie... i am so goofie .. :-" :-" i found it in modules.... thank u very much monika!!

 

now i know what to do... god im so goofie ... think i gotta get more slip... to many wasted nights.. :blush:

 

thanx 10000 times..!! bye bye

Link to comment
Share on other sites

TG! I was about to explain to you that you are losing it :-)

 

I am right there with your with little sleep and notice my spelling suffer :rolleyes:

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...