I use OIOpublisher for providing advertising on Technically Easy. I have found it very easy to use, and the support I have received has been excellent. I have, however, run into a problem when I offered advertising on my blog for Entrecard credits. When I recently purchased advertising on other blogs with OIOpublisher using Entrecard credits, I realized that others were having the same issue.
I eventually corrected the problem, and explain what the problem is and how to fix it in this post.
Using OIOpublisher with Entrecard Problem
As mentioned above, I recently had an issue with only being able to receive 999 Entrecard credits (ec) when someone purchased an ad spot on Technically Easy. Regardless of the price of the ad spot, I always only received 999ec.
I reported my issue on the OIOpublisher forums, and did receive a response from the creator of OIOpublisher by the next day. Unfortunately, without being able to log into my blog and look at the code, it was difficult for him to debug. He did point me to a file that could had been the possible problem. I looked at the file, but couldn’t find anything wrong.
After writing that post on the forum, I then turned my attention to Entrecard. After a few feedback messages to Entrecard (and several weeks), someone mentioned that there wasn’t a limit on the number of credits that could be transferred using the Entrecard API. My issue ticket was then closed.
After not finding a solution, I decided to trace through the transaction and the code myself on a local copy of WordPress. I like to have WordPress installed on my local desktop, with a copy of my blog and plugins for testing and troubleshooting purposes. It took me less than an hour to find the problem.
The Issue
I scanned through the code looking for anything that provided an upper limit of 3 digits for an amount. I found nothing in the code. When I placed my order, I managed to record the number throughout the transaction and noticed it didn’t change…until after it was saved to the database. The saving to the database occurs once you submit the purchase, but before your are sent to Entrecard for payment.
I opened up my WordPress database and looked for the table that stores the payment amount. This table is called wp_oiopub_purchases. I then located the field that stored the payment amount which was easy to find. The field is called payment_amount.
When I inspected the data type of the field it was set to decimal(5,2), which means it was a number that contained 5 digits, with two of the digits appearing after the decimal point. This would mean the largest number that could be stored in the field would be 999.99, which is the amount of Entrecard credits that was always charged.
I changed the data type to decimal(7,2) to allow for a number as large as 99999.99, and all worked fine. If you have a problem with OIO only accepting up to 999 credits, check your database to ensure the payment_amount field in the wp_oiopub_purchases database is not set to decimal(5,2).
Related Posts
Do You Provide Private Advertising on Your Site?