Skip to content

Commit b98a2da

Browse files
committed
MAGETWO-60962: New attribute is not visible when create new address
2 parents 73ef9ef + 1441be8 commit b98a2da

File tree

8 files changed

+65
-54
lines changed

8 files changed

+65
-54
lines changed

app/code/Magento/Checkout/view/frontend/web/template/billing-address/details.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
<!-- /ko --><br/>
1616
<!-- ko foreach: { data: currentBillingAddress().customAttributes, as: 'element' } -->
1717
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
18-
<!-- ko text: element[attribute].value --><!-- /ko -->
18+
<!-- ko if: (typeof element[attribute] === "object") -->
19+
<!-- ko text: element[attribute].value --><!-- /ko -->
20+
<!-- /ko -->
21+
<!-- ko if: (typeof element[attribute] === "string") -->
22+
<!-- ko text: element[attribute] --><!-- /ko -->
23+
<!-- /ko --><br/>
1924
<!-- /ko -->
2025
<!-- /ko -->
2126
<button type="button"

app/code/Magento/Checkout/view/frontend/web/template/shipping-address/address-renderer/default.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
<!-- /ko --><br/>
1616
<!-- ko foreach: { data: address().customAttributes, as: 'element' } -->
1717
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
18-
<!-- ko text: element[attribute].value --><!-- /ko -->
18+
<!-- ko if: (typeof element[attribute] === "object") -->
19+
<!-- ko text: element[attribute].value --><!-- /ko -->
20+
<!-- /ko -->
21+
<!-- ko if: (typeof element[attribute] === "string") -->
22+
<!-- ko text: element[attribute] --><!-- /ko -->
23+
<!-- /ko --><br/>
1924
<!-- /ko -->
2025
<!-- /ko -->
2126
<!-- ko if: (address().isEditable()) -->

app/code/Magento/Checkout/view/frontend/web/template/shipping-information/address-renderer/default.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,12 @@
1515
<!-- /ko --><br/>
1616
<!-- ko foreach: { data: address().customAttributes, as: 'element' } -->
1717
<!-- ko foreach: { data: Object.keys(element), as: 'attribute' } -->
18-
<!-- ko text: element[attribute].value --><!-- /ko -->
18+
<!-- ko if: (typeof element[attribute] === "object") -->
19+
<!-- ko text: element[attribute].value --><!-- /ko -->
20+
<!-- /ko -->
21+
<!-- ko if: (typeof element[attribute] === "string") -->
22+
<!-- ko text: element[attribute] --><!-- /ko -->
23+
<!-- /ko --><br/>
1924
<!-- /ko -->
2025
<!-- /ko -->
2126
<!-- /ko -->

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,20 @@ public function getErrorMessages()
6565

6666
return $result;
6767
}
68+
69+
/**
70+
* Fixture mapping.
71+
*
72+
* @param array|null $fields
73+
* @param string|null $parent
74+
* @return array
75+
*/
76+
protected function dataMapping(array $fields = null, $parent = null)
77+
{
78+
if (isset($fields['custom_attribute'])) {
79+
$this->placeholders = ['attribute_code' => $fields['custom_attribute']['code']];
80+
$this->applyPlaceholders();
81+
}
82+
return parent::dataMapping($fields, $parent);
83+
}
6884
}

dev/tests/functional/tests/app/Magento/Checkout/Test/Block/Onepage/Shipping/AddressModal.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,8 @@
2222
</country_id>
2323
<telephone />
2424
<postcode />
25+
<custom_attribute>
26+
<selector>[name="custom_attributes[%attribute_code%]"]</selector>
27+
</custom_attribute>
2528
</fields>
2629
</mapping>

dev/tests/functional/tests/app/Magento/Customer/Test/Block/Address/Edit.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,20 @@ public function saveAddress()
6161
{
6262
$this->_rootElement->find($this->saveAddress)->click();
6363
}
64+
65+
/**
66+
* Fixture mapping.
67+
*
68+
* @param array|null $fields
69+
* @param string|null $parent
70+
* @return array
71+
*/
72+
protected function dataMapping(array $fields = null, $parent = null)
73+
{
74+
if (isset($fields['custom_attribute'])) {
75+
$this->placeholders = ['attribute_code' => $fields['custom_attribute']['code']];
76+
$this->applyPlaceholders();
77+
}
78+
return parent::dataMapping($fields, $parent);
79+
}
6480
}

dev/tests/functional/tests/app/Magento/Customer/Test/Page/CustomerAddressEdit.php

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
/**
4+
* Copyright © 2016 Magento. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../vendor/magento/mtf/etc/pages.xsd">
9+
<page name="CustomerAddressEdit" mca="customer/address/edit" module="Magento_Customer">
10+
<block name="editForm" class="Magento\Customer\Test\Block\Address\Edit" locator="#form-validate" strategy="css selector" />
11+
</page>
12+
</config>

0 commit comments

Comments
 (0)