Scenario:
1) admin/store/orders/create
Create an order from admin interface for a new or existing client (maybe anonymous but I didn't test it), Complete client fields, add products to order, click submit order before adding a shipping method*, then select any weight quote shipping method (at least with weight_quote I tried myself) and apply it to order, save the order.
2) admin/store/orders/[your_created_order_id]/packages/new
Create one package (maybe the same error with multiple packages but I didn't test it).
3) admin/store/orders/[your_created_order_id]/shipments/new
Create a new shipping for this order. After you select your packages in shipping form you'll get the following error:
Notice: Undefined index: method în uc_shipping_shipment_edit() (line 898 of ubercart/shipping/uc_shipping/uc_shipping.admin.inc).
Notice: Undefined index: rate în uc_shipping_shipment_edit() (line 909 of ubercart/shipping/uc_shipping/uc_shipping.admin.inc).
*) if you click on submit buton on this form before hitting first form submit button you will get an order with cleared client fields but with a shipping method attached. I'll create another issue for this bug too...
Comment | File | Size | Author |
---|---|---|---|
#32 | 1410302_3.patch | 2.1 KB | SilviuChingaru |
#30 | 1410302_2.patch | 2.07 KB | SilviuChingaru |
#28 | 1410302_1.patch | 2.07 KB | SilviuChingaru |
#26 | 1410302_1.patch | 2.07 KB | SilviuChingaru |
#23 | 1410302_1.patch.txt | 2.07 KB | SilviuChingaru |
Comments
Comment #1
SilviuChingaru CreditAttribution: SilviuChingaru commentedThe problem exists when you change a order created like above status also. I think that at creation form or something....
Comment #2
SilviuChingaru CreditAttribution: SilviuChingaru commentedIssue for this bug: #1413372: Admin order shipping method not set and order data reset when shipping quote applied to order
Comment #3
SilviuChingaru CreditAttribution: SilviuChingaru commentedNot sure if it is the best practice but it works...
Comment #5
SilviuChingaru CreditAttribution: SilviuChingaru commentedBecause it brakes hole order object if not saved in db.
Comment #6
TR CreditAttribution: TR commentedTestbot says the patch is bad, so the proper status is needs work.
Comment #7
SilviuChingaru CreditAttribution: SilviuChingaru commentedThis bug is present in RC4 release also...
Comment #8
TR CreditAttribution: TR commentedWhat's your point? This issue is still open (status = needs work), so by definition it hasn't been fixed yet. If you want to help maybe you can fix your patch in #3 so that it doesn't break the Ubercart tests.
Comment #9
SilviuChingaru CreditAttribution: SilviuChingaru commentedMore elegant solution to fix this...
Comment #10
longwaveComment #11
SilviuChingaru CreditAttribution: SilviuChingaru commentedThere is still a problem when you don't specify a shipping method via admin > create order: SAME ERROR:
Comment #12
SilviuChingaru CreditAttribution: SilviuChingaru commentedThe problem is form generated by the AJAX, it just submits the form instead of using AJAX too to replace $form_state['#order'] or only the shipping method. I'm not to good at AJAX forms so any help will be appreciated. I'll try to figure it out also by myself and submit the right patch.
Here is the problem:
it should be something like this:
where uc_quote_order_apply_rate will be something like this:
and uc_quote_apply_quote_to_order will be:
But for some reason is working only if I remove the shipping line item manualy first (press red error button).
Comment #13
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #14
SilviuChingaru CreditAttribution: SilviuChingaru commentedI made a patch that is partially working.
What is working so far:
If you edit an order and click on "Get shipping quotes" then "Apply to order" the order is not reloaded, its total change but the line item form (textfields value title and amount) is not changing so when you click "Submit changes" the line item remain the same if you save the order.
But if you don't save the order is working, it change the order shipping method.
Any help would be greatly appreciated. Thank you.
Comment #15
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #16
longwaveThis patch hides the error if the order genuinely does not have a shipping quote attached.
Let's deal with the source of the problem in the other issue (which I closed, but am about to reopen as I realise now it's a separate problem)
Comment #17
TR CreditAttribution: TR commentedHere's a different patch. I don't like the above because:
1) The informational message really is content. While a #description on the fieldset may have the same appearance, it's semantically incorrect. This patch keeps the original #markup form element.
2) The original code and my new patch handle the case where the customer selected a shipping method that is no longer installed. The above patches don't. That feature was put in there based on real-world experience.
3) The above patch doesn't inform the admin if the customer didn't select a shipping method / didn't pay for shipping. This new patch does.
Comment #19
TR CreditAttribution: TR commentedHmm, how did that happen. Revised patch without the syntax error:
Comment #20
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #21
SilviuChingaru CreditAttribution: SilviuChingaru commentedSorry for duplicate...
Comment #22
SilviuChingaru CreditAttribution: SilviuChingaru commentedGreat... I'll test it tomorrow and let you know.
Anyway there still is problem from #1413372: Admin order shipping method not set and order data reset when shipping quote applied to order that make admin interface unusable for creating orders which, in a real shop, is very often used...
Comment #23
SilviuChingaru CreditAttribution: SilviuChingaru commentedI think we should print also the message as error for user that tries to enter shipping info using drupal_set_message and also log error for admins. The patch will look like attached...
Comment #24
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #25
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #26
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #28
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #30
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #31
SilviuChingaru CreditAttribution: SilviuChingaru commentedComment #32
SilviuChingaru CreditAttribution: SilviuChingaru commentedFixed watchdog link.
Comment #33
TR CreditAttribution: TR commentedI committed #19 without the additional drupal_set_mesage() or watchdog(). I don't consider this to be an error condition - this is strictly an informational message at this point in the shipping process. If it's considered an error for an order to reach this point without a shipping quote then that condition needs to be caught and corrected when it happens, not somewhere down the line. For example, at checkout, we already have a setting at admin/store/settings/quotes/settings to prevent checkout if customer didn't select a quote - this is the default, but since it's a setting it can be unchecked as well to allow orders to go through without quotes. If the problem is administrator-created orders don't get shipping quotes added, then we ought to catch that and form_set_error() to prevent the administrator from submitting an order without quotes. Or at least detect that condition and bring up a confirmation page to make sure the administrator meant to do that.
Fixed in 7.x-3.x, marking for backport to 6.x-2.x.
Comment #34
TR CreditAttribution: TR commentedFixed in 6.x-2.x as well.
Comment #35
SilviuChingaru CreditAttribution: SilviuChingaru commentedYes you are right...