SQL error not letting me proceed to checkout.

Posts: 17
Joined: 08/26/2008

I'mi getting the following error:

user warning: Duplicate entry '0' for key 1 query: INSERT INTO uc_orders (uid, order_status, order_total, primary_email, delivery_first_name, delivery_last_name, delivery_phone, delivery_company, delivery_street1, delivery_street2, delivery_city, delivery_zone, delivery_postal_code, delivery_country, billing_first_name, billing_last_name, billing_phone, billing_company, billing_street1, billing_street2, billing_city, billing_zone, billing_postal_code, billing_country, payment_method, data, created, modified) VALUES (0, 'in_checkout', 0, '', '', '', '', '', '', '', '', 0, '', 0, '', '', '', '', '', '', '', 0, 0, 0, '', '', 1221578555, 1221578555) in /f1/content/ambitdesign/public/sites/all/modules/ubercart-6.x-2.x-dev/ubercart/uc_order/uc_order.module on line 2481.

When I try to proceed to 'review order' in checkout. I can't make heads or tails of this. I'm looking at the MySQL tables and just not finding anything. Please help!

I'm running UC on Drupal 6 - everything else in the cart seems to be working fine.

nate

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

Check that the order_id column on the uc_orders table has auto_increment set on it. That query is coming from uc_order_new(), and it's not recognizing that it needs a new order_id for it.

Did you try to upgrade to Drupal 6 with Ubercart? That's not supported yet because I haven't finished all of the database updates yet.

Posts: 17
Joined: 08/26/2008

I checked and the 'order_id' column is set to 'auto_increment'

What do you think I should check next? I'm really not very good with MySQL but I'm trying to learn.

Yes, this is on Drupal 6. I knew I was pushing it, trying to get Ubercart on 6.x but I just setup a multisite environment with Drupal 6 and really need to take my Ubercart sites into this environment. I figured the bugs would be worked out as I went.. unfortunately this dumb idea of mine cost me a number of sales.

Thanks for your help
Nate

Posts: 17
Joined: 08/26/2008

I have been poking around in the MySQL tables, and dumping some cache files. Now my order_id table starts at number 10.. no number 0

I've been reading forum posts etc. and it looks like Drupal (and maybe UC?) needs user 0 as the anonymous user number.. I'm totally guessing, I really don't know what I'm doing with all this, but problems are how we learn, right?

So I guess I'm wondering if I need to create user 0 in the order_id table. Only problem is, I have no idea how to do this!

Does any of this make sense?

Thanks!
nate

Posts: 1293
Joined: 08/14/2007
Bug FinderEarly adopter... addicted to alphas.Getting busy with the Ubercode.

That's probably what it is, from the sounds of it. My first thought was that order_id might need to be specified as one of the fields being inserted, but I guess not.

You shouldn't need to create a user 0 - basically what that error is saying is "You already have a uid >= 0 in your table, so I can't insert a new row with that same data". I'm not sure how it works on D6 but I just now that if uid is a key, for some reason it seems to not want to accept more orders for that uid. You don't have uid=0 but you have uid=10, and 10 > 0. This makes sense in my head, at least.

--

"Pain don't hurt." - Dalton

Mike Nelson's RiffTrax! www.rifftrax.com

Posts: 17
Joined: 08/26/2008

I'm telling you, I know noting about MySQL, I'm clueless.. although, I would love to learn more about it.

Well, if this is the problem than I'm stuck. I don't know how to add a user uid in MySQL. Any suggestions on where to go to learn how to "add" to this uid list?

Thanks for any help!

nate

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

The user id being 0 shouldn't have anything to do with it. It's got to be complaining about the order_id having the same value on different rows, but it really shouldn't be trying to put 0 in for that.

If your uc_orders table has rows in it, then making orders must have worked at some point. What are you trying to do when this error comes up?

Posts: 9
Joined: 04/19/2008

Just to note—I too am foolish enough to be trying to work on a pre-launch site in Drupal 6.x, and I am having this exact same error—simply trying to proceed to order review in the checkout process...

Basically, with a site under development now that is launching in mid November, I wasn't willing to commit to Drupal 5.x any longer, but Ubercart isn't quite there yet—kind of caught in the middle, but happy to do anything I can to help!

Posts: 9
Joined: 04/19/2008

Also, my error shows a similar lack of content even though I have already completed the first page of checkout and thus there should be content in most of those fields reported, yet there isn't...

ETA: Forget that. I see now what this code is doing—it is attempting to generate a blank record that is then updated in the function below.

Final: OK, this appeared to be a problem due to having previously installed Ubercart for 5.x in this development install, before I upgraded to Drupal 6.4. The solution was to disable all Ubercart modules, use the "Uninstall" feature in the modules section, and then reinstall. Is now working correctly.