Do you plan to implement this module on drupal 7 ?

Comments

megachriz’s picture

Title: Drupal 7 » Should this module be ported to Drupal 7?

I had looked for a way to port this module to Drupal 7 a few weeks ago, and I felt I should somehow manage to use the field API introduced in Drupal 7. Things are a bit different in Ubercart 7.x-3.x regarding address fields. In Ubecart 7.x-3.x all the address fields are defined as a single field with a number of subfields. I succeeded with altering the subfields, but now I'm stuck with getting a created field to be both in the delivery as the billing pane. Well, the field appearing is not the problem, but the saving is. If I tie the field to the order, only one field can be tied. So, I probably need to tie the field to an ID which will be a combination of the order ID and the address pane type (delivery or billing). But field ID's may only be an integer.

To come back to your question, yes, I did have plans to port this module to Drupal 7. But I also saw that in Ubercart 7.x-3.x you already can define extra fields, but not for the original address panes. The fact extra fields can be added to an order would drop the need for an extra information pane for sure.

Now I first want to know is: is there a good alternative for this module for Ubercart 7.x-3.x? With the ability to add extra fields to an order, you could also add a fieldset and within that fieldset you perhaps could add an address field from the addressfield-module (http://drupal.org/project/addressfield), but I don't know if that's a good alternative, because I haven't looked into it yet.

Opinions?

zincdesign’s picture

Hi Megachris - loving your work : )

My opinion is I would love this module to be ported to Drupal 7. This is the exact functionality I need and I have spent hours and hours (I am not a coder) trying to do this without a D7 version of this module.

I tried getting my head around the piece you wrote on field handlers but to no avail. All I want is a 'company type' field after the company name in the billing/postal address but it remains a distant dream until some clever person creates it ; )

remkovdz’s picture

I also would really love this module in D7!

megachriz’s picture

Yeah, working with Ubercart Addresses field handlers can be a bit daunting at first, but at least it's a bit easier to get those extra address fields in then without this system. Because without this system, the only way to get the field values to appear also on the checkout review page, is to override the Ubercart checkout panes in a own module. This is what Extra Fields Pane and now also Ubercart Addresses does to support extra address fields.

While Extra Fields Pane provides an UI for extra address fields, Ubercart Addresses (unfortunately) does not. I was thinking about connecting Ubercart Addresses with the core Field API and with view modes, but that are ideas for the far future. I first have a bunch of other work to do, for example, finishing a completely working Ubercart Addresses for Drupal 7. And integrate Ubercart Addresses with Views.

Thus the best way (that I know of) to get extra address fields in Ubercart 7.x-3.x is write code that connects with the Ubercart Addresses field handler API. I have been working on an example module for adding extra address fields with Ubercart Addresses, but I have not published it yet because I've not yet written documentation for it (and also because it contains some test code too).
There may be also possibilities with the Addressfield module, which I still haven't look at closely, as I'm unsure how difficult it would be to get that module to work together with Ubercart (think about that when the customer chooses an other country, different shipping costs should be generated). If you have time to investigate that module and post back the results here, you could help a lot.

At the moment I don't have plans to port Extra Fields Pane to Drupal 7 (at least, not soon), because the same functionality can be reached with Ubercart Addresses + a own module. If you want Extra Fields Pane to be updated for Drupal 7 soon (it could be made depended on Ubercart Addresses) you should seek/hire a developer.

Thanks for your interest in this module.

megachriz’s picture

The example module for Ubercart Addresses is now available in the dev release of the 7.x-1.x version.

zincdesign’s picture

Fantastic. I'll check it out.

panthar’s picture

Category: feature » task

Hey MegaChris,

Look forward to seeing the 7.x version.

Question though, what the heck is going on with Ubercart, is Drupal 7 the last version supported for UC?

And on an aside, since I originally engineered the foundations for 2.0 version, this module has about 10x more people using the module than 2 yrs ago.

Good times!

megachriz’s picture

@panthar
About your Ubercart question: at the moment, yes, the highest supported Drupal version is Drupal 7. But I haven't read anywhere yet that Ubercart development will be discontinued for Drupal 8. At the moment, the project is very alive.

The 7.x version of this module won't come, unless other developers are interested in building it. I have a bunch of other projects to do, and I seek other possibilities to regain the functionality this module provides. I more or less already have succeeded with this by building Ubercart Addresses for Drupal 7. Cons: no UI for adding fields.

panthar’s picture

I hear ya on time. That's the problem all of us developers in open source land, where people profit for free off of our combined work! lol.

Okay, so thanks for answering that, I was not sure, I had heard a rumor UC for D7 was the end of the rope. Glad to hear that is not the case. Commerce module is simply not up to par with ubercart.

I have not checked out the UC Addresses module in d7, but since your the maintainer for both modules, what feature does this module have within a d7 framework that is different from UC addresses I guess is the main question, is it just a difference in interface basically?

megachriz’s picture

Differences between Ubercart Addresses and Extra Fields Pane:
- Ubercart Addresses' (original) goal is to provide an address book for customers, so customers can manage a list of addresses. On the checkout page they can choose one of these addresses and the address form can be prefilled with their default address(es). I have extended Ubercart Addresses with an API with which it's possible to add extra address fields of any type. In order to add those fields, you need to create your own module and implement some hooks to register your fields (and field types, which are called field handlers in Ubercart Addresses). You also need to alter the database or else the field values won't be stored.
- Extra Fields Pane's goal is to provide extra address fields. It has an UI to add fields, and the field types that are available is a fixed set. Extra Fields Pane doesn't have an API to add new field types (but does have an API to add fields programmatically). With Extra Fields Pane alone your customers do not have an address book (not all webshops need an address book).

