Purchase OIOpublisher now for just $47.

Take control of your ad space.

Click here to purchase

    • CommentAuthorTechieGuy
    • CommentTimeOct 12th 2008
     

    Hi,

    I recently had someone attempt to purchase an ad, but the maximum number of Entrecard credits topped at 999.99, which is not the correct number for the ad.

    What could possible be the problem?

    • CommentAuthorSimon
    • CommentTimeOct 12th 2008
     
    Project Admin

    What version number? There was a problem with 2.02 along similar lines, but it should have been fixed.

    • CommentAuthorTechieGuy
    • CommentTimeOct 13th 2008
     

    I upgraded to 2.06, and the problem was still there. Is there a file I can look at?

    • CommentAuthorSimon
    • CommentTimeOct 13th 2008 edited
     
    Project Admin

    The purchase value is calculated in the include/purchase.php file:

    $item->payment_amount = number_format($item->payment_amount, 2, ".", "");

    Just before that line of code, there is a hook that is called (it works in the same way as a Wordpress plugin hook), which (in the case of an EC payment) calls the pre_purchase() function in the modules/entrecard/oiopub-load.php file.

    If you were to place an exit(); or die(); line of code under the code I referenced above, then you could make a purchase and print the $item->payment_amount value, to see whether it gets stuck at 999 or will go over 1000 before being saved in the database. You could then test things without saving lots of purchases into the database.

    • CommentAuthorTechieGuy
    • CommentTimeDec 2nd 2008
     

    I found the problem. The column that stores the purchase price in the database was set to decimal(5,2), which stored the price as 999.99. I changed it to decimal(7,2) and it seems to work.

    What should this column type be set to?

    • CommentAuthorSimon
    • CommentTimeDec 2nd 2008
     
    Project Admin

    It's set to 10,2 just to be sure, although 7,2 should be fine too.

  1.  

    Is there an update to fix this problem? I just encountered the same problem.

  2.  

    I'm using OIO version 2.07 and wordpress version 2.6.5

    • CommentAuthorSimon
    • CommentTimeDec 6th 2008 edited
     
    Project Admin

    It's been fixed for a while now, although it seems that a couple of people haven't had the fix applied by the upgrade routine.

    If you go to phpmyadmin, you can run the queries needed to fix the issue manually from the "SQL" tab:

    ALTER TABLE wp_oiopub_purchases MODIFY payment_amount decimal(10,2);
    ALTER TABLE wp_oiopub_purchases_history MODIFY amount decimal(10,2);
    ALTER TABLE wp_oiopub_affiliates_sales MODIFY affiliate_amount decimal(10,2);

    I've assumed that your Wordpress prefix is wp_ in this instance, but if it's anything different remember to change it before running the queries.