I'm just trying to create an order in code like this:
$selected_month = $form_state['values']['month']; $selected_year = $form_state['values']['year']; $order = commerce_order_new($form_state['values']['user'], 'checkout_checkout'); commerce_order_save($order); $order_wrapper = entity_metadata_wrapper('commerce_order', $order); $product = commerce_product_load($form_state['values']['product']); $line_item = commerce_product_line_item_new($product, 1, $order->order_id); commerce_line_item_save($line_item); $order_wrapper->commerce_line_items = $line_item; dpm($order_wrapper->value()); $order_wrapper->save();
This in inside an form submit callback, so I have all the data needed like
userId, etc., but suddenly it stopped working. Apache says nothing and can't see MySQL logs but i contacted my provider and says that there is no logs either.
commerce_addressbook, but not using
commerce_discount. Not altering the
order_id in rules.
Looks like some kind of
order_id problems but not sure, it looks like the second order_save (with wrapper function or
commerce_order_save) tries to save the order but with the same
In the database the order is created with its line item
I've tried to clear all the caches, same result.
A thing which i find strange to me, is its revision id, in the database even tought
160, for example, its revision id is
Another strange behaviour i found is that the
commerce_order_total is not set at all, the row in the table is created but with
Same result for both saving functions, tried both but it is always in the second call of the order save, I comment that line and it works.
Commenting that line works, but of course no line items, but the rows are created for both entities, commerce_order and
commerce_line_item. I mean, i see them in the data base but in the edit page of that created order, there is no line items
Here is the content of