A client complained that it was tedious for site visitors to have to type in both shipping and billing addresses in order to checkout (mostly I'm concerned with anonymous purchases here). So, I wrote some simple javascript that goes into store.inc to create a button for people to easily copy shipping fields to billing fields. I omitted the country field because I'm only dealing with the US. That would be easy to change, though.

I like the code, I hope it will be useful to you.

Comments

gordon’s picture

Instead of using some js to copy the address, why not put a checkbox to say as above and the php code in behind will copy the address.

This means that if js is turned off the user still has the same functionality.

neclimdul’s picture

I agree with gordon. This degrades better. If you wanted some flashy js to go along with it, have a function bound to the click that disables the fields. This way the js user gets there money's worth and the non js user still gets the functionality.

gordon’s picture

With the formsapi you are actually able to re-theme every form, so adding in the js is just a matter re-theming the form.

BTW, I would actually prefer this for cvs first before I apply this to 4.6

sime’s picture

Component: store.module » address

pushing to HEAD

neclimdul’s picture

Version: 4.6.x-1.x-dev » master

like he said.

gordon’s picture

Status: Needs review » Needs work

This needs to be built using the new jQuery interface.

And it needs to be in it's own .js file.

sime’s picture

Status: Needs work » Closed (won't fix)