There are loads of contributions on the Forums however most are long winded and pretty much confusing for what should be a simple task, if you know the code!
This mod replaces the price with the message "log in to view prices" its a holistic approach to change all prices, once the user logs in they will see the prices.
The function to alter is found in catalog / includes / classes / currenices.php
lines 72 & 73
function display_price($products_price, $products_tax, $quantity = 1) {
return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
The code to use already exists in osCommerce, so all we have to do is borrow it and add an IF statement
tep_session_is_registered('customer_id')
To this all we have to do is add an IF statement, like this...
function display_price($products_price, $products_tax, $quantity = 1) {
if (tep_session_is_registered('customer_id')){
return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
}
{
return '<b>Log in for prices</b>';
}
}
The code reads, IF the customer has logged in then show the prices, ELSE display the message (you can change this message to suit your needs).
This will take you all of two minutes.
|