Skip to content

Commit e3a0cb8

Browse files
Merge pull request #94 from Veriteworks/fix-checkout-address-search
added Magento_CheckoutAddressSearch compatibility.
2 parents 266c208 + 7804018 commit e3a0cb8

File tree

7 files changed

+284
-0
lines changed

7 files changed

+284
-0
lines changed

JapaneseAddress/Block/Checkout/BillingAddressComponent.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@ private function walkChildren(array $component): array
5252
'template' => 'CommunityEngineering_JapaneseAddress/checkout/billing-address'
5353
]
5454
);
55+
} elseif($component['component'] === 'Magento_CheckoutAddressSearch/js/view/billing-address') {
56+
$component['config'] = array_merge(
57+
isset($component['config']) ? $component['config'] : [],
58+
[
59+
'detailsTemplate' => 'CommunityEngineering_JapaneseAddress/checkout-address-search/billing-address/jp'
60+
]
61+
);
62+
$component['children']['billingAddressList']['children']
63+
['selectBillingAddressModal']['children']['searchBillingAddress']['addressTmpl'] =
64+
'CommunityEngineering_JapaneseAddress/checkout-address-search/billing-address/address-renderer/jp';
5565
} else {
5666
$component['children'][$name] = $this->walkChildren($child);
5767
}

JapaneseAddress/etc/module.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<module name="Magento_Customer"/>
1212
<module name="Magento_Checkout"/>
1313
<module name="Magento_Sales"/>
14+
<module name="Magento_CheckoutAddressSearch" />
1415
<module name="CommunityEngineering_JapaneseName"/>
1516
</sequence>
1617
</module>

