Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

E-Commerce Modules /

Discuss about the various e-commerce modules available:
Ecommerce, SS Shop, SilverCart and SwipeStripe
Alternatively, have a look the shared mailinglist.

Moderators: martimiz, Nicolaas, Sean, Ed, frankmullenger, biapar, Willr, Ingo, Jedateach, swaiba

Adding state and zip fields to checkout form


Go to End


2 Posts   3255 Views

Avatar
masterys

Community Member, 5 Posts

17 September 2009 at 5:56am

Edited: 17/09/2009 6:29am

I'm new to this module (and relatively new to SilverStripe and PHP) and am learning to use the 0.6 beta version in an installation of SS 2.3.3. I see that this module is designed for people in Europe and other parts of the world, but I need to use it in a site that's primarily for a U.S. audience.

I had found a post in the forums, that's nearly a year old, where someone had localized the module for the U.S., but the files provided don't work in this version of the module. I'm wondering how I go about adding State and Zip Code fields to the checkout page. I see on the documentation page there are some instructions for order form customization, but it doesn't tell you what file(s) to make the customization in. Can anyone point me to the file(s) that need editing for those new fields to get added to the database properly and to show up on the page, as well as get sent over to PayPal (the payment method I'm going to be using)? I'd actually like to completely remove the Country field as well.

I'd also like to be able to make sure any dates are shown in MM/DD/YYYY format, if possible. I understand that this module shows them DD/MM/YYYY (or something similar).

Avatar
mschiefmaker

Community Member, 187 Posts

20 September 2009 at 4:54pm

Edited: 20/09/2009 4:55pm

I am still getting this worked out myself so I am not sure if this is the way to do it but if you open EcommerceRole.php and add
new TextField('State', 'State'),
new TextField('Postcode', 'Postcode'),

in the function getEcommerceFields(). It will add the additional fields to the form but it doesn't introduce additional files to the order table. These can be added to the member table via the extraDBFields() function earlier in the same file.

Cheers

MM