When an user changes their country at checkout, stores may want several things to happen, such as:
- Updating the zone/state dropdown
- Updating shipping quotes
- Applying of payment conditions
Other modules may want to extend this further. At this point, no mechanism exists for doing so, with the exception of a crude extension in the uc_quote module (which allows quotes to be retrieved while updating the zone/state dropdown).
Implement a system or API with which ajax events on checkout can be controlled. Adapt the modules uc_quote, uc_cart and uc_payment in such a way that they make use of the new system or API. Make sure that other modules are able to extend the system or API.
longwave's "hopefully final" review. See #101.DONE Commit the appropiate patch.DONE, see #111
- Create follow-ups for subissues.
User interface changes
A new module called "Ubercart Ajax Administration" is added with which ajax events for the checkout form can be configured. For (nearly*) each field on the checkout form you can configure which checkout panes needs to be reloaded when the value for that field is changed.
The implementation of the ajax events themselves (along with a default configuration) lives in the (required) Ubercart Store module, so the module don't need to be enabled for ajax events on checkout to work, only to change the configuration.
* Only these fields can be configured:
- Fields that the user configuring the ajax events would see at the moment when he/she would enter checkout. This means that conditional appearing fields (for example a field that only appears when a certain product is in the cart or a field only visible to certain roles) won't be configurable out of the box. These fields may appear if the user configuring the ajax events would try to meet the conditions that are needed for the field to appear (such as adding the needed product to his/her own cart).
- AND fields that are inside a checkout pane. Fields outside checkout panes aren't configurable out of the box.
Default ajax events configuration
|Triggering form element||Panes to update|
|Delivery: country||Shipping quotes, Payment method|
|Delivery: postal code||Shipping quotes, Payment method|
|Delivery: address selector||Shipping quotes, Payment method|
|Billing: country||Payment method|
A new API for controlling ajax events on checkout will be introduced.
Subissues (reported problems after applying the patch)
- Submodule or merge: There was discussion about if the admin section for configuring ajax checkout events should be in a separate submodule (e.g. ubercart/uc_ajax_admin) versus moving it into uc_cart. This conversation started in #68 by longwave, but the reply in #71 in support of keeping it separate was agreed upon in #75 and #94.
- Illegal choice: Some people reported having seen illegal choice errors after applying the patch. See #75. Conclusion in #106 is that it's not caused by the patch and that it may be just a configuration issue.
- Tax rate: There is an issue in #88 regarding tax rates not being properly set or stick. Conclusion in #98 is that it can't be fixed out of the box, because it would be too site/business specific. Documentation for this issue needs to be added, suggestion in #98 is to handle this in a follow-up, which is agreed upon in #101.
Original report by longwave
We may want several things to happen when the user changes their country at checkout; the zone/state dropdown needs to be updated, the shipping quotes should update, and perhaps some payment method conditions need to be applied. Other modules may want to extend this further. At the moment there is no mechanism for doing so, except a crude extension in uc_quote which allows quotes to be retrieved while updating the zone/state dropdown.
As noted in the first linked issue I had an idea for adding a hook_uc_address_ajax_fields_info() or similar which could register field-level callbacks to provide multiple reactions on address field changes, executed through a common dispatcher, which it seems will be necessary if we want multiple modules to act on the checkout page from a single click.
|PASSED: [[SimpleTest]]: [MySQL] 2,540 pass(es). |
[ View ]
|PASSED: [[SimpleTest]]: [MySQL] 2,481 pass(es). |
[ View ]
|#58||Screen shot 2012-06-01 at 6.36.47 PM.png||55.01 KB||nelslynn|
|#58||Screen shot 2012-06-01 at 6.14.33 PM.png||23.13 KB||nelslynn|