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 14 years, 9 months ago by joan.
-
AuthorPosts
-
January 26, 2010 at 7:20 am #706joanMember
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 #17539joanMemberSorry Ruhul, I spelt your name incorrectly.
January 26, 2010 at 10:59 pm #17540amin007ParticipantHi 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 #17541joanMemberThanks 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 #17542amin007Participantcouldn’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 #17543joanMembereStore 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?)
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 #17544amin007ParticipantFor 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 #17545joanMemberok 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 #17546joanMemberHi 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 #17547joanMemberHi 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 #17548joanMemberyou 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 #17549amin007ParticipantIt’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 #17550joanMemberI 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
-
AuthorPosts
- You must be logged in to reply to this topic.