This repository has been archived by the owner on Jun 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from pmclain/feature/customer-address-management
Feature/customer address management
- Loading branch information
Showing
8 changed files
with
187 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Pmclain_Twilio extension | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the GPL v3 License | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://www.gnu.org/licenses/gpl.txt | ||
* | ||
* @category Pmclain | ||
* @package Twilio | ||
* @copyright Copyright (c) 2017 | ||
* @license https://www.gnu.org/licenses/gpl.txt GPL v3 License | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Store:etc/config.xsd"> | ||
<default> | ||
<customer> | ||
<address_templates> | ||
<html><![CDATA[{{depend prefix}}{{var prefix}} {{/depend}}{{var firstname}} {{depend middlename}}{{var middlename}} {{/depend}}{{var lastname}}{{depend suffix}} {{var suffix}}{{/depend}}{{depend firstname}}<br/>{{/depend}} | ||
{{depend company}}{{var company}}<br />{{/depend}} | ||
{{if street1}}{{var street1}}<br />{{/if}} | ||
{{depend street2}}{{var street2}}<br />{{/depend}} | ||
{{depend street3}}{{var street3}}<br />{{/depend}} | ||
{{depend street4}}{{var street4}}<br />{{/depend}} | ||
{{if city}}{{var city}}, {{/if}}{{if region}}{{var region}}, {{/if}}{{if postcode}}{{var postcode}}{{/if}}<br/> | ||
{{var country}}<br/> | ||
{{depend telephone}}T: {{var telephone}}{{/depend}} | ||
{{depend sms_alert}}<br/>SMS Enabled: {{var sms_alert}}{{/depend}} | ||
{{depend fax}}<br/>F: {{var fax}}{{/depend}} | ||
{{depend vat_id}}<br/>VAT: {{var vat_id}}{{/depend}}]]></html> | ||
</address_templates> | ||
</customer> | ||
</default> | ||
</config> |
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
40 changes: 40 additions & 0 deletions
40
view/frontend/web/js/action/create-shipping-address-mixin.js
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,40 @@ | ||
/** | ||
* Pmclain_Twilio extension | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the GPL v3 License | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://www.gnu.org/licenses/gpl.txt | ||
* | ||
* @category Pmclain | ||
* @package Twilio | ||
* @copyright Copyright (c) 2017 | ||
* @license https://www.gnu.org/licenses/gpl.txt GPL v3 License | ||
*/ | ||
|
||
define([ | ||
'jquery', | ||
'mage/utils/wrapper' | ||
], function($, wrapper) { | ||
'use strict'; | ||
|
||
return function (createShippingAddressAction) { | ||
return wrapper.wrap(createShippingAddressAction, function(originalAction, addressData) { | ||
if (addressData.custom_attributes === undefined) { | ||
return originalAction(); | ||
} | ||
|
||
if (addressData.custom_attributes['sms_alert']) { | ||
addressData.custom_attributes['sms_alert'] = { | ||
'attribute_code': 'sms_alert', | ||
'value': 'SMS Enabled', | ||
'status': 1 | ||
} | ||
} | ||
|
||
return originalAction(); | ||
}); | ||
}; | ||
}); |
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,39 @@ | ||
/** | ||
* Pmclain_Twilio extension | ||
* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the GPL v3 License | ||
* that is bundled with this package in the file LICENSE.txt. | ||
* It is also available through the world-wide-web at this URL: | ||
* https://www.gnu.org/licenses/gpl.txt | ||
* | ||
* @category Pmclain | ||
* @package Twilio | ||
* @copyright Copyright (c) 2017 | ||
* @license https://www.gnu.org/licenses/gpl.txt GPL v3 License | ||
*/ | ||
|
||
define([ | ||
'jquery', | ||
'mage/utils/wrapper', | ||
'mage/translate' | ||
], function($, wrapper) { | ||
'use strict'; | ||
|
||
return function (addressModel) { | ||
return wrapper.wrap(addressModel, function(originalAction) { | ||
var address = originalAction(); | ||
|
||
if(address.customAttributes !== undefined) { | ||
if(address.customAttributes['sms_alert']) { | ||
var enabled = address.customAttributes['sms_alert'].value; | ||
address.customAttributes['sms_alert'].value = $.mage.__(enabled ? 'SMS Enabled' : 'SMS Disabled'); | ||
address.customAttributes['sms_alert'].status = enabled ? 1 : 0; | ||
} | ||
} | ||
|
||
return address; | ||
}); | ||
}; | ||
}); |