Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

product display help


novus

Recommended Posts

Hi,

 

I want to know, how can I change the settings, so that the product prices are displayed only after the customer has logged in.

 

The reason I want to do this is because, I want to create a site for traders only. The prices on my store will be wholesale prices are not intented for end users.

 

Any help appreciated.

 

Thanks

Nas

Link to comment
Share on other sites

Hi,

 

I want to know, how can I change the settings, so that the product prices are displayed only after the customer has logged in.

 

The reason I want to do this is because, I want to create a site for traders only. The prices on my store will be wholesale prices are not intented for end users.

 

Any help appreciated.

 

Thanks

Nas

 

use this in product listing, product info and wherever a price is called, or better go to the class where the price is being formatted and use it there!

 

<?php if (tep_session_is_registered('customer_id')) { ?> ....

:-)

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

use this in product listing, product info and wherever a price is called, or better go to the class where the price is being formatted and use it there!

 

<?php if (tep_session_is_registered('customer_id')) { ?> ....

 

Personally I would not put it in the currencies class. If you add all kind of conditions which have nothing to do with the object currency to the class, it basically eliminates the purpose of using classes/objects. I would write a function "display_price_info($products_id)" in which you process all these conditions and that function is called in product_info.php and elsewhere. That function in turn uses the currencies class instance/object which can remain pure in functionality.

Treasurer MFC

Link to comment
Share on other sites

Personally I would not put it in the currencies class. If you add all kind of conditions which have nothing to do with the object currency to the class, it basically eliminates the purpose of using classes/objects. I would write a function "display_price_info($products_id)" in which you process all these conditions and that function is called in product_info.php and elsewhere. That function in turn uses the currencies class instance/object which can remain pure in functionality.

 

great idea Amanda! I knew there was a 3rd spot apart from my class approach and putting it right into the code, lol.

:-)

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

great idea Amanda! I knew there was a 3rd spot apart from my class approach and putting it right into the code, lol.

 

just as an example of the function I use myself for all price information.

 

function price_info ($product_info, $show_savings = true, $show_old_price = true, $show_price = true) {

 

// input:

// $product_info = array from database query result

// $show_savings = parameter of % saved display

// $show_old_price = parameter of retail price display

// $show_price = parameter of current price display

//

// output:

// $result = formatted string

 

global $currencies;

 

$old_price = '';

$price = '';

$savings = '';

$result = '';

 

// return nothing if not signed in

//if (!tep_session_is_registered('customer_id') return '';

// return nothing if product sold

if ($product_info['products_quantity'] < 0) return '';

// return call for price if price is zero

if ($product_info['products_price'] == 0) {

return '<a onmouseover="return escape(\'Call or Email Us for the Price<br>Or make an Offer\');"href="' . tep_href_link('contact_us.php', 'cfp=' . urlencode('Product [' . $product_info['products_id'] . '] - ' . $product_info['products_name'])) . '">'. TEXT_CALL_FOR_PRICE . '</a>';

}

 

// get current price formatted

$price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .'<br>';

 

// if retail price defined, format it and calculate savings

if ($product_info['products_retail_price'] > 0) {

$old_price = '<s><font color="red">' . $currencies->display_price($product_info['products_retail_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</font></s><br>';

$savings = YOU_SAVE . '<font color="red"><i>' . ceil((1-($product_info['products_price']/$product_info['products_retail_price'])) * 100) . '%</i></font>';

}

 

// output the requested information

if ($show_old_price) $result .= $old_price;

if ($show_price) $result .= $price;

if ($show_savings) $result .= $savings;

 

return $result;

}

Treasurer MFC

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...