View Full Version : SQL errors
Two errors:
1. In PowerStore, confirm.php, line 512.
$WA_indexField = "DetailOrderID";
should be: $WA_indexField = "DetailID";
2. Using the checkout wizard with eCart, paypal standard selected, I would think that the save to database should overlay the PowerStore schema.
a. $WA_fieldNamesStr = "OrderShipping|OrderTax|OrderTotal";
OrderTotal is not a field in the schema as defined in PowerStore. OrderAmount is probably the intended field but.....who knows without any comments in the schema.
b. $WA_indexField = "DetailsID"; is the generated code while it
should be: $WA_indexField = "DetailID";
While #2 is technically not a bug, it should be changed if for no other reason than maintainability by Webassist. It would also help the user.
Ray Borduin
06-29-2009, 08:39 AM
1) In PowerStore, confirm.php, line 512... Should be as it is:
$WA_indexField = "DetailOrderID";
The index field it is asking for is actually the index field of the Cart, or the OrderTable index field, which is DetailOrderID.
You should change this back otherwise you may have issues with items being mysteriously deleted and extra items when someone goes to paypal and then returns to your site to shop again using paypal standard.
2) is technically not a bug, and the names were close enough so that you were able to logically deduce the correct association without aide of documentation. It is a valid point, but probably not worth updating at this point unless we were already updating the database structure of that table.
Thank God for the safety net! Thanks Ray. I have more problems though in that I have to modify all of this for my new schema which incorporates options. With that in mind I'm trying to understand exactly what is happening in this section. From a high level we are building some sql strings to use in inserting the order details. There can be multiple rows for each purchase or row in the orders table. I don't understand why we are doing deletes here. Can you tell me from a high level why that happens? Then I have to change some columns and there is this column type thing going on.
$updateColType = "none,none,NULL|',none,''|',none,''|none,none,NULL| none,none,NULL";
It looks like we are building a two dimensional array for generating a sql string. Do you know from a high level what is going on there?
Thanks.
Ray Borduin
06-30-2009, 09:05 AM
Technically you shouldn't have to do deletes for order details when it is used in checkout.
The reason why it does deletes is that the same two server behaviors can be used to create a "registry" or "wish list" cart that updates every time you add an item to it. In that case you need to make sure old items are removed because the entire cart is re-inserted.
In the checkout scenario the delete code should never delete anything since there won't already be orders details associated with the order being inserted... so the delete does nothing in this case. In some cases users insert order details before going to paypal standard and just mark them as confirmed on return. This is another case where delete is needed in case someone cancels and decides to go back and continue shopping after visiting the paypal site.
The short answer is the delete is there just in case it is needed, but in your case it should not be needed but shouldnt' harm anything when configured properly.
The string is a standard string used in the DW insert and update server behaviors. We borrowed the syntax for consistancy. It is a multidimensional delimited array as you have guessed. You first break it into an array around the "|"... and there should be one for each column.
So this string has five columns. Then the next array is split around the comma... so you have two groups:
none,none,NULL
and:
',none,''
These change according to your database field type:
encapsulating character, included value ,not included value
encapsulating character is usually a single quote for text or varchar fields and none for numeric fields at least in mySQL.
included value replaces the actual submitted value when present. It is mostly used for checkboxes and boolean fields so that you insert 1 or 0 regardless of the actual input.
not included value is the default to use if the field is not included in the form.
I can't seem to find where $_SESSION['OrderID'] is set. It's used a number of places but where is it ever set?
Ray Borduin
07-01-2009, 11:30 AM
It is set in Store Cart Summary in database on the confirm page.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.