JapaneseAddress/view/frontend/layout/checkout_index_index.xml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,22 @@
2020
<item name="shippingAddress" xsi:type="array">
2121
<item name="children" xsi:type="array">
2222
<item name="address-list" xsi:type="array">
23+
<item name="children" xsi:type="array">
24+
<item name="addressDefault" xsi:type="array">
25+
<item name="config" xsi:type="array">
26+
<item name="template" xsi:type="string">CommunityEngineering_JapaneseAddress/checkout-address-search/shipping-address/jp</item>
27+
</item>
28+
</item>
29+
<item name="selectShippingAddressModal" xsi:type="array">
30+
<item name="children" xsi:type="array">
31+
<item name="searchShippingAddress" xsi:type="array">
32+
<item name="config" xsi:type="array">
33+
<item name="addressTmpl" xsi:type="string">CommunityEngineering_JapaneseAddress/checkout-address-search/shipping-address/address-renderer/jp</item>
34+
</item>
35+
</item>
36+
</item>
37+
</item>
38+
</item>
2339
<item name="config" xsi:type="array">
2440
<item name="rendererTemplates" xsi:type="array">
2541
<item name="customer-address" xsi:type="array">
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<li class="admin__action-multiselect-menu-inner-item _root"
8+
data-role="option-group"
9+
css="_parent: $data.optgroup">
10+
<div class="action-menu-item"
11+
css="_hover: $parent.isHovered(option, $element), _unclickable: $parent.isLabelDecoration($data), _last: $parent.addLastElement($data), '_with-checkbox': $parent.showCheckbox">
12+
<div class="address-details">
13+
<div>
14+
<span text="$data.lastname"/>
15+
<span text="$data.firstname"/>
16+
<text if="$data.getNamekana()" args="'(' + $data.getNamekana() + ')'"/>
17+
</div>
18+
<if args="$parent.getCountryName($data.countryId)">
19+
<text args="$parent.getCountryName($data.countryId)"/>
20+
</if>
21+
<div>
22+
<span text="$data.postcode"/>
23+
<span text="$data.region"/>
24+
<span text="$data.city"/>
25+
</div>
26+
<div>
27+
<text args="_.values($data.street).join('')"/>
28+
</div>
29+
30+
<if args="_.isArray($data.customAttributes)">
31+
<each args="data: $data.customAttributes, as: 'attribute'">
32+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
33+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
34+
</if>
35+
</each>
36+
</if>
37+
<ifnot args="_.isArray($data.customAttributes)">
38+
<each args="data: Object.values($data.customAttributes), as: 'attribute'">
39+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
40+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
41+
</if>
42+
</each>
43+
</ifnot>
44+
</div>
45+
<div class="select-address" ifnot="$parent.isAddressSelected(option)">
46+
<button type="button"
47+
class="action-primary action-select-billing-item"
48+
click="$parent.selectBillingAddress.bind($parent, option)">
49+
<span translate="'Select'"></span>
50+
</button>
51+
</div>
52+
<div class="address-selected" if="$parent.isAddressSelected(option)">
53+
<button type="button"
54+
class="action-primary">
55+
<span translate="'Selected'"></span>
56+
</button>
57+
</div>
58+
<div class="edit-address" if="$parent.isAddressEditable(option)">
59+
<button type="button"
60+
class="action-primary action-select-shipping-item"
61+
click="$parent.editAction.bind($parent, option)">
62+
<span translate="'Edit'"></span>
63+
</button>
64+
</div>
65+
<div class="default-address" if="option.isDefaultBilling()">
66+
<button type="button"
67+
class="action-primary">
68+
<span translate="'Default'"></span>
69+
</button>
70+
</div>
71+
</div>
72+
</li>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<div class="billing-address-details">
8+
<if args="_.isEmpty(currentBillingAddress())">
9+
<p text="noAddressMessage"></p>
10+
</if>
11+
<ifnot args="_.isEmpty(currentBillingAddress())">
12+
<text args="currentBillingAddress().prefix"/>
13+
<text args="currentBillingAddress().lastname"/>
14+
<text args="currentBillingAddress().middlename"/>
15+
<text args="currentBillingAddress().firstname"/>
16+
<text args="currentBillingAddress().suffix"/>
17+
<text if="currentBillingAddress().getNamekana()" args="'(' + currentBillingAddress().getNamekana() + ')'"/><br/>
18+
19+
<text args="currentBillingAddress().postcode"/><br/>
20+
<span text="currentBillingAddress().region"></span><text args="currentBillingAddress().city "/>
21+
<text args="_.values(currentBillingAddress().street).join('')"/>
22+
<br/>
23+
<a if="currentBillingAddress().telephone" attr="'href': 'tel:' + currentBillingAddress().telephone"
24+
text="currentBillingAddress().telephone"></a><br/>
25+
<if args="_.isArray(currentBillingAddress().customAttributes)">
26+
<each args="data: currentBillingAddress().customAttributes, as: 'attribute'">
27+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
28+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
29+
</if>
30+
</each>
31+
</if>
32+
<ifnot args="_.isArray(currentBillingAddress().customAttributes)">
33+
<each args="data: Object.values(currentBillingAddress().customAttributes), as: 'attribute'">
34+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
35+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
36+
</if>
37+
</each>
38+
</ifnot>
39+
</ifnot>
40+
41+
<div class="edit-address-popup">
42+
<button type="button"
43+
class="action action-additional"
44+
visible="isAddressEditable(currentBillingAddress())"
45+
click="editAddress">
46+
<span translate="'Edit'"></span>
47+
</button>
48+
</div>
49+
<div class="change-address-popup">
50+
<button type="button"
51+
class="action action-additional"
52+
click="openAddressSelection">
53+
<span translate="'Change Address'"></span>
54+
</button>
55+
</div>
56+
</div>
57+
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<li class="admin__action-multiselect-menu-inner-item _root"
8+
data-role="option-group"
9+
css="_parent: $data.optgroup">
10+
<div class="action-menu-item"
11+
css="_hover: $parent.isHovered(option, $element), _unclickable: $parent.isLabelDecoration($data), _last: $parent.addLastElement($data), '_with-checkbox': $parent.showCheckbox">
12+
<div class="address-details">
13+
<div>
14+
<span text="$data.lastname"/>
15+
<span text="$data.firstname"/>
16+
<text if="$data.getNamekana()" args="'(' + $data.getNamekana() + ')'"/>
17+
</div>
18+
<if args="$parent.getCountryName($data.countryId)">
19+
<text args="$parent.getCountryName($data.countryId)"/>
20+
</if>
21+
<div>
22+
<span text="$data.postcode"/>
23+
<span text="$data.region"/>
24+
<span text="$data.city"/>
25+
</div>
26+
<div>
27+
<text args="_.values($data.street).join('')"/>
28+
</div>
29+
30+
<if args="_.isArray($data.customAttributes)">
31+
<each args="data: $data.customAttributes, as: 'attribute'">
32+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
33+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
34+
</if>
35+
</each>
36+
</if>
37+
<ifnot args="_.isArray($data.customAttributes)">
38+
<each args="data: Object.values($data.customAttributes), as: 'attribute'">
39+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
40+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
41+
</if>
42+
</each>
43+
</ifnot>
44+
</div>
45+
<div class="ship-here" ifnot="$parent.isAddressSelected($data)">
46+
<button type="button"
47+
class="action-primary action-select-shipping-item"
48+
click="$parent.selectShippingAddress.bind($parent, option)">
49+
<span translate="'Ship Here'"/>
50+
</button>
51+
</div>
52+
<div class="address-selected" if="$parent.isAddressSelected($data)">
53+
<button type="button"
54+
class="action-primary">
55+
<span translate="'Selected'"/>
56+
</button>
57+
</div>
58+
<div class="edit-address" if="$data.isEditable()">
59+
<button type="button"
60+
class="action-primary action-select-shipping-item"
61+
click="$parent.editAction.bind($parent)">
62+
<span translate="'Edit'"/>
63+
</button>
64+
</div>
65+
<div class="default-address" if="$data.isDefaultShipping()">
66+
<button type="button"
67+
class="action-primary">
68+
<span translate="'Default'"/>
69+
</button>
70+
</div>
71+
</div>
72+
</li>
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<!--
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
-->
7+
<div class="shipping-address-item selected">
8+
<if args="defaultAddress()">
9+
<text args="defaultAddress().prefix"/>
10+
<text args="defaultAddress().lastname"/>
11+
<text args="defaultAddress().middlename"/>
12+
<text args="defaultAddress().firstname"/>
13+
<text args="defaultAddress().suffix"/>
14+
<text if="defaultAddress().getNamekana()" args="'(' + defaultAddress().getNamekana() + ')'"/><br/>
15+
16+
<text args="defaultAddress().postcode"/><br/>
17+
<span text="defaultAddress().region"></span><text args="defaultAddress().city "/><text args="_.values(defaultAddress().street).join('')"/>
18+
<br/>
19+
<a if="defaultAddress().telephone" attr="'href': 'tel:' + defaultAddress().telephone"
20+
text="defaultAddress().telephone"></a><br/>
21+
22+
<if args="_.isArray(defaultAddress().customAttributes)">
23+
<each args="data: defaultAddress().customAttributes, as: 'attribute'">
24+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
25+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
26+
</if>
27+
</each>
28+
</if>
29+
<ifnot args="_.isArray(defaultAddress().customAttributes)">
30+
<each args="data: Object.values(defaultAddress().customAttributes), as: 'attribute'">
31+
<if args="['firstnamekana', 'lastnamekana'].indexOf(attribute.attribute_code) === -1">
32+
<if args="attribute.label"><text args="attribute.label"/>: </if><text args="attribute.value"/><br/>
33+
</if>
34+
</each>
35+
</ifnot>
36+
</if>
37+
<ifnot args="defaultAddress()">
38+
<p text="noAddressMessage"></p>
39+
</ifnot>
40+
<div class="edit-address-popup">
41+
<button type="button"
42+
class="action action-additional"
43+
visible="defaultAddress() && defaultAddress().isEditable()"
44+
click="editAddress">
45+
<span translate="'Edit'"></span>
46+
</button>
47+
</div>
48+
<div class="change-address-popup">
49+
<button type="button"
50+
class="action action-additional"
51+
visible="isChangeAddressVisible"
52+
click="openAddressSelection">
53+
<span translate="'Change Address'"></span>
54+
</button>
55+
</div>
56+
</div>

0 commit comments

Comments
 (0)