When adding certain parts to an order on the manual order create page, I get the following error:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/ajax
StatusText: Service unavailable (with message)
ResponseText: PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect decimal value: '' for column 'price' at row 1: INSERT INTO {uc_order_products} (order_id, qty, price, data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array
(
[:db_insert_placeholder_0] => 28
[:db_insert_placeholder_1] => 1
[:db_insert_placeholder_2] =>
[:db_insert_placeholder_3] => a:2:{s:10:"attributes";a:0:{}s:9:"shippable";i:1;}
)
in drupal_write_record() (line 6859 of /drupal/includes/common.inc).

It appears that the price is not getting across for some reason. This particular part is a zero-dollar part, but I can't seem to figure out why some parts work and others do not. Other parts (both zero-dollar and greater) add just fine. I have tried changing the price but that has not helped. Looking directly at the database, there are no fields that seem wrong or blank. It looks exactly like another part that adds in just fine. Any ideas?

Comments

bancarddata’s picture

Want to follow up with further log entries related to the above error (they all occur at the exact same time as the error mentioned above):

Notice: Trying to get property of non-object in uc_order_add_product_form() (line 337 of drupal/sites/all/modules/ubercart/uc_order/uc_order.order_pane.inc).

Notice: Undefined property: stdClass::$sell_price in uc_order_edit_products_add() (line 565 of drupal/sites/all/modules/ubercart/uc_order/uc_order.order_pane.inc).

Notice: Trying to get property of non-object in _uc_attribute_alter_form() (line 1244 of drupal/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).

Notice: Undefined property: stdClass::$nid in _uc_cart_product_get_options() (line 1195 of drupal/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).

Notice: Undefined property: stdClass::$nid in uc_attribute_uc_cart_item() (line 534 of drupal/sites/all/modules/ubercart/uc_attribute/uc_attribute.module).

Notice: Trying to get property of non-object in uc_product_kit_uc_form_alter() (line 76 of drupal/sites/all/modules/ubercart/uc_product_kit/uc_product_kit.module).

longwave’s picture

Status: Active » Postponed (maintainer needs more info)

Can't reproduce this, but it looks like either the selected node object is being lost somehow, or the node is not being loaded.

Exactly which button did you click on to receive this error? Is it always the same products that fail?

bancarddata’s picture

On /admin/store/orders/XX/edit:

Clicked on "Add product", then typed 1704 into SKU field and clicked "Select", then clicked "Add to order". It then pops up the error message without adding it to the cart. It now seems as though ALL parts are exhibiting this behavior. So let me recap exactly when this started:

Created new order - User added a new customer and then added two products to order and those were fine. Realized one product was not in catalog yet, so saved the order and went to Content and added the product to the catalog. The user then appeared to double-click save on that screen, thus there were 2 identical products listed (they were nid's 204 and 205). We deleted 204. Went back to add that product to the original order. That is when we saw the problem first.

I have since gone back and deleted the other node 205 and recreated the node from scratch which is now 206. Looking at the database, I don't seem to see any mention of 204 or 205 anywhere. In uc_products it shows nid 206 tied to SKU 1704. Comparing the entire record to other lines seems to look just fine. I have flushed caches, restarted apache, etc. I even updated to the latest dev release of UC3 as well as the latest Drupal (from 7.4 to 7.7) and ran the update script. No go.

It must be something to do with the duplication that occurred. I suppose I can restore the database from a backup and try to re-add the product. We are not in production yet, but man I'd hate for something like this to occur when we are!

bancarddata’s picture

OK, ignore previous message. I was wrong. It seems to always happen when I type the SKU into the field and click select, then Add to Order. If I manually pick it from the list, then click select, then add to order, all is well.

longwave’s picture

Category: support » bug
Status: Postponed (maintainer needs more info) » Active

Oh, I see - if you don't select anything from the product list before clicking Select, it always fails - you need to click Search, then select the product (even if it's only one), then click Select. This should be fixed by streamlining the whole select/search/add process.

bancarddata’s picture

I was pretty sure it used to work - entering in the SKU and then clicking select. Perhaps I am mistaken. Anyway, so long as we know what to do and what not to, we should be fine. We do still seem to have a lot of AJAX related issues on that page, such as the province list when we choose Canada for the address. We also will not see any products get added to the order until we add at least one and then click save (or otherwise refresh the page with a save) After that they show up properly. Lastly, when we choose "Credit card" as the payment method, it does not show the fields for credit card and if we click save it complains bitterly, with about a dozen notices related to credit card fields being empty. I believe this is all being hashed out on #1182520: Convert order creation and editing forms to D7 Ajax. And now that I look, it appears you have already committed a patch! I will get to testing!

Thanks!

longwave’s picture

Thanks for the detailed report, I will test out and fix all those when I get time.

longwave’s picture

Status: Active » Fixed

Added validation to that part of the form in http://drupalcode.org/project/ubercart.git/commitdiff/e9e68bd

The UI could still be improved, that can be dealt with in the other issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.