-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BP-3326 Change new required fields for Riverty DE (#127)
* BP-3326 Change new required fields for Riverty DE * fix display issue * add validation on submit, validate only for DE * fix issue with country --------- Co-authored-by: Ivascu Madalin <[email protected]>
- Loading branch information
Showing
8 changed files
with
105 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php | ||
/** | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the Academic Free License (AFL 3.0) | ||
* It is available through the world-wide-web at this URL: | ||
* http://opensource.org/licenses/afl-3.0.php | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this file | ||
* | ||
* @author Buckaroo.nl <[email protected]> | ||
* @copyright Copyright (c) Buckaroo B.V. | ||
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) | ||
*/ | ||
|
||
namespace Buckaroo\PrestaShop\Src; | ||
|
||
|
||
class AddressComponents | ||
{ | ||
/** | ||
* Split address to parts | ||
* | ||
* @param string $address | ||
* | ||
* @return array | ||
*/ | ||
public static function getAddressComponents($address) | ||
{ | ||
$result = []; | ||
$result['house_number'] = ''; | ||
$result['number_addition'] = ''; | ||
|
||
$address = str_replace(['?', '*', '[', ']', ',', '!'], ' ', $address); | ||
$address = preg_replace('/\s\s+/', ' ', $address); | ||
|
||
preg_match('/^([0-9]*)(.*?)([0-9]+)(.*)/', $address, $matches); | ||
|
||
if (!empty($matches[2])) { | ||
$result['street'] = trim($matches[1] . $matches[2]); | ||
$result['house_number'] = trim($matches[3]); | ||
$result['number_addition'] = trim($matches[4]); | ||
} else { | ||
$result['street'] = $address; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters