Jump to content



Latest News: (loading..)

- - - - -

POA instead of 0 for product price


  • Please log in to reply
11 replies to this topic

#1   ctbhost

ctbhost
  • Members
  • 28 posts
  • Real Name:Chris

Posted 17 November 2004 - 07:56 AM

i have a couple of products that the price fluctuates up and down regularly so i want the price to show as POA - is there a way this can be done

#2   Johnson

Johnson
  • Banned
  • 5,205 posts
  • Real Name:Matti Ressler
  • Location:Sydney, Australia

Posted 17 November 2004 - 12:01 PM

In catalog/includes/classes/currencies.php change the very last function to:

    function display_price($products_price, $products_tax, $quantity = 1) {
     if($products_price == '0') {
       return 'POA';
     } else {  
       return $this->format(tep_add_tax($products_price, $products_tax) * $quantity);
     }
    }
  }

(the last curly bracket closes the class rather than this function - it should be the last in the file before ?>)

Matti

Edited by Johnson, 17 November 2004 - 12:02 PM.

Matti Ressler

We were all once expert at...... nothing
_____

#3   jamiedia

jamiedia
  • Members
  • 18 posts
  • Real Name:Jamie

Posted 30 October 2006 - 03:51 PM

That did the trick, I added £ so the pound symbol appears before. Im only selling within the UK so I dont need extra currencies, although I'm certain its possible to have more than one depending on the selected currency. Does anyone have an idea?

#4   jamiedia

jamiedia
  • Members
  • 18 posts
  • Real Name:Jamie

Posted 30 October 2006 - 10:58 PM

Just wanted to let people know when they change currencies.php that they should be careful not to leave any whitespace after the closing php tag. Its right next to the bit you need to edit and I must have hit the space bar, as a result have spent the rest of the day trying to figure out why I got an error when trying to access user accounts via SSL. Big shout out and a massive thankyou to 241 (Steve Bissett) for the help on fixing it

Edited by jamiedia, 30 October 2006 - 10:59 PM.


#5   lisaanne

lisaanne
  • Members
  • 26 posts
  • Real Name:Lisa Bailey

Posted 12 January 2007 - 11:21 AM

Watch out for the ? after else { - take it out else it won't work! Sure this was a formatting thing when the code was copied and pasted - many thanks to Matti for the code, works a treat once that's sorted!

Lisa x

#6   ptholt

ptholt
  • Members
  • 50 posts
  • Real Name:Peter Holt

Posted 05 May 2008 - 09:52 PM

Having some problems using this in the latest release.

i add the code mentioned above, but then get the following error -

Fatal error: Cannot instantiate non-existent class: currencies in /home/markb/domains/classicstamps.co.uk/public_html/includes/application_top.php on line 258

The above line is the following -

$currencies = new currencies();

not quite sure why this is happening, can someone point me in the right direction please?

#7   jimmyharwood

jimmyharwood
  • Members
  • 36 posts
  • Real Name:Jimmy Harwood
  • Gender:Male
  • Location:Manchester UK

Posted 02 March 2009 - 02:02 PM

Thanks for that - the forums are really useful!!

Just come accross the same problem myself - little search problem solved.

I am running the latest version - editing on Vista and had no probs with this.

#8   cbonnar

cbonnar
  • Members
  • 24 posts
  • Real Name:Colin Bonnar

Posted 29 June 2012 - 02:59 AM

All,

This is how I have it for OSC 2.3.1. I noted the 'return $this->' statment is different in 2.3.1 so I used that one instead of the one from you original post. Otherwise works great and thanks for the mod.

     function display_price($products_price, $products_tax, $quantity = 1) {
     if($products_price == '0') {
       return 'POA';
     } else {  
       return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
     }
    }
Thanks
Colin

#9   antagraber

antagraber
  • Members
  • 16 posts
  • Real Name:Antoni Agramunt i Bertolotti

Posted 11 October 2012 - 02:19 PM

I’m glad to share a small improvement to support POA message in multilanguages stores (which are pretty common in Europe :D  )


Quote

function display_price($products_price, $products_tax, $quantity = 1) {
// BOF: modification for POA  
IF($products_price=='0')
{return POA_MESSAGE ;}
Else    // EOF … POA modification
{return $this->format($this->calculate_price($products_price, $products_tax, $quantity));  
}
  }


Add for each language you have defined in your OSC store, the following line  in the language file in /includes/languages/
This example is for English, thus file is  /includes/languages/english.php  

Quote

define('POA_MESSAGE', 'Price on Application')    // POA message in local language

For each language define your own POA message in the [language].php file.

Hope this helps

#10   Matjaz

Matjaz
  • Members
  • 8 posts
  • Real Name:Matjaz
  • Gender:Male
  • Location:Slovenia

Posted 20 November 2012 - 11:54 AM

Did anyone tried to listen to this in version 2.3.3.? I cant make it, it makes my page collaps.

#11   madbusu

madbusu
  • Members
  • 42 posts
  • Real Name:Busu

Posted 08 March 2013 - 01:11 PM

yeah it's working in v2.3.3 this is how i adapted
	function display_price($products_price, $products_tax, $quantity = 1) {
// BOF: modification for AFP 
if($products_price=='0') {
  return '<a class="pricedrod" href="#">' . AFP_MESSAGE .'</a>';
  } else {  
return $this->format($this->calculate_price($products_price, $products_tax, $quantity)); 
}
   }
u must define this in your language file

Quote

define('AFP_MESSAGE', 'Ask for price');    // AFP message in local language

Edited by madbusu, 08 March 2013 - 01:12 PM.


#12   daniyar8701

daniyar8701
  • Members
  • 1 posts
  • Real Name:Danielle
  • Gender:Female
  • Location:Wisconsin

Posted 11 April 2013 - 05:36 AM

View Postmadbusu, on 08 March 2013 - 01:11 PM, said:

yeah it's working in v2.3.3 this is how i adapted
function display_price($products_price, $products_tax, $quantity = 1) {
// BOF: modification for AFP
if($products_price=='0') {
return '<a class="pricedrod" href="#">' . AFP_MESSAGE .'</a>';
} else {
return $this->format($this->calculate_price($products_price, $products_tax, $quantity));
}
}
u must define this in your language file

I've been trying for days to hide the price of items if it's $0. I have v2.3.3 and I used the above code, but when I click on the product, it still shows the price in the upper right corner.

I added the first code to the currencies.php file. And the second code to the english.php.

Am I doing something wrong? This is my first store and I seem to be getting nowhere :( Any help is greatly appreciated.