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

Use Shipping Address Issue


Go to End


6 Posts   2746 Views

Avatar
neonfrog

Community Member, 10 Posts

15 October 2009 at 1:29pm

How does one stop the validators when one clicks "use different shipping address". This issue has been annoying the hell out of me. Next to this how does one prevent the form fields being cleared when OrderForm useDifferentShippingAddress function does a redirectBack()

These two issues are a major usability problem.

Has anyone sorted them out appart from removing the use different shipping address fields which are actually a useful feature?

Avatar
dalesaurus

Community Member, 283 Posts

16 October 2009 at 5:45pm

Extend the validator to either cut the JS altogether or get to writing some Prototype to skip on click from the href selector

class MyAwesomerValidator extends RequiredFields {

     public function javascript() {
          //  return ''; to get rid of all validation

          // or do something smart like 
          if ($this->form->Name() == 'ShippingForm'){ add smart custom code }
     }

}

The next step would be to use useCustomClass() to replace the annoying shipping form to one that extends it and uses the MyAwesomerValidator instead. Or if you write it smartly you could replace RequiredFields instead.

As for the redirectBack(), that is just not how things work. Don't forget this module is still in beta.

Avatar
dio5

Community Member, 501 Posts

10 November 2009 at 1:05am

Edited: 10/11/2009 1:05am

+1 for thinking this is pretty annoying.

(ps: did you succeed at turning it off?)

Avatar
jhirm

Community Member, 21 Posts

23 December 2009 at 10:59am

Agreed, annoying as hell. The ecommerce module has so many usability quirks/annoyances that it's practically unusable without significant modification. I guess that's why it's still in beta, and is an unsupported module. Maybe one of these days when I have some free time (ha!) I'll put together and post a version of the module that includes the basic set of changes I make every time I'm forced to use it. Word on the street is that the next version of SS will use jQuery instead of Prototype, which would be nice.

To fix the problem mentioned here, I modified the OrderForm so that it always shows a Shipping Address fieldset with a checkbox at the top (Ship to Billing Address) that auto fills from the billing to the shipping fields. Then I do all the validation with jQuery. It's not perfect, but it's infinitely more usable than the default, in my opinion.

See www.yellowstonecheese.com/checkout/ as an example.

Avatar
dhensby

Community Member, 253 Posts

11 March 2010 at 11:33pm

Hey guys,

I've been working on an eCommerce site and i got round this by overriding the validate() method in OrderForm.php.

I copied the method, and replaed the first if condition with:

		if($this->validator && !isset($_REQUEST['action_useDifferentShippingAddress']) && !isset($_REQUEST['action_useMemberShippingAddress'])){

Hope that helps you guys.

Avatar
grumpypanda

Community Member, 32 Posts

6 January 2012 at 4:21pm

Hi there,

I'm trying to fix someone else's code, and running into the form fields being cleared when OrderForm useDifferentShippingAddress function does a redirectBack() issue. Anyone found a solution for it in the end to prevent fields to be cleared? Please help.

Thanks a lot.
Sam