What Extra Fields Pane have what Ubercart Addresses doesn't have is an UI for adding fields, a fixed set of field types, Views integration (planned for UC Addresses) and separate database tables for saving the fields and field values.

panthar’s picture

Well MegaChriz, if the time comes , where I get the motivation to update my drupal site to d7 which uses this module. Since the site has not exactly taken off to say the least, it may be a while.. quite honestly. I had a very special need, which v2 of module did for me, which was displaying highly customized php data to ubercart.

Anyhow from the sounds of it, taking some of the code from this module, and using it in d7 on uc_addresses maybe the way to go forward (if you have not already). Adding multi-fields support to uc_addresses, if acceptable to the devs of uc_addresses would be a cool feature, maybe the way to move forward.

Not sure, what do you think?

megachriz’s picture

Make a Drupal 7 version of this module depended on Ubercart Addresses 7.x-1.x sounds like a good idea. In that case less code have to be ported and Extra Fields Pane doesn't have to make changes to Ubercart that are already done by Ubercart Addresses (overriding checkout/order panes for example).

An other idea I had, was to make addresses fieldable (thus connecting it to the Drupal Field API). That way, you can use any field type already provided by other modules. I haven't examined this path closely yet, and so I don't know how much effort/time that would take. I also have no urgent need for it at the moment (but others may have).

Anyway, porting a subset of Extra Fields Pane code would probably take less time than to make addresses fieldable.

I'm not sure what you mean with "multi-fields" support. You can add fields whatever you like using the Ubercart Addresses field handler API, so you can also add two fields or two fields of the same type.

Neo13’s picture

Drupal 7 version depended on UC Adresses souns great to me too. Less work for you and desired functionality for us (users).

megachriz’s picture

Okay, it sounds reasonable to have an UI delivered by Extra Fields Pane then none at all (or one that could take ages before it's ready). I may have a few hours next week to work on straight (but limited) port.

So this is the plan for Extra Fields Pane 7.x-1.x:
- Add a dependency to Ubercart Addresses.
- Drop the extra information pane (an Ubercart order is fieldable, so there isn't much need for such a pane).
- Keep the uc_extra_fields and uc_extra_field_values table.
- Extra Fields Pane will no longer override checkout/order panes (this will be handled by Ubercart Addresses).
- The following classes will be dropped: UCXF_Pane, UCXF_AddressPane, UCXF_CustomField.
- The "Order fields by weight" feature is already available in Ubercart 7.x-3.x and will not be ported.
- Theme code will be removed (theming will be done by Ubercart Addresses).
- Javascript file will be removed (no longer needed, AJAX framework will be used).
- Automated tests that are still relevant will be ported.
This will not be ported in the initial version, but may be added later:
- Token integration (may also be added to Ubercart Addresses instead)
- Views integration
- i18n integration
- Features integration

Any objections or suggestions?

Neo13’s picture

I`m really looking forward to see this ported. Plan looks promising and I encourage Token and Views integration with UC Adresses (UC Extra Fields 7.x).

Thanks and keep up the good work!

megachriz’s picture

Assigned: Unassigned » megachriz

I have made a start with this.

I ran the module through Coder Upgrade, removed most of the unnecessary code and rewrote most of the database queries. Result of the automated tests (at this moment): 353 passes, 184 fails, 129 exceptions, and 393 debug messages. I plan to do a first commit in one of the next days (if time stays on my side).

megachriz’s picture

I've made the first commit for the Drupal 7 version!

I have brought down all errors in the automated tests to zero. I only had to make a few small additions: the form structure is a bit different comparing to the 6.x-2.x version (this is mostly caused by the newly added dependency on Ubercart Addresses) and the token tests are turned off, because the code for token integration has not yet been ported (and will probably be implemented in Ubercart Addresses instead). I've kept the manual tests short, so the module has not been heavily tested.

Try it out and report any bugs you may find.

megachriz’s picture

Title: Should this module be ported to Drupal 7? » Extra Fields Pane: Drupal 7 port
Version: 6.x-2.x-dev » 7.x-1.x-dev
Assigned: megachriz » Unassigned

Token support (in Ubercart order context) has been added to the latest dev of Ubercart Addresses: #1578362: Ubercart Addresses order tokens. A little adjustment in Extra Fields Pane 7.x-1.x has been made for this and the automated tests were adjusted (the token tests are now turned on).
See commit.

What still has to be done:
- Views integration
- i18n integration
- Features integration
I will not working on these ones right now (maybe next month or so). I'd like some feedback on the 7.x-1.x as it is now.

megachriz’s picture

Edit: duplicated comment (got an unexpected drupal.org error).

megachriz’s picture

I noticed deleting a field within the UI was not possible: I got an access denied error and some error messages like this:

Notice: Trying to get property of non-object in user_access()

It seems that I forgot to specify the right access callback in uc_extra_fields_pane_menu().

A fix for this has been committed.

megachriz’s picture

I've ported Features integration. This comes well in handy while I'm bugfixing in both 6.x-2.x and 7.x-1.x.

So, now only Views integration and i18n integration needs to be added.

megachriz’s picture

The hook implementations for Ubercart Addresses are moved to a separate file. Flush caches when you download the new dev version that's coming later today.
See commit.

megachriz’s picture

Status: Active » Fixed

A first alpha version for the 7.x-1.x branch has been released! This includes integration with Token and Features module, but integration for Views and i18n has not yet been ported. Volunteers are welcome to add those two missing pieces:
#1635164: Views integration for the 7.x-1.x version
#1635168: i18n integration for the 7.x-1.x version

Because there is an official 7.x-1.x-release now, I mark this issue as fixed. Continue in the two issues above or create a new issue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.