close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Updating New Field in Orders Table

Thread began 1/20/2011 10:25 am by carlene | Last modified 1/28/2011 1:04 pm by Jason Byrnes | 2526 views | 10 replies |

carleneBeta Tester

Updating New Field in Orders Table

Hello!

I need to have 2 new fields record data from the order forms into the ps3_orders table. How do I do this?

I've customized my PS3x store pretty heavily and am using it as a wholesale customer store. We have pre-assigned CustomerID numbers that need to correspond to each customer's orders. I have added this field to the ps3_users table and this data is correctly transferred to this new field in the table when users register. (They must input their Customer ID as well with registration.) I also added a field for the Customer's Business Name to the psd3_users table as well. All data is recorded properly upon registration.

My problem is with the orders. I've tried to add these fields to the checkout.php page - but the data is not recording in the ps3_orders table. I know that the confirm.php page is actually the page that records the checkout.php information into my database. Our store has no payment gateway because we pre-approve then process it internally.

I also need these two new fields to show up in my Admin order fields as well. We don't need First and Last name of the customers. Instead we need to see the CustomerID (ours, not the automatic UserID that the database generates), and the Business Name for all orders and in the Admin area of the store.

I'm not sure the best way to go about doing this. I've tried many different things and nothing seems to work. I do have DataAssist and all of the other WebAssist programs at my disposal. This one little problem is causing lots of issues for my store's usability here at the company.

I know that a session variable with the Customer ID from the PS3 users would come in handy - just don't know how to go about this.

Thanks! Carlene

Sign in to reply to this post

Jason ByrnesWebAssist

for these values to populate into the orders table, you need to follow a couple of additional steps aside from just adding the form fields to the checkout page.

For every form filed on the checkout page, you will see two things on the confirm page:

1) Near the bottom of the confirm page, there is a collection of hidden form elements set to capture the values posted from the checkout page

2) Near the top, there is code to store the posted values into session variables.


For each form element you add to the checkout page, you will need to add a corresponding hidden element that has the same name and is coded to capture the value from the checkout page.
So if you have a text box named "business", you need to add the hidden form element to the confirm page like:

php:
<input type="hidden" name="business" id="business" value="<?php echo ((isset($_POST["business"]))?$_POST["business"]:""?>" />




then go to the server behaviors panell, clic kthe plus button and select eCart -> General -> Set Session value.

Set the trigger to any form post.

Set the name to be the same as the form element, in this example "business"

then click the lightning bolt next to value and select the business form element.


Once you have the set session value behavior and the hidden form element in place, you need to edit the Store Order Summary behavior to bind the new columns of the orders table to the form element that was added to the confirm page.


to edit the admin, yo should just be able to go to the bindings panel and select the new columns from the orders table and drag them to the display page.

Sign in to reply to this post

carleneBeta Tester

Jason,

Now I am having a problem with the checkout_success.php page not showing up. Also the Added field information is still not being added to the database. I've followed your instructions.

What should I do?

Thanks!

Carlene

Sign in to reply to this post

Jason ByrnesWebAssist

most likely there is an error occuring on inserting the order information.


add the following code to line 1 of the confirm page:

php:
<?php

error_reporting
(E_ALL);
ini_set('display_errors','on');
?>




post back any errors and a copy of the confirm page so i can see the code.

Sign in to reply to this post

carleneBeta Tester

Hi Jason,
I did have error reporting on. No errors are reported. It just doesn't go to the checkout_success.php page. It stays on the confirm.php page. I'm attaching the pages. The order is recorded in the database, but the CustomerID field that I added is not recorded. I created a field in the Orders Table called OrdersCustomerID. Not sure what I did wrong or why that won't record there. Or is this the best approach? The CustomerID is also recorded in the ps3_users table as CustomerID. Perhaps I could somehow have a session variable referring to that with the UserID field - but either way. For this to work with our system we need our internal CustomerID to always be associated with an order.

Thanks!

Attached Files
checkout.php.zip
confirm.php.zip
Sign in to reply to this post

carleneBeta Tester

One note - I did in the past, have problems with any WebAssist software when I chose the "any form post" as the trigger rather than "current form submit." for the eCart behavior I did choose "any form post" as you specified. But I copied the other Post behaviors as written on the confirm page. (I wrote <input type="hidden" name="CustomerID" id="CustomerID" value="<?php echo ((isset($_SESSION["eCartCheckoutForm_CustomerID"]))?$_SESSION["eCartCheckoutForm_CustomerID"]:"") ?>" />)

Instead of just the Post commands that you had advised. Could that be the source of the problems?

Sign in to reply to this post

Jason ByrnesWebAssist

could be the cuurent page submit trigger.


try changing any instance you see of:

php:
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST))  {




to:

php:
if (isset($_POST["Submit_order"]))  {
Sign in to reply to this post

carleneBeta Tester

Thanks so much Jason. I changed the line and tested it - and I get these error messages.

Any suggestions? I greatly appreciate the help - this is the final thing keeping my store offline right now.


Notice: Undefined offset: 15 in /var/www/vhosts/folkmanis.com/httpdocs/wholesale/store/WA_eCart/WA_eCart_Database_PHP.php on line 18

Notice: Undefined offset: 1 in /var/www/vhosts/folkmanis.com/httpdocs/wholesale/store/WA_eCart/WA_eCart_Database_PHP.php on line 20

Notice: Undefined offset: 1 in /var/www/vhosts/folkmanis.com/httpdocs/wholesale/store/WA_eCart/WA_eCart_Database_PHP.php on line 20

Notice: Undefined offset: 2 in /var/www/vhosts/folkmanis.com/httpdocs/wholesale/store/WA_eCart/WA_eCart_Database_PHP.php on line 21

Notice: Undefined offset: 2 in /var/www/vhosts/folkmanis.com/httpdocs/wholesale/store/WA_eCart/WA_eCart_Database_PHP.php on line 21
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@stormcrowpictures.com,0)' at line 1

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

Sign in to reply to this post

carleneBeta Tester

Thanks so much for your help Jason!

The WebAssist Product Support team rocks!! : )

Sign in to reply to this post
loading

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...