Not sure if this would be an approved fix, but I patched the 
ContactInfoForm to be a bit more sensible about non-shippable carts. Bold 
part below is the change - I just stared at the logic a bit and used the 
same train of thought that the other clean functions used for things like 
the ship_country and ship_postal_code.


    def ship_charfield_clean(self, field_name):
        if self.cleaned_data.get('copy_address') *or not self._shippable*:
            self.cleaned_data['ship_' + field_name] = clean_field(self, 
field_name)
            return self.cleaned_data['ship_' + field_name]
        else:
            val = clean_field(self, 'ship_' + field_name)
            # REQUIRED_SHIPPING_DATA doesn't contain 'ship_' prefix
            if (not val) and field_name in self.required_shipping_data:
                raise forms.ValidationError(_('This field is required.'))
            return val


If this looks good I can open it as a ticket with a patch.



On Friday, March 28, 2014 6:13:22 PM UTC-5, LZAntal wrote:
>
> Hi,
>
>
> On Mar 28, 2014, at 11:40, Darren Hollenbeck 
> <[email protected]<javascript:>> 
> wrote:
>
> As title says... the form produces validation errors since the required 
> fields are not present (the template doesn't even render them): 
>
> {% if cart.is_shippable %}
>     {% block shipping-info %}{% include 
> "contact/_contact_info_form_shipping.html" %}{% endblock %}
> {% endif %}
>
> How can I have these fields be non-required if the cart contains only 
> non-shippable items?
>
>
> I solved that awhile back by adding in an else and adding the required 
> form fields as hidden so the form can validate. It's a hack but it worked. 
>
> Hope it helps
>
> Laszlo
> http://twitter.com/LZAntal
>
>  -- 
> You received this message because you are subscribed to the Google Groups 
> "Satchmo users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] <javascript:>.
> To post to this group, send email to [email protected]<javascript:>
> .
> Visit this group at http://groups.google.com/group/satchmo-users.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Satchmo users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/satchmo-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to