Fixing Proper Price Format
Okay I've been working on this for a while and finally have a pretty good and fairly simple solution.
Problem: People can type whatever they want into price and it spits it out.
Semi-Solution: We are going to enable the "change price format" code that Classipress already has builtin, and then modify it slightly.
1. Find cp_get_price($postid) in the file \includes\theme-functions.php
2. Find the lines under "// uncomment the line below to change price format "
3. Replace them with the following code:
// uncomment the line below to change price format
$price_out = ereg_replace("[^0-9]", "", $price_out);
$price_out = ($price_out / 100);
$price_out = number_format($price_out, 2, '.', ',');
$price_out = cp_pos_currency($price_out);
This will take whatever they put in as a price, take out anything thats not a number (including the decimal) and the move the decimal back over into the proper place. You can see an example of its use by submitted an ad on http://mytacksales.com/
Last edited by pepsi; November 10th, 2010 at 03:28 PM.
~ Seth Carstens, Sethmatics Inc.