Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Fixing Proper Price Format

  1. #1
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Post 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:
    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.


  2. The Following 2 Users Say Thank You to scarstens For This Useful Post:

    liewzy (June 11th, 2011), pauro (June 20th, 2012)

  3. #2
    Veteran rodeoramsey's Avatar
    Join Date
    Jan 2010
    Location
    Ohio
    Posts
    274
    Thanks
    3
    Thanked 13 Times in 10 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~Ramsey
    ClassiPress Custom Design by Cowgirl Expressions

  4. #3
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  5. #4
    Veteran rodeoramsey's Avatar
    Join Date
    Jan 2010
    Location
    Ohio
    Posts
    274
    Thanks
    3
    Thanked 13 Times in 10 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~Ramsey
    ClassiPress Custom Design by Cowgirl Expressions

  6. #5
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  7. #6
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  8. #7
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  9. #8
    Veteran rodeoramsey's Avatar
    Join Date
    Jan 2010
    Location
    Ohio
    Posts
    274
    Thanks
    3
    Thanked 13 Times in 10 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~Ramsey
    ClassiPress Custom Design by Cowgirl Expressions

  10. #9
    Community Partner scarstens's Avatar
    Join Date
    Apr 2010
    Location
    Cave Creek, AZ USA
    Posts
    912
    Thanks
    2
    Thanked 129 Times in 86 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~ Seth Carstens, Sethmatics Inc.


  11. The Following User Says Thank You to scarstens For This Useful Post:

    deevey (April 18th, 2012)

  12. #10
    Veteran rodeoramsey's Avatar
    Join Date
    Jan 2010
    Location
    Ohio
    Posts
    274
    Thanks
    3
    Thanked 13 Times in 10 Posts

    Re: Fixing Proper Price Format

    You must be an AppThemes customer and logged in to view this response. Join today!
    ~Ramsey
    ClassiPress Custom Design by Cowgirl Expressions

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Is it possible to price by groups?
    By ThemeSwitcher in forum ClassiPress General Discussion
    Replies: 1
    Last Post: July 18th, 2009, 08:31 AM