Tips and Tricks HQ Support

Support site for Tips and Tricks HQ premium products

  • Home
  • Contact Us
  • Documentation
  • Forum Home
    • Forum
    • Forum Search
    • Forum Login
    • Forum Registration

Simple Shopping Cart – Capture Extra Information

by

Tips and Tricks HQ Support Portal › Forums › Simple PayPal Shopping Cart › Simple Shopping Cart Tweaks › Simple Shopping Cart – Capture Extra Information

  • This topic has 12 replies, 2 voices, and was last updated 15 years, 3 months ago by joan.
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • January 26, 2010 at 7:20 am #706
    joan
    Member

    Hi, I am soooo excited! It may be useful for those who wanted a database to store products that it can be done with a mysql table and php calls to display the data in a html table, as per my test page: [http://travelhorizonstyle.com.au/days/1-day/golf/]

    I have favour to ask to make this the most perfect Shop plugin ever (for me). I was impressed with how empowerednutrition.com/shop/ must have coded a discount coupon. Working along those lines I want to capture extra information, before checkout, eg a customer passport number.

    I used your tweak to direct Simple shopping Cart to the following page:

    [http://travelhorizonstyle.com.au/my-tours/my-itinerary/]

    In the wp_shopping_cart.php file, before the following:

    $output .= "<form action="https://www.paypal.com/us/cgi-bin/webscr" method="post">$form";

    I wanted to use MM Forms which is a plugin that writes the form results to a database. I created an MM Form and placed the trigger text above as such:

    $output .= "[form 2 'checkout']<br>";

    but all I got was the literal printout. At this stage I haven’t found the MM Forms alternative php code, as they seem to have done callbacks differently. So rather than adding a new form like:

    <form action="" method="post">
    <input type="text" size="10" value="" id="coupon_code" name="coupon_code">
    <input type="submit" value="Apply">
    <input type="hidden" value="1" name="eStore_apply_discount"></form>

    I was wondering if you know how to execute a typical shortcode enclosed in [] brackets, eg. [form 2 ‘checkout’]?

    Please excuse me for rambling,and you’re welcome to delete whatever you see superfluous (too much). Regards, Joan

    January 26, 2010 at 8:53 am #17539
    joan
    Member

    Sorry Ruhul, I spelt your name incorrectly.

    January 26, 2010 at 10:59 pm #17540
    amin007
    Participant

    Hi Joan, Shortcodes are executed by WordPress. A PHP script has no knowledge of shortcodes. shortcodes is just a mechanism so you can put a bit of text in a post or page which eventually gets filtered by WordPress (it calls the corresponding PHP unction). So there has to be a PHP function call that does the actual work. You will need to use that PHP function inside your script and it will work fine.

    If the documentation of the other plugin do not state what this function name is then you can take a look at the code yourself and find it out.

    January 28, 2010 at 10:53 am #17541
    joan
    Member

    Thanks Ruhul for replying so soon. I’m not yet familiar with how callback functions work, so although I’ve combed through the mm forms code, I can’t figure how to call the php function. Probably other people would also need to collect extra info before Simple Shopping Cart checkout too. I see now that empowerednutrition.com/shop/ mentioned above is just using your eShop plugin to collect a coupon code. Using mm forms would make that easily customised and store the results, but the plugin seems to be unsupported (unlike yours which is fantastic!). If you have any ideas that can get me going, I’d be very grateful. Kind regards, Joan.

    January 29, 2010 at 6:24 am #17542
    amin007
    Participant

    couldn’t you use the “Collect Customer Input” feature of the eStore plugin to collect special instruction from your buyer?

    January 30, 2010 at 9:03 am #17543
    joan
    Member

    eStore is great but

    A) There are around 10 fields to collect, eg phone, mobile, passport#, Name of 2nd traveller, Name of 3rd traveller (etc), Insurance Req Y/N , Airfares Req Y/N, Special Instructions…(I dont think it can have that many custom fields, can it?)

    B) With Simple Paypal I can use my own database table for the products (fields are code,date,RRPrice,ourPrice…etc). eStores tables are ‘fully normalised’ I presume, so that products and variations are in separate tables, which would be extra work to get the data into your tables, then I have to use your productID field in the post to display the table… I’m thinking it is more work. Perhaps if I could see your database structure I could see if I could load into your tables? Is that possible?

    February 1, 2010 at 12:56 am #17544
    amin007
    Participant

    For your situation you are better off doing what you had in mind. you should just be able to dump all the values to a database table inside WordPress easily. Look up some Ptutorials on how to do this and you should be set I think.

    February 1, 2010 at 10:26 am #17545
    joan
    Member

    ok thanks Ruhul, I’ll work on a custom form that writes to a database table and share the results (when I’ve figured it). BTW, I’m better on callback functions now, but still can work out the mm forms code. Finally, can you give me an intro on sending the collected Firstname/surname to the Paypal screen ?

    February 1, 2010 at 2:29 pm #17546
    joan
    Member

    Hi Ruhul,

    I hope you’re interested to know that I can embed your Simple Paypal Shopping Cart into an mm Form, simply by typing [show_wp_shopping_cart] into the mm form design area. This is quite exciting. mm forms then writes the extra info to the database, when its “submit” button is pressed. Of course I want the Paypal button to be pressed instead, so I could alter your code to execute the mm forms write to database function, but I’m not confident to do that.

    Don’t worry about passing the Firstname/surname to paypal… I’ve got that sorted. So I’m back to creating a form to capture the extra info, in your code… Regards, Joan

    February 4, 2010 at 10:45 am #17547
    joan
    Member

    Hi Ruhul,

    Into your wp_shopping_cart.php file which displays the checkout page, within a form, I added two input boxes, as below:

    <form action="http://www.travelhorizonstyle.com.au/wp-content/cust-write.php" method="post" name="book"><input type="text" size="10" value="" name="First"><br><input type="text" size="10" value="" name="Last"><input type="submit" value="NEXT"></form>';

    Into the cust-write.php file I have tried various methods to get these two fields to be written to the database, without success as I keep getting an error about and invalid object… The variations are commented out below:

    <?php
    function save() {
    global $wpdb;
    $key1 = "user_login";
    $key1 = "user_nicename";
    $First = $_POST['First'];
    $Last = $_POST['Last'];
    $result = $wpdb->query( $wpdb->prepare( "INSERT INTO {$wpdb->customers} ( user_login, user_nicename ) VALUES ( %s, %s )", $First, $Last ) );
    //$wpdb->insert( 'table', array( 'column1' => 'value1', 'column2' => 123 ), array( '%s', '%d' ) )
    //$wpdb->insert( $wpdb->customers, array( user_login => $First, user_nicename => $Last ) );
    //$wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->customers ( $key1, $key2 ) VALUES ( %s, %s )", $First, $Last ));
    //$wpdb->query( $wpdb->prepare( " INSERT INTO $wpdb->customers ( user_login, user_nicename ) VALUES test, tester ));
    //$wpdb->query("INSERT INTO $wpdb->customers VALUES(" .$First .",". $Last . ")");
    $wpdb->flush();
    //Parse error: syntax error, unexpected T_OBJECT_OPERATOR i
    //Call to a member function insert() on a non-object in..line 7
    //Call to a member function query() on a non-object in.. line 8
    //return $result;
    }
    ?>

    Can you give me suggestions as to why it will not write the the database table ‘customers’ ??

    Kind regards,

    Joan.

    February 7, 2010 at 1:53 am #17548
    joan
    Member

    you should just be able to dump all the values to a database table inside WordPress easily. Look up some Ptutorials on how to do this and you should be set I think.

    Ok I’m getting desperate, and on the verge of giving up with Simple Paypal. Can you please give me some websites which explain the above? I have tried so many versions of the above. Regards, Joan

    February 7, 2010 at 11:53 am #17549
    amin007
    Participant

    It’s probably better if you find a cart that matches with your needs. I don’t really know what examples to give as it’s coding related.

    February 7, 2010 at 1:59 pm #17550
    joan
    Member

    I have found eShop has the perfect checkout pages, and Simple Paypal has the perfect button flexibility in placing buttons anywhere on the post. Both plugins use the wordpress post as the product. If only you could combine them :)

  • Author
    Posts
Viewing 13 posts - 1 through 13 (of 13 total)
  • You must be logged in to reply to this topic.
Log In

Forum Related

  • Forum Home
  • Forum Search
  • Forum Registration
  • Forum Login

Support Related Forms

  • Contact Us
  • Customer Support
  • Request a Plugin Update
  • Request Fresh Download Links

Useful Links

  • Plugin Upgrade Instructions
  • WP eStore Documentation
  • WP eMember Documentation
  • WP Affiliate Platform Documentation
  • Tips and Tricks HQ Home Page
  • Our Projects

Quick Setup Video Tutorials

  • WP eStore Video Tutorial
  • WP eMember Video Tutorial
  • WP Affiliate Platform Video Tutorial
  • Lightbox Ultimate Video Tutorial

Our Other Plugins

  • WP Express Checkout
  • Stripe Payments Plugin
  • Simple Shopping Cart Plugin
  • Simple Download Monitor

Copyright © 2025 | Tips and Tricks HQ