I've been working on anonymous purchases. The address module is a mess, as you probably know. As I've been going along, I've been smoothing out a few of the rougher edges. Afterwards it's still going to be a mess, but with anon addresses that work.
One of the disconnects in the module is in how address book addresses differ from transaction addresses; they are the same, except that transactions don't include telephone number. It does seem sensible to me for them to contain the same info. What do you think? Is it worth adding the telephone field to the transaction table?
Here are some arguments that might be worth considering:
- Some transaction gateways like phone numbers
- There's a patch that extends addresses for tax to include tax number. Extending the idea would mean extending address and transaction tables for every new item needed by each module.
- Sometime in the future we are going to have to have clean addresses and checkup. One possible future would be for payment and other modules to be able to register the details of the address fields they need. Address module would act as a sort of central switchboard. (I'm not sure how this has immediate bearing though.)
- It's useful to be able to phone people when there's a problem with an order.
- It's a little silly to ask for a shipping_phone and a billing_phone. But they could be different. And shipping people like to have phone numbers. And you don't have to fill them in; they aren't required.
- We use a relational database and it's a mystery why the transaction table has addresses in it at all. They should be stored in the address table, then we wouldn't have the two forms of address floating around anyway.
- Different uses of address need different fields to be present.
Vote by adding a comment saying Yes or No for the patch to include phone numbers in transactions. Tell me of any problems you are aware of.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | anon.patch | 22.73 KB | jeff veit |
Comments
Comment #1
sime"Yes" - seems a good thing to have these data structures the same. Although I don't agree with moving addresses out of Transactions. Full addresses in the transaction table constitute an auditable history - quite standard design and sometimes a critical requirement.
(Disclaimer: I'm still a Drupal newbie, so that opinion is based on other systems I've used.)
Comment #2
neclimdulSime's right. If the user deletes there address, changes there address, what ever, we've lost important information about the transaction. Not to mention some stupid person might delete their address before something ships and then you're really in trouble.
Comment #3
jeff veit commentedYes - of course you are right about keeping transactional addresses. They can't be deleted, and the address table as it stands is vulnerable to that. Strike that comment in the original post. (I'm just fed up with translating between the numerous address formats, but this isn't the place to start a giant rant about that.)
Comment #4
simeCool, to confirm then, I still say "YES" the phone number thing. It seems a good idea.
Comment #5
Timotheos commentedFor what it's worth I agree. I just wanted to say thank you and double thank you for taking this on and cleaning it up.
Comment #6
kje commented"YES" - phone numbers should be stored, too.
There is on major point, why to store addresses from completed transactions for the future: To retain a complete transaction, even if the user changes his addresses for further transactions. I don't want that history can be rewritten.
Storage could be the same table "ec_address" or the current one "ec_transaction". If you opt for the same, then we must include two flags "address_used" and "address_invisible". This covers two cases:
1. The address is used in one ore more transactions and should not be altered. (address_used)
2. An address which has been used in a transaction is deleted by the user (address_invisible)
Just my 2c
Kurt
Comment #7
jeff veit commentedThat's a Yes then. It's done in the patch.
Although it's a mess with shipping_address and billing_address duplicating address structure, in this patch I'm not going to change the functionality to store adresses in the adress table as Kurt suggests. One step at a time. But I think that's a sensible direction too.
If one of you have 4.6 CVS installed, could you run a test for me?
If you are logged in and you place an order, does the order review page, just before you are pushed to the payment service, show your email address? That's the page that has the 'Place your order' button. It's not being displayed on my patched version and it would be useful to know if it's something that I've broken with the patch or if it was broken to start with. It's on the page just after the title and before the addresses.
Thanks.
Comment #8
arthurf commentedI'm working on this a bit right now as well. I've been frustrated by the anon address processing. Particularly that the form only validates the email address, and nothing else. This can be changed easily in this function: address_checkoutapi by modifying how it handles the logged in user.
I basically changed the structure of the case 'validate' so that the logged in test only produces the email form, but both logged in users and anon users are forced to input valid shipping and billing addresses
Comment #9
jeff veit commentedIf one of you have 4.6 CVS installed, could you run a test for me?
If you are logged in and you place an order, does the order review page, just before you are pushed to the payment service, show your email address? That's the page that has the 'Place your order' button. It's not being displayed on my patched version and it would be useful to know if it's something that I've broken with the patch or if it was broken to start with. It's on the page just after the title and before the addresses.
I'll fix this if it's my patch and then ship the patch for testing.
Comment #10
jeff veit commentedHere's my promised anonymous purchase patch v2.
Apart from allowing anonymous purchase, this is what I've done:
Corrected misspelling in 'enter you email'
Moved email address to the end because the title is shipping and billing and it seems silly to see email first
Changed address form title to use better English.
Added code to deal with the case where only billing address is required for anonymous.
Added code to copy shipping address to billing address if billing is blank.
Added code to make the default address text international rather than US specific. It now includes labels for town, region, province, county and postal code.
Added code to give field-specific errors.
Matched the on-screen field sizes to the database field sizes everywhere.the default text in address module and store module.
Added phone number to the items listed in anonymous address for both billing and shipping. Not required to be filled in. This is the first step in the progression discussed above.
Added text to anonymous fields explaining what the info was for.
Ensured that an anonymous can't be entered without an email address.
Made sure that it records an email address for logged in purchases.
There are a number of things I've not done that are related. Here's a node that documents them - node/49906.
I've tested this patch chiefly with shippable products. It should be tested with a wider range of products to see if there's anything special implemented that I don't know about. I have not tested it with the two recent anon patches, the first of which uses Javascript to copy from shipping to billing, and the second, above, which tries to solve anon problem in a different way.
I have not added anything to update.php but because the patch extends transaction table to include billing and shipping phone numbers, you'll need to run the following SQL for MySQL databases:
ALTER TABLE ec_transaction ADD shipping_phone VARCHAR(64) NOT NULL default '' AFTER shipping_country;
ALTER TABLE ec_transaction ADD billing_phone VARCHAR(64) NOT NULL default '' AFTER billing_country;
Lastly, I had to do a little hand editing of the patch file. It's possible that I've made a mistake. Shout loudly if the patch won't apply.
Jeff
Comment #11
dgtlmoon commentedHmm patch does not work on current CVS, just a note :D if you could get this working that would be one vote for drupal over some other systems
Comment #12
green monkey commentedDrupal 4.6.5
Impressed, that you are working on this.
I was about to open a feature request for the anonymous user Shipping and Billing address form ---- the method of handling data.
The way it resets all info - if the user doesn't complete - either the Shipping or Billing address info.
I like your carry over idea and believe most peope are familar with this method.
Is your "Billing Address the same" or "you forgot to enter your postal code" ... and saving the info --- so all they have to do is type in the missing info.
thanks
Comment #13
green monkey commentedDruapl 4.6.5
I was just thinking.
I have just moved my work in progress site to a prodcution location and my old work in progress site is still active and on a different database.
I would be very happy to help test this for you... but
that is a very big path - and I'm not that good with big patches - small ones usually ok - but the big ones get me.
I can do the mySQL stuff you mention using phpAdmin.
is there anyway possible that you can get the file in a already patched status?
thanks
Comment #14
jeff veit commenteddgtlmoon and jwells sorry I didn't reply when you wrote: I was on holiday.
dgtlmoon, the patch was against 4.6 CVS at 1st March, I think. If it's not working now, then most likely something in the address module has changed. You may be able to apply the patch by hand.
jwells, when I have some free time I'll update the patch to work with 4.6 CVS and let you know.
Comment #15
hakey commentedI tested your patch with latest ecommerce cvs available but it did not work well. Perhaps you could ellaborate more which version of address.module, store.inc and store.module, you have patched.
Whatever the time and date you specified on top of your patch, i selected those files from cvs and it did not work.
It takes lot of time to update files. it would be better if user can download your corrected files rather than fiddling with ++++ and _ _ _ .
Lot of drupal users are awaiting for this anonymous purchase option for ecommerce module 4.6x
thanks
Comment #16
deadmalc commentedI have hacked this together for drupal 4.6.x, it is VERY hacky but it all works well.
I am working on this for v 4.7.x at the moment along with a SECPay payment module.
You can see it in action at http://www.saaf.co.uk
I had to hack the address module and various other bits and pieces, but if anyone is interested
I wouldn't mind being actively involved in the development process.
I am not a programmer by profession at the moment (used to be years ago), but it didn't take me too
long to get it working.
There is a lot of stuff in the ecommerce module that needs doing, or that I think needs doing.
I do think it is an excellent piece of work, which is why I think it should surpass zen cart/os commerce/actinic etc.
without too much trouble
The new module changes I am writing I am aiming not to be so "hacky" and commented well so that they are well
recieved. If you want the current code for it just ask and I'll post it...but be warned it ain't pretty!
Thanks
Malcolm
Comment #17
simehi Malcolm
Glad to have you one board. Saw your post on the announcement and now here on this ticket - maybe you'd like to subscribe to the mailing list and join on IRC to discuss your ideas and what you want to contribute.
There are some links at the top of the read (if you've not seen them)
http://cvs.drupal.org/viewcvs/drupal/contributions/modules/ecommerce/REA...
.s
Comment #18
deadmalc commentedI have anon purchasing working fine on 4.6 (you can see it live at http://www.saaf.co.uk)
I modified the Drupal 4.6 database configuration for anon purchase by adding the following to the ec_transaction table
billing_tel
shipping_tel
I didn't need a shipping_mail (i.e. email address) and couldn't really think of a reason for it as if it is going to a different address,
then the likelyhood is that either it is a present, and you don't want to notify that person in that case or
the person is going somewhere else to pick it up. But if it is needed maybe a tick box defaulting to off stating tick this to
send an email to this person?
For Drupal 4.7 there is a ec_transaction_address, however this only contains one
address line, it doesn't specify the telephone number.
It needs a shipping first/last name and the rest of the shipping details as per other address details
I would personally prefer them to be named as per v4.6 i.e. billing_firstname and shipping_firstname etc.
for readability, obviously there is the likelyhood of breaking current code by doing this.
The address form needs modifying to support all of these fields and also to verify that valid data (I
just checked that some data was entered in each field and highlighted the field if it was not entered)
It should also have a tick box in case billing and shipping addresses are the same, or auto fill the shipping if
it is left blank
I need to get this done asap for drupal 4.7 as there are a whole load of other stuff that is missing that I need to get done,
so I'd appreciate any mistakes I've made in the logic
Comment #19
neclimdulWell, the new address table is a very nice feature when working in the code. instead of $txn->shipping_name or however it was stored you would simply use $txn->address['shipping']->name. Here's where its nice. since we just dump the database objects into the address associative array to add the telephone field you just add it to the table and it will start showing up in both objects(and any arbitrary address type you come up with). Furthermore, rather than copying the billing_* fields to the shipping_* fields when the mentioned checkbox if selected you just set $txn->['shipping'] = $txn['billing']; and its all done.
One step that I didn't take when writing this that would be a good step to getting this done would be to add a address form type. This would let you update the validation and forms accross ec by changing the form object.
What I'm not sure about in this post is that I thought anonymous purchases where working. Is the actual point to add a telephone number to the purchase? Hope this sheds some light on your development.
Comment #20
neclimdulAnonymous purchase have actually been fixed so I'm going to close this. The only thing not implemented was the phone number and tax idea mentioned. the later can be done with some work and the former can be handled in a seperate feature request.