WordPress.org

Ready to get started?Download WordPress

Forums

Charging by Word Count (4 posts)

  1. theclimbingdrums
    Member
    Posted 1 year ago #

    I am currently working on a site for a client that offers proof writing services and need some help with the checkout system.

    The ideal system would work like this:

    The user fills out a form with information about the paper (format, structure, etc.). The user then copy and pastes their paper into a textarea that counts the number of words and displays a total in a read-only input box below. Everything up to this point is definitely doable. Where I'm running into trouble is having the calculation then affect the total price of the service (charging by word, depending on the number of days selected until the paper is due). Again, I can write a script to do all this and calculate the total price, but I don't know how to send the form information to the database and then enter the total price into a custom Paypal field in order to use Paypal to charge the user.

    I have thought about doing this a few different ways but am open to suggestions. One is to accept the user information on one screen and after submitting it to the database, having a second screen that imports the word count price calculation into the Paypal custom field.

    Another idea (ideally) would be to send the form to two places, both the database as well as to Paypal so that it would take less clicks for a user to submit and purchase the service.

    Another idea I had was to use an altered shopping cart plugin like WP-Ecommerce and create some kind of custom field that would help in calculating all of this, but unfortunately, try as I might, I haven't been able to figure out how to make it work as it should.

    Any help or ideas would be greatly appreciated. I have limited PHP knowledge and need any solutions like this spelled out for me. Let me know if any more information is needed or if I'm not clear about what needs to happen. Thanks in advance!

  2. ClearCode Software
    Member
    Posted 1 year ago #

    You would not want to accept the word count from an input field. Input fields can easily be manipulated using Firebug, or Chrome's Developer Tools, etc. etc. It would be trivial to change the value to 5,000 when only submitting a 200 word paper.

    Yes its nice to have the Javascript word count updating live, but do not rely on that for billing / payment situations.

    Its better to accept the complete text through the form submission and re-calculate the word count on the server. Also, be sure to store the original full text for auditing purposes, incase there is a billing / payment dispute later.

  3. theclimbingdrums
    Member
    Posted 1 year ago #

    That's a great point, something I hadn't thought of, so thanks for that.

    Any thoughts on how to accomplish all of that?

  4. theclimbingdrums
    Member
    Posted 1 year ago #

    Ok, so I've decided that the best thing I can do is to pull the word count from the database on a secondary page in which users will see the price of the service and click a button that will then take them to Paypal. The only issue I'm having is figuring out how to pull a field from the cforms plugin (http://www.deliciousdays.com/cforms-plugin/). I'm not the best with writing a sql statement to access the database (I'm not sure if that's what needs to happen or if I can use a php call like you would with the Advanced Custom FIelds plug [http://www.advancedcustomfields.com]).

    Can anyone get me started or show me some documentation on how to pull a field of data from cforms in my WordPress database?

Topic Closed

This topic has been closed to new replies.

About this Topic