About this feature
With this feature you will have the ability to display values of extra address fields inside "address displays", shown on the Order Review page, the Order page and the invoice.
Go to the country formats page, read the 'Address variables instructions' and add ucxf variables to address formats of the countries used in your webshop.
See the attached images for examples. (I have used my pseudonym in the examples. And no, I'm not a Doctor. ;) It just clarifies how this feature can be used.)
Issues
Currently I haven't seen a way to get this feature to work without modifying Ubercart. I have tried two ways of altering Ubercart to get the feature to work:
- The first way adds two hooks to Ubercart (and also one to UC Addresses if used). The implementations of these hooks alters the address display and replaces ucxf variables with the corresponding values saved in the table uc_extra_fields_values. This solution is not perfect, because on some address displays (not belonging to order or store) the ucxf variables doesn't get replaced.
- The second way alters more Ubercart code and does not have the problem ucxf variables sometimes doesn't get replaced. It introduces the function uc_address_formatter() which works more flexible than uc_address_format(). It also alters the function uc_address_format() to make it a call to uc_address_formatter(). The problem with this solution is that it might alters more Ubercart code than will be accepted by the Ubercart team. Maybe we should use an other function name for uc_address_formatter() also.
Test
I've attached two versions of this feature as an optional module (so it will not affect the original Extra Fields Pane module). The first version needs a little modification on Ubercart, but is not a good enough solution. The second version alters more Ubercart code. With both versions patches are included, which you can apply on Ubercart (and UC Addresses, if used).
Review
Please review this feature and help to think about how this feature should be implemented at best. It looks like a modification on Ubercart would be required, so we need to find a way to alter Ubercart as clean as possible and also that Ubercart not get altered that much that it would require modifications on other modules depending on Ubercart: we should not alter the behaviour of Ubercart.
Any help appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | ubercart2.4_patched-v1.zip | 343.68 KB | megachriz |
| #3 | ubercart2.4_patched-v2.zip | 344.48 KB | megachriz |
| #1 | ucxfdev_addressdisplay-v1.zip | 108.77 KB | megachriz |
| #1 | ucxfdev_addressdisplay-v2.zip | 107.54 KB | megachriz |
| ucxfdev_addressdisplay-v2.zip | 112.5 KB | megachriz |
Comments
Comment #1
megachrizThe solutions posted above worked only with the 2.x-dev version of Extra Fields Pane from September 2.
Here are updated versions of these solutions, which will work with the 2.x-dev version of Extra Fields Pane from November 26 and December 2.
Comment #2
werushka commentedcan someone please provide me with patched verstion of uc_order.module. Even though the patch is for the v 1.12.2.40 i can not apply it. hunk errors all over
Comment #3
megachrizDid you try this:
1. Put the patch file inside the Ubercart directory.
2. On the command line, go to the Ubercart directory:
cd ubercart3. Apply the patch this way:
patch -p0 < ubercart_MC-addressdisplay-v2.patchAnyway, attached are patched versions of Ubercart 2.4
Comment #4
megachrizAddress formats with extra address fields can now be set with the 6.x-2.x version of the Ubercart Addresses module. Therefore, a separate fix for this is not needed anymore.