Based upon a clean install, just D7.12, Ubercart and dependencies.
Shipping Rules in Place:
Zone: Alabama
Postal code: 11111
Postal code: 22222
/cart
Clicking the Calculate button in "Estimated shipping cost:" doesn't trigger either 11111 or 22222 (but does trigger on zone).
/cart/checkout
The shipping costs are only changed when the Country changes* or the Postal code field loses focus (or you click the button). Selecting an address from the drop down doesn't trigger shipping costs or triggers incorrect shipping costs.
An example of incorrect shipping costs being triggered:
Selected a drop down delivery address with Alabama and 11111 Postal code, no shipping costs triggered. (do nothing in between) Then select another address with Newfoundland (Canada) and 22222 Postal code. The "Alabama" shipping cost is triggered (but not 11111 or 22222).
# # #
And as a last tidbit, using the Postal code field gives wonky results. Sometimes it triggers my "22222" zip code on checkout and sometimes it doesn't.
Original discussion in #1317692: Fetch shipping quote based on State/Province selection rather than postal code
Best,
Sam
*And this seems useless??, as the State/Province is re-set to "Select" so it can't pull up the correct shipping costs anyway. Is this the intended behavior, or is this a typo in the code, such that State/Province was suppose to be the trigger on change and not Country? Would make more sense, but I don't know what the expected behavior is.
Comment | File | Size | Author |
---|---|---|---|
#11 | 1448288-1-checkout-page.png | 76.72 KB | MegaChriz |
#11 | 1448288-2-select-pc-11111.png | 79.61 KB | MegaChriz |
#11 | 1448288-3-select-pc-22222.png | 83.02 KB | MegaChriz |
#11 | 1448288-4-select-zone-alabama.png | 85.12 KB | MegaChriz |
#9 | 1448288-rules.txt | 1015 bytes | MegaChriz |
Comments
Comment #1
TR CreditAttribution: TR commentedThis is a duplicate of #1317692: Fetch shipping quote based on State/Province selection rather than postal code. Please keep the discussion in that issue.
Comment #2
Michael-IDA CreditAttribution: Michael-IDA commentedNot a duplicate! Please don't be so quick to close things out.
Yes, that thread is a discussion of a similar topic, but I'm reporting errors here.
See above:
Comment #3
Michael-IDA CreditAttribution: Michael-IDA commentedbetter title
Additional info: Using Flatrate shipping
Comment #4
TR CreditAttribution: TR commentedIt's exactly a duplicate. The Ajax event isn't fired in general on changes in the address fields, and that can be expressed in many ways, but it's the same problem.
Comment #5
Michael-IDA CreditAttribution: Michael-IDA commentedOne more time,
WHEN the Ajax fires, it does not trigger the correct rule.
How is that not a bug? Specifically related to "Shipping costs not triggered correctly on /cart," and has nothing to do with "AJax firing on changes in the address fields."
Also, how is
not a bug?
So, please read the whole ticket before you close it as duplicate. If you want, and it helps with clarity, please feel free to remove my question at the end of the original ticket.
Best Regards,
Sam
Additional Info:
When clicking the "Click to calculate shipping" button on the /cart/checkout page.
Comment #6
TR CreditAttribution: TR commented... and you keep listing symptoms all stemming from the same underlying problem. We don't need multiple issues open to track just one problem.
Any further discussion should take place in that other issue.
Comment #7
Michael-IDA CreditAttribution: Michael-IDA commentedWTF?
These bugs have nothing to do with "Fetch shipping quote based on State/Province selection rather than postal code"
Stop being an ass,
Sam
Comment #8
longwaveHow exactly do you have your rules configured?
I just created a flat rate shipping quote and applied the following condition:
(in other words, "Data comparison", on "order:delivery-address:postal-code", with "11111" in the value field)
On /cart and /cart/checkout this shipping quote only shows up if I enter 11111 in the zip code field.
Comment #9
MegaChriz CreditAttribution: MegaChriz commentedThis is one part of the issue:
When a customer has previously placed orders, there will be drop down called "Saved addresses" from which the customer can select an address.
Well, at first, when selecting an address for delivery no shipping costs are calculated. But when selecting an other address, shipping costs *are* calculated, but these shipping costs are based on the previously selected address.
Example
Let's say whe have three flat rates:
1. $ 5.00 (valid when postal code is "11111")
2. $ 7.50 (valid when postal code is "22222")
3. $ 2.50 (valid when zone is "Alabama" (= 1))
The customer has placed three orders in the past, one with postal code = "11111", one with postal code = "22222" and one with zone = "Alabama".
The customer wants to checkout for the fourth time, he/she adds a product to the cart and goes to the checkout page.
At first, the customer selects the address with postal code 11111 from the saved address drop down. No shipping costs are calculated.
Second, the customer changes his/her mind and selects the address with postal code 22222 from the saved addresses drop down. Shipping costs are calculated and result into $ 5.00. This is wrong, because that rate may only be valid when the postal code is "11111" and the current postal code is "22222". So the shipping costs should have been $ 7.50.
Modules installed
- uc_cart
- uc_order
- uc_product
- uc_store
- uc_quote
- uc_flatrate
- rules
- rules_admin
(and modules were the above listed depend on)
Attachments
Attached are two files:
- One with the rules I had defined.
- One PHP file, to be executed in a Drupal environment, that adds three orders and three flat rates to the database.
Comment #10
MegaChriz CreditAttribution: MegaChriz commentedComment #11
MegaChriz CreditAttribution: MegaChriz commentedAttached some images to clarify what happens as explained in #9.
1. Customer enters checkout page. No shipping costs are calculated.
2. Customer selects address with postal code = "11111". No shipping costs are calculated.
3. Customer selects address with postal code = "22222". Shipping costs for postal code = "11111" are calculated.
4. Customer selects address with zone = "Alabama". Shipping costs for postal code = "22222" are calculated.
Comment #12
Michael-IDA CreditAttribution: Michael-IDA commentedHi Dave,
I only opened this ticket for the bug issue, not for any additional feature implementation. This is the "11111" rule (condition) used.
It seems not to fire on /cart, and sporadically fires on checkout.
I can tarball the install if you wish?*
Best,
Sam
*It was a standard "drush site-install standard --db-url=mysql://....." w/ "drush dl/en ubercart".
Comment #13
longwaveA Rule named "rules_zip_11111_conditions" doesn't apply directly to any particular shipping quote method, so you must be calling this condition set from another condition set? How do you have that set up? Can you reproduce this with a simple flat rate method, with the condition applied directly to the method condition set (as in my example)?
Comment #14
MegaChriz CreditAttribution: MegaChriz commented@longwave, Sam-Inet
See my message with attachments in #9.
Comment #15
longwave@MegaChriz: I am talking about the /cart page which does not use an address dropdown; that issue is a different one which I have not started investigating yet
Comment #16
Michael-IDA CreditAttribution: Michael-IDA commentedIt's setup as a flat rate method, but I don't know how to export that, so I recreated a condition (to export) for post #12.* Doing this the hard way:
Three other shipping quotes(all enabled):
Shipping method - Details
Alabama - $111.00 + $0.00 per item
always visible - $0.00 + $0.00 per item
zip 22222 - $22,222.00 + $0.00 per item
Doubtful if helpful, but I'll add this as well:
PHP 5.3.10
mysql Ver 14.14 Distrib 5.1.61, for redhat-linux-gnu (x86_64) using readline 5.1
Thanks for the help,
Sam
*Not that I want to do it for this as it will just add extra elements to debug, but what is the way to export shipping quotes? (my module searching has been fruitless, and I guess I'm not familiar enough with UC if it's part of core.)
Comment #17
longwaveYou can export the conditions via the Rules interface at /admin/config/workflow/rules/components , the same way you presumably exported the other condition set you created.
Comment #18
MegaChriz CreditAttribution: MegaChriz commented@Sam-Inet
I've exported the shipping quotes using phpMyAdmin 3.4.9. In phpMyAdmin, I selected the table "uc_flatrate_methods" and exported it as a PHP array. I've posted the result in the file 1448288-db.php_.txt (which is attached to comment #9 of this issue). It should be similar to your shipping quotes setup.
Comment #19
Michael-IDA CreditAttribution: Michael-IDA commented{@#17: *cough* oh. and thanks for being patient enough to point out the blatantly obvious.}
Edit:
Might as well add everything I can.
On /cart, Estimated shipping cost:
* State/Province - Alabama
* Country - United States
* Postal code - "11111" {11111 is cut and pasted to validate no extra spaces, etc.}
Click "Calculate", results:
* Alabama: $111.00
* always visible: $0.00
Exporting the rest, just in case I've done something boneheaded (which is preferable to have a deeply embedded bug):
On /cart/checkout
Entering 11111 in Delivery Postal code produces (seemingly) random results when tabbing out of the Delivery Postal code field. {Edit: Cause of randomness was randomly checking "My billing information is the same as my delivery information. "}
Edit:
Completely spurious to the ticket, but, usage note for someone in a similar boat:
On /admin/config/workflow/rules/components/import *, you can fix your 'bad' shipping quotes without having to recreate them from scratch (but don't delete them first in /admin/store/settings/quotes as then they are lost and this doesn't work). Fix the export of the broke rule, (e.g replace "billing" with "delivery" above), and make sure to select "Overwrite." Then your shipping quote is updated and is all happy. (Again, if you delete it and then do an import, this doesn't work.)
* Turn on module "Rules UI" if you receive the message, "You do not have any administrative items."
Comment #20
longwaveYou are comparing on billing-address. The shipping quote form on the cart uses the delivery-address selector.
Comment #21
Michael-IDA CreditAttribution: Michael-IDA commentedSeriously sorry for making the ticket now.
Thank you for your help.
Best Regards,
Sam
Comment #22
Michael-IDA CreditAttribution: Michael-IDA commentedComment #23
longwave@MegaChriz: can you raise the issue about the dropdown address selector being one pageload behind in a new issue, as this issue is really two problems in one?
Comment #24
MegaChriz CreditAttribution: MegaChriz commentedDone.
#1453306: Selecting an address from the drop down at checkout doesn't trigger shipping costs or triggers incorrect shipping costs