Labels in the Cart for addresses are optional. They take the first line of the address if left blank. Tested w and w/o JS.
This commit is contained in:
parent
b8d7466e65
commit
5765739a95
4 changed files with 15 additions and 8 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
7.10.0
|
7.10.0
|
||||||
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
||||||
- added: Link in the Admin Console to the Addons section on webgui.org
|
- added: Link in the Admin Console to the Addons section on webgui.org
|
||||||
|
- added: Labels in the Shopping Cart addresses are optional.
|
||||||
|
|
||||||
7.9.13
|
7.9.13
|
||||||
- fixed #11783: Instances deleted during realtime run
|
- fixed #11783: Instances deleted during realtime run
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,7 @@ sub missingFields {
|
||||||
$addressData = $address;
|
$addressData = $address;
|
||||||
}
|
}
|
||||||
my @missingFields = ();
|
my @missingFields = ();
|
||||||
FIELD: foreach my $field (qw/label firstName lastName address1 city state code country phoneNumber/) {
|
FIELD: foreach my $field (qw/firstName lastName address1 city state code country phoneNumber/) {
|
||||||
push @missingFields, $field if $addressData->{$field} eq '';
|
push @missingFields, $field if $addressData->{$field} eq '';
|
||||||
}
|
}
|
||||||
return @missingFields;
|
return @missingFields;
|
||||||
|
|
@ -456,11 +456,10 @@ sub processAddressForm {
|
||||||
email => $form->get($prefix . "email", "email"),
|
email => $form->get($prefix . "email", "email"),
|
||||||
organization => $form->get($prefix . "organization"),
|
organization => $form->get($prefix . "organization"),
|
||||||
);
|
);
|
||||||
#my $label = $field eq 'address1' ? 'address'
|
|
||||||
# : $field eq 'phoneNumber' ? 'phone number'
|
|
||||||
# : $field
|
|
||||||
# ;
|
|
||||||
|
|
||||||
|
##Label is optional in the form, but required for the UI and API.
|
||||||
|
##Use the first address line in its place if it's missing
|
||||||
|
$addressData{label} = $addressData{address1} if ! $addressData{label};
|
||||||
return %addressData;
|
return %addressData;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,6 @@ sub getI18nError {
|
||||||
my $i18n = WebGUI::International->new($self->session, 'Shop');
|
my $i18n = WebGUI::International->new($self->session, 'Shop');
|
||||||
return $error eq 'no billing address' ? $i18n->get('no billing address')
|
return $error eq 'no billing address' ? $i18n->get('no billing address')
|
||||||
: $error eq 'no shipping address' ? $i18n->get('no shipping address')
|
: $error eq 'no shipping address' ? $i18n->get('no shipping address')
|
||||||
: $error eq 'billing label' ? $i18n->get('billing label')
|
|
||||||
: $error eq 'billing firstName' ? $i18n->get('billing firstName')
|
: $error eq 'billing firstName' ? $i18n->get('billing firstName')
|
||||||
: $error eq 'billing lastName' ? $i18n->get('billing lastName')
|
: $error eq 'billing lastName' ? $i18n->get('billing lastName')
|
||||||
: $error eq 'billing address1' ? $i18n->get('billing address1')
|
: $error eq 'billing address1' ? $i18n->get('billing address1')
|
||||||
|
|
@ -308,7 +307,6 @@ sub getI18nError {
|
||||||
: $error eq 'billing state' ? $i18n->get('billing state')
|
: $error eq 'billing state' ? $i18n->get('billing state')
|
||||||
: $error eq 'billing country' ? $i18n->get('billing country')
|
: $error eq 'billing country' ? $i18n->get('billing country')
|
||||||
: $error eq 'billing phoneNumber' ? $i18n->get('billing phoneNumber')
|
: $error eq 'billing phoneNumber' ? $i18n->get('billing phoneNumber')
|
||||||
: $error eq 'shipping label' ? $i18n->get('shipping label')
|
|
||||||
: $error eq 'shipping firstName' ? $i18n->get('shipping firstName')
|
: $error eq 'shipping firstName' ? $i18n->get('shipping firstName')
|
||||||
: $error eq 'shipping lastName' ? $i18n->get('shipping lastName')
|
: $error eq 'shipping lastName' ? $i18n->get('shipping lastName')
|
||||||
: $error eq 'shipping address1' ? $i18n->get('shipping address1')
|
: $error eq 'shipping address1' ? $i18n->get('shipping address1')
|
||||||
|
|
|
||||||
|
|
@ -38,9 +38,18 @@
|
||||||
|
|
||||||
var Cart = {
|
var Cart = {
|
||||||
attachAddressBlurHandlers: function (name) {
|
attachAddressBlurHandlers: function (name) {
|
||||||
var fields = _.values(this.elements[name]),
|
var els = this.elements[name],
|
||||||
|
label = els.label,
|
||||||
|
addr = els.address1,
|
||||||
|
fields = _.values(els),
|
||||||
handler = this.createAddressBlurHandler(name);
|
handler = this.createAddressBlurHandler(name);
|
||||||
this.event.on(fields, 'focusout', handler);
|
this.event.on(fields, 'focusout', handler);
|
||||||
|
this.event.on(addr, 'focusout', function () {
|
||||||
|
if (!label.value) {
|
||||||
|
label.value = addr.value;
|
||||||
|
label.blur();
|
||||||
|
}
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
attachAddressSelectHandler: function (name) {
|
attachAddressSelectHandler: function (name) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue