diff --git a/Block/Checkout/LayoutProcessor.php b/Block/Checkout/LayoutProcessor.php old mode 100644 new mode 100755 index bf254dc..4e2548b --- a/Block/Checkout/LayoutProcessor.php +++ b/Block/Checkout/LayoutProcessor.php @@ -106,11 +106,7 @@ public function modifyStreetUiComponents($addressResult) $lineNumber = $lineCount+1; if(isset($addressResult['street']['children'][$lineCount])){ - $group = "experius_address_lines/experius_address_line{$lineNumber}"; - //var_dump($group); die(); - $label = ($this->addressLineHelper->getModuleConfig("line_label", $group)) - ? $this->addressLineHelper->getModuleConfig("line_label", $group) - : __('Address Line'); + $label = $this->addressLineHelper->getLineLabel($lineNumber); if ( $this->addressLineHelper->getModuleConfig("line_enabled", $group)) { $addressResult['street']['children'][$lineCount]['label'] = $label; diff --git a/Helper/Data.php b/Helper/Data.php old mode 100644 new mode 100755 index c2cd4d3..8fafae7 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -16,10 +16,58 @@ public function getModuleConfig($field = false, $group = false, $section = false //var_dump("{$section}/{$group}/{$field}"); exit();die(); return $this->scopeConfig->getValue("{$section}/{$group}/{$field}", \Magento\Store\Model\ScopeInterface::SCOPE_STORE); } + + public function getLineLabel($lineNumber) + { + $group = "experius_address_lines/experius_address_line{$lineNumber}"; + $label = ($this->getModuleConfig("line_label", $group)) + ? $this->getModuleConfig("line_label", $group) + : __('Address Line'); + return $label; + } + + public function getValidationMaxLength($lineNumber) + { + $group = "experius_address_lines/experius_address_line{$lineNumber}"; + $maxLength = ($this->getModuleConfig("line_max_length", $group)) + ? $this->getModuleConfig("line_max_length", $group) + : false; + return $maxLength; + } + + public function getValidationMinLength($lineNumber) + { + $group = "experius_address_lines/experius_address_line{$lineNumber}"; + $maxLength = ($this->getModuleConfig("line_min_length", $group)) + ? $this->getModuleConfig("line_min_length", $group) + : false; + return $maxLength; + } + + public function isLineRequired($lineNumber) + { + $group = "experius_address_lines/experius_address_line{$lineNumber}"; + return $this->getModuleConfig("line_required", $group); + } + + public function getValidationClassesForLine($lineNumber) + { + if (!$this->getValidationClassesAsArrayForLine($lineNumber)) { + return; + } + $validationArray = $this->getValidationClassesAsArrayForLine($lineNumber); + if (key_exists('validate-number',$validationArray)) { + $validationArray['validate-digits'] = 1; + unset($validationArray['validate-number']); + } + $validationClassesString = ' ' . implode(' ', array_keys($validationArray)); + return $validationClassesString; + } + public function getValidationClassesAsArrayForLine($lineNumber) { $group = "experius_address_lines/experius_address_line{$lineNumber}"; - + $validationClassesString = $this->getModuleConfig("line_validation_classes", $group); //var_dump($validationClassesString); $validationParts = explode(',', $validationClassesString); @@ -28,11 +76,11 @@ public function getValidationClassesAsArrayForLine($lineNumber) foreach($validationParts as $validationPart) { $validationPartArray = explode(':', $validationPart); - if (empty($validationPartArray)) { + if (!empty($validationPartArray)) { $validationClassesArray[$validationPartArray[0]] = (int) $validationPartArray[1]; } } - if($this->getModuleConfig("line_required", $group)){ + if($this->isLineRequired($lineNumber)){ $validationClassesArray['required-entry'] = 1; } return $validationClassesArray; diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml old mode 100644 new mode 100755 index 7fd341e..0b717d7 --- a/etc/adminhtml/system.xml +++ b/etc/adminhtml/system.xml @@ -21,6 +21,14 @@ + + + Necessary for registrion page and address edit. + + + + Necessary for registrion page and address edit. + @@ -38,6 +46,14 @@ + + + Necessary for registrion page and address edit. + + + + Necessary for registrion page and address edit. + @@ -55,6 +71,14 @@ + + + Necessary for registrion page and address edit. + + + + Necessary for registrion page and address edit. + @@ -72,6 +96,14 @@ + + + Necessary for registrion page and address edit. + + + + Necessary for registrion page and address edit. + diff --git a/etc/config.xml b/etc/config.xml old mode 100644 new mode 100755 index 5073b84..6018499 --- a/etc/config.xml +++ b/etc/config.xml @@ -9,6 +9,8 @@ Street 1 max_text_length:255,min_text_length:1 + 1 + 255 0 @@ -21,6 +23,7 @@ Addition 0 max_text_length:255,min_text_length:1 + 255 0 diff --git a/etc/module.xml b/etc/module.xml old mode 100644 new mode 100755 index 99b3466..a65de37 --- a/etc/module.xml +++ b/etc/module.xml @@ -3,6 +3,8 @@ + + diff --git a/view/frontend/layout/customer_account_create.xml b/view/frontend/layout/customer_account_create.xml new file mode 100755 index 0000000..93932f2 --- /dev/null +++ b/view/frontend/layout/customer_account_create.xml @@ -0,0 +1,17 @@ + + + + + + + + Experius_AddressLines::/experius/customer/form/register.phtml + + + + diff --git a/view/frontend/layout/customer_address_form.xml b/view/frontend/layout/customer_address_form.xml new file mode 100755 index 0000000..d0a06c1 --- /dev/null +++ b/view/frontend/layout/customer_address_form.xml @@ -0,0 +1,17 @@ + + + + + + + + Experius_AddressLines::/experius/customer/address/edit.phtml + + + + diff --git a/view/frontend/templates/experius/customer/address/edit.phtml b/view/frontend/templates/experius/customer/address/edit.phtml new file mode 100755 index 0000000..3090845 --- /dev/null +++ b/view/frontend/templates/experius/customer/address/edit.phtml @@ -0,0 +1,174 @@ + + +
+
+
+ getBlockHtml('formkey')?> + + + getNameBlockHtml() ?> +
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+
+ helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('street'); ?> + + helper('Experius\AddressLines\Helper\Data')->getValidationClassesForLine($_i)): ?> + helper('Experius\AddressLines\Helper\Data')->getValidationClassesForLine($_i); ?> + +
+ +
+ + +
+ helper('Magento\Customer\Helper\Address')->getStreetLines(); $_i <= $_n; $_i++): ?> + helper('Magento\Customer\Helper\Address')->getAttributeValidationClass('street'); ?> + + helper('Experius\AddressLines\Helper\Data')->getValidationClassesForLine($_i)): ?> + helper('Experius\AddressLines\Helper\Data')->getValidationClassesForLine($_i); ?> + +
+ +
+ helper('Experius\AddressLines\Helper\Data')->getValidationMaxLength($_i)) { echo 'maxlength="' . $this->helper('Experius\AddressLines\Helper\Data')->getValidationMaxLength($_i) . '"' ; } ?> helper('Experius\AddressLines\Helper\Data')->getValidationMinLength($_i)) { echo 'minlength="' . $this->helper('Experius\AddressLines\Helper\Data')->getValidationMinLength($_i) . '"' ; } ?> title="helper('Experius\AddressLines\Helper\Data')->getLineLabel($_i) ?>" id="street_" class="input-text "> +
+
+ +
+
+
+ + helper('Magento\Customer\Helper\Address')->isVatAttributeVisible()) : ?> +
+ +
+ +
+
+ +
+ +
+ +
+
+
+ +
+ + getConfig('general/region/display_all')) ? ' disabled="disabled"' : '';?>/> +
+
+
+ +
+ +
+
+
+ +
+ getCountryHtmlSelect() ?> +
+
+ + getLayout()->getBlock('customer_form_address_user_attributes'); ?> + + setShowContainer(false)->toHtml(); ?> + + isDefaultBilling()): ?> +
+ +
+ canSetAsDefaultBilling()): ?> +
+ + +
+ + + + + isDefaultShipping()): ?> +
+ +
+ canSetAsDefaultShipping()): ?> +
+ + +
+ + + +
+
+
+ +
+
+ + + +
+
+
+ diff --git a/view/frontend/templates/experius/customer/form/register.phtml b/view/frontend/templates/experius/customer/form/register.phtml new file mode 100755 index 0000000..0b44f42 --- /dev/null +++ b/view/frontend/templates/experius/customer/form/register.phtml @@ -0,0 +1,235 @@ + + +getChildHtml('form_fields_before')?> + +getChildHtml('customer.form.register.extra')?> + + +getShowAddressFields()): ?> + +