close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

confirm.php not saving Order Summary data

Thread began 2/20/2012 11:53 am by martin400112 | Last modified 2/22/2012 12:00 pm by Jason Byrnes | 746 views | 7 replies |

martin400112

confirm.php not saving Order Summary data

Hi!
I have been putting a site together for a client who pays commission to her staff when an order is placed by one of their logged in customers.

In order to cope with the possibility of a change in commission rate down the line, I am trying to add a new column to the orders table called Ord_Comm. I currently have the datatype set as FLOAT (the same as the OrderAmount field).

I have added the commission calculation to the form using some basic php maths. The grand total is taken from the e-cart object and the commission rate is taken from a recordset. The calculation in the hidden field on the form displays perfectly.

Now, in the Store Summary in Database behaviour, I have linked my Ord_Comm database field with the 'commission' field in the form on the page, but it will not save the calculated commission rate into the database.

At the same time, there is another column called 'ComPaid_ord' which has a value of '0' added into the Store Summer in Database behaviour and this enters '0' in every time I put a dummy order through.

Any ideas? My client is demonstrating this on Wednesday evenign (UK time) and would greatly appreciate a pointer or two on what's going on...or not!

Many thanks,

Martin

Attached Files
form_confirm.zip
Sign in to reply to this post

Jason ByrnesWebAssist

If you view source of the confirm page in the browser, what is the value of the commission form element?


I would suspect that the calculation you have for the commission element is not returning the proper value.





For the ComPaid_ord column, you have hard coded the value to be 0 in the store order summary behavior.

Sign in to reply to this post

martin400112

Hi Jason,

Thanks for coming back to me. Here is a copy of the source code from the page in action on the site:

Line 272 and 273 show the grand total to be GBP 17.20 which is correct.

Line 300 gives the correct commission value (in this case 10%) as being 1.72 (no currency setting. The commission is calculated using the results from a recordset and the Grand Total of the session)

So, the total is correct and the commission value is correct too....yet the Save Summary to Database behaviour is not saving this figure to the database....but the hard coded 'ComPaid_ord' is being entered as '0'.

Just to recap, in the database, the commission field called 'Ord_Comm' (where the form value id=commission from line 300 (in the attached source code) should be stored) is set to FLOAT.

as everything appears to be correct....I still can't see what's going wrong with it!

Many thanks,

Martin

Attached Files
confirm_php_source.zip
Sign in to reply to this post

Jason ByrnesWebAssist

to help troubleshoot, change the following line:

php:
$WA_Sql = "insert into " . $WA_table . " (" . $insertParamsObj->WA_tableValues . ") values (" . $insertParamsObj->WA_dbValues . ")";



to:

php:
$WA_Sql = "insert into " . $WA_table . " (" . $insertParamsObj->WA_tableValues . ") values (" . $insertParamsObj->WA_dbValues . ")";

die("SQL: ".$WA_Sql."<br /><pre>".var_dump($_POST)."</pre>");



this will write the insert SQL and the form values to the screen, please post this information back.

Sign in to reply to this post

martin400112

Hi,
Have changed the file as requested and this is the data that is returned:

array(25) { ["firstname"]=> string(6) "Martin" ["lastname"]=> string(11) "Saban-Smith" ["email"]=> string(24) "editor@thisisalton.co.uk" ["phone"]=> string(12) "07713 349883" ["fax"]=> string(0) "" ["street1"]=> string(9) "Garthowen" ["street2"]=> string(10) "Alton Lane" ["city"]=> string(10) "Four Marks" ["state_province"]=> string(9) "Hampshire" ["postcode"]=> string(8) "GU34 5AJ" ["country"]=> string(2) "GB" ["eC_SameAs"]=> string(1) "1" ["shipping_firstname"]=> string(6) "Martin" ["shipping_lastname"]=> string(11) "Saban-Smith" ["shipping_email"]=> string(24) "editor@thisisalton.co.uk" ["shipping_phone"]=> string(12) "07713 349883" ["shipping_fax"]=> string(0) "" ["shipping_street1"]=> string(9) "Garthowen" ["shipping_street2"]=> string(10) "Alton Lane" ["shipping_city"]=> string(10) "Four Marks" ["shipping_state_province"]=> string(9) "Hampshire" ["shipping_postcode"]=> string(8) "GU34 5AJ" ["shipping_country"]=> string(0) "" ["Checkout_x"]=> string(2) "19" ["Checkout_y"]=> string(1) "7" } SQL: insert into orders (OrderUserID,OrderAmount,OrderShipName,OrderShipAddress,OrderShipAddress2,OrderCity,OrderState,OrderZip,OrderCountry,OrderPhone,OrderFax,OrderShipping,OrderTax,OrderEmail,OrderDate,ComPaid_ord,mentor_ord,Ord_Comm) values (86,15.00,'Martin Saban-Smith','Garthowen','Alton Lane','Four Marks','Hampshire','GU34 5AJ','','07713 349883','',2.5,0,'editor@thisisalton.co.uk','2012-02-22 09:59:22',0,74,NULL)


FYI - Order Grand total was GBP 15.00 - therefore, the Ord_Comm value should be 1.5, but I think is showing NULL.

I have had to put the original confirm.php file back in place as the shop is currently live.

Many thanks for your continued help.

Martin

Sign in to reply to this post

Jason ByrnesWebAssist

ok, i see now.

you need to add the commission form element top the checkout page.

you are using paypal standard, so the form on the confirm page posts to paypal.

the order summary and details are stored when the checkout page posts to the confirm page.

Sign in to reply to this post

martin400112

Brilliant!

Thanks, Jason.....first class as always!

Martin

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...