Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
For the record, I am utterly unable to reproduce this bug on any browser or system, yet I've received several screenshots like the one attached, so I know it is occurring. Basically, the checkout form requires delivery information but does not provide the required form fields for the user to complete. The products are indeed shippable and as stated, the forms work fine on any environment I use.
The screenshot is attached and if anyone wants to try themselves, they can visit http://www.nala.ie/publications and try to purchase something.
Comment | File | Size | Author |
---|---|---|---|
#10 | ubercart.checkout-missing-delivery-form.859266-10.patch | 512 bytes | adamdicarlo |
#8 | ubercart.checkout-missing-delivery-form.859266-8.patch | 545 bytes | adamdicarlo |
#2 | No Delivery Info Form.jpg | 24.01 KB | Dr Jay |
Comments
Comment #1
Island Usurper CreditAttribution: Island Usurper commentedI don't see a screenshot, but that site seems to have all its fields on the checkout screen. If it still comes up, make sure the delivery information checkout pane is enabled in the Checkout settings. And then reprimand whoever turned it off.
Comment #2
Dr Jay CreditAttribution: Dr Jay commentedRight-on, I must have missed that attachment. Here it is. Unfortunately, this comes from the person I reprimanded! As I said, it all works for me as well (and I've tried multiple machines/browsers), so it's just frustrating that I can't seem to find a common denominator among those who are experiencing it. Either way, I appreciate you trying.
Comment #3
js CreditAttribution: js commentedI have the same problem.
The "Delivery Information" is enabled here:
/admin/store/settings/checkout/edit/panes. I tried toggling it on and off.
$form['panes']['delivery'] is missing in dsm()
I am not sure what I did or how to fix it. I would appreciate knowing what to check in the database.
Thanks, Jerry
Comment #4
Dr Jay CreditAttribution: Dr Jay commentedHopefully you won't mind me changing the status on this. Even though I can't duplicate the problem, it is definitely happening (based on the complaints/screenshots I'm getting) and it appears from #3 that I'm not alone.
Comment #5
TR CreditAttribution: TR commentedAre your products marked shippable? Delivery information won't show unless you have shippable items in your cart.
Comment #6
Dr Jay CreditAttribution: Dr Jay commentedThanks TR - they are indeed.
Comment #7
TR CreditAttribution: TR commentedMarking this as cannot reproduce. If you can provide further information that might help us reproduce this, feel free to re-open the issue.
Comment #8
adamdicarlo CreditAttribution: adamdicarlo commentedI'm experiencing this issue too. I've been stepping through the code and something really doesn't make sense here.
uc_cart_is_shippable() calls uc_cart_get_contents(), which loads product nodes like this:
it ditches the node ($product). The "shippable" flag is present at $product->shippable (its value is "1"). But it is not present in the item's data array.
uc_cart_is_shippable() receives the array of $items back from uc_cart_get_contents(). It has no way of accessing the "shippable" flag -- it's simply gone.
So, uc_cart_is_shippable() iterates through its array of items (with no shippable flags), and calls uc_cart_product_is_shippable() on each:
Because $product->data['shippable'] isn't even SET, and == (rather than ===) is used, the if statement evaluates to TRUE, and FALSE gets returned.
So, the code after that (in uc_cart_product_is_shippable()) is never reached, and thus no other modules have a chance to declare the product is shippable. BLEH.
Here's my suggestion, in a patch (rolled from 2.4).
Comment #9
adamdicarlo CreditAttribution: adamdicarlo commentedComment #10
adamdicarlo CreditAttribution: adamdicarlo commentedWhoops, rolled that wrong. Trying again.
To be clear, this patch solves the problem for me. Ubercart checks whether there are any shippable items when "Hide the delivery info pane if there are no shippable items" option is on, so the problem was breakage when trying to determine if there are shippable items.
I'll try to do more testing. Perhaps one has to create a product, save it, THEN check "Product and its derivatives are shippable," and save again, in order for $data['shippable'] not to be set? Not sure.
Comment #11
TR CreditAttribution: TR commentedI can't verify the patch fixes the problem unless I can reproduce the problem. See #7. Please provide the steps needed to cause the error, then I can test your patch.
Comment #12
adamdicarlo CreditAttribution: adamdicarlo commentedTracked this nasty bug down. This problem occurs when you add items to the cart yourself using uc_cart_add_item(), without calling module_invoke_all('add_to_cart_data', ...).
This means the uc_cart_add_item() API is extremely nasty...this is one hell of a gotcha.
Have a look at these functions from uc_product.module:
So the problem is that if you simply call uc_cart_add_item(), you're screwed. You have to replicate the pattern shown in uc_product_add_to_cart_form_submit() so that the 'shippable' entry gets added to the $item['data'] array.
This warrants a lengthy "WARNING" comment in the header of uc_cart_add_item()....
Comment #13
adamdicarlo CreditAttribution: adamdicarlo commentedComment #14
Saoirse1916 CreditAttribution: Saoirse1916 commentedI've run into this problem as well as I'm using a custom variant of the UC_Event_Registration module which uses uc_cart_add_item(). Based on a thread over at Ubercart (http://www.ubercart.org/forum/support/11851/delivery_information_not_sho...) I've come up with the following modification which, to my eye, should work but doesn't.
My dsm($data); indicates that I get what appears to be the appropriate result, with the nid and two attributes in an array, but I still get no delivery information. If I remove the attributes from the $data array I get delivery information but no attributes, of course.
Comment #15
longwaveSee #613498-46: uc_product_add_to_cart_data does not respect non-shippable attributes for a full diagnosis of this problem, and a patch that (hopefully) fixes it. Reviews and testing are more than welcome!
Leaving this open for now, as this issue is subtly different, but I think the fix is the same.
Comment #16
longwaveDuplicate of issue linked in #15