Whew, finally finished this after working on it little by little over the last couple of days.....:clap:
Yes, I recall your post "of return" and the same basic can't get things to change discussioon..
So, let's leave that behind for a moment. Here's my perception of how such a module is to work... As far as "previous use" of ZC and coding, well, I looked at a few options when first considering a cart for a non-profit and this seemed like the most flexible for our needs and at no cost to the organization other than additional volunteer time, well... No brainer there.
So, here's my thoughts on what is expected of a shipping module:
- Upon generic inquiry, provide all possible rates based on the contents of the cart.
- Provide the potential price(s) and option(s) at any time asked (again based on item(s) in cart).
- Provide the single cost of shipping based on user selection of options available.
- Provide the ability to be presented the available options with the previously user selected option indicated.
- Provide the store owner the ability to restrict the usage of the shipping method based on chosen criteria.
- Provide the ability for multiple shipping modules to be presented to a customer/owner.
- Allow sub-options to be selected/presented for additional features/options.
- Offer means to ship via multiple methods on a single purchase.
- Price of chosen shipping method to adjust based on cart changes.
So, I'll say this, item(s) 8 is pretty much only covered in commercial mods because of the added complexity/need of the few as compared to the whole, item 7 is somewhat the same.
Item 6 can be offered through multple shipping modules, or just as well through a single one that is diversified to handle multiple.
Item 5 has multiple possibilities as seen through all of the posts by those that want to customize their shipping module(s): min/max purchase price, destination, specific product, combination of product, specific attribute of a product, weight, free item, billing address, quantity of all product, quantity of a specific product, etc...
So turn things around a little and then there is item 1... That is the base quote "process". Whatever the shipping module is designed to support, give all the values that are possible. That seems to be what you were able to retrieve/do.
Item 2 this is accomplished by the shipping module not exactly storing anything but "recalculating" the shipping quotes every time asked to provide one based on the cart contents. (Although could also do so for a "saved" cart if such was necessary to have for a particular store.)
Item 3 is kind of what I think you were getting at with the discussion of all the data is currently available, why send back a single method to be processed... I say because of Item 4...
Item 4 requires the same series of rates to be presented as originally presented; however, to also include selection/default of an existing/previous selection. So for example in the checkout process if one returns to the checkout_shipping page for any reason after making a shipping selection, then it is desired that the previous selection be shown, but also to show all of the other available options (unless one is going to require some sort of "logout/login" process to support a new selection). If the default functionality of the shipping module was to show a single quote if the session variable was set, then the session variable would have to be cleared/deleted but temporarily stored so that the previous selection could be captured/identified and then as the customer moves away from that page, the data would have to be stored again in the session variable. So, a couple of thoughts here, okay the "clearing" could occur in a header_php.page, it could also happen in the module. However, the module would need to have a "knowledge" of what page/content was being displayed so that it would know to clear the value showing multiple rates, or it would have to be told that it should do this. Well, the later is done by exclusion/inclusion of sending the method variable. If the method variable is present, then act differently on the code, if it is absent then just provide a quote of all possibilities... From that point it is a matter of identifying the "typical" usage of requesting a quote in the core code... From there, the same code could be applied elsewhere, or different data could be passed to the function to provide different "style" results...
Okay, so there is also item 9 which I didn't go back and resequence to fit this discussion. This is somewhat covered in the other options above, but seems worthy to state specifically. Basically, at any time the shipping information is "tested" it seems that it would be of value that it was already up-to-date with the current value/price based on 1) any previous selection of shipping method, 2) being updated on changes to the item(s) in the cart. I believe lat9 found some form of discrepancy in accomplishing this based on some fairly specific conditions (although ultimately a possibility and to be addressed), like changing shipping destination as it relates to tax locations after initial selection of the shipping method progressing to verification but to return to somewhere specific in the process to make a change, etc... Well documented and proven to be an issue but I don't recall the specifics at the moment, just that there were enough ifs/buts/whens that it could drive one crazy. :))