Skip to content

Commit

Permalink
feat(PT-12385): Country and state are now also displayed in the addre…
Browse files Browse the repository at this point in the history
…ss selection
  • Loading branch information
DennisGarding committed Jul 13, 2023
1 parent b6426cc commit 0e4b30d
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 13 deletions.
5 changes: 5 additions & 0 deletions Controllers/Backend/SwagBackendOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public function getCustomerAction(): void
$customerId = (int) $this->Request()->get('searchParam');
$result = $repository->get($customerId);

foreach ($result['address'] as &$address) {
$address['countryName'] = $address['country']['name'];
$address['stateName'] = $address['state']['name'];
}

$this->view->assign([
'data' => $result,
'total' => \count($result),
Expand Down
3 changes: 2 additions & 1 deletion Resources/views/backend/swag_backend_order/model/address.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Ext.define('Shopware.apps.SwagBackendOrder.model.Address', {
{ name: 'additionalAddressLine2', type: 'string' },
{ name: 'salutationSnippet', type: 'string' },
{ name: 'countryId', type: 'int', useNull: true },
{ name: 'countryName', type: 'string' },
{ name: 'stateName', type: 'string' },
{
name: 'displayField',
type: 'string',
Expand All @@ -38,7 +40,6 @@ Ext.define('Shopware.apps.SwagBackendOrder.model.Address', {
}
}
]

});
//{/block}

Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ Ext.define('Shopware.apps.SwagBackendOrder.view.main.CustomerInformation.Billing
me.snippets.salutation.miss + ' ',
'</tpl>',
'{firstname} {lastname},<br/>{zipcode} {city},<br/>{street}',
'<tpl if="state">',
',<br/>{state}',
'<tpl if="stateName">',
',<br/>{stateName}',
'</tpl>',
'<tpl if="country">',
',<br/>{country}',
'<tpl if="countryName">',
',<br/>{countryName}',
'</tpl>',
'</div>',
'</tpl>{/literal}'
Expand Down Expand Up @@ -187,10 +187,10 @@ Ext.define('Shopware.apps.SwagBackendOrder.view.main.CustomerInformation.Billing
'<span>{city}</span>',
'</p>',
'<p>',
'<span>{state}</span>',
'<span>{stateName}</span>',
'</p>',
'<p>',
'<span>{country}</span>',
'<span>{countryName}</span>',
'</p>',
'</div>',
'</div>',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ Ext.define('Shopware.apps.SwagBackendOrder.view.main.CustomerInformation.Shippin
me.snippets.salutation.miss + ' ',
'</tpl>',
'{firstname} {lastname},<br/>{zipcode} {city},<br/>{street}',
'<tpl if="state">',
',<br/>{state}',
'<tpl if="stateName">',
',<br/>{stateName}',
'</tpl>',
'<tpl if="country">',
',<br/>{country}',
'<tpl if="countryName">',
',<br/>{countryName}',
'</tpl>',
'</div>',
'</tpl>{/literal}'
Expand Down Expand Up @@ -215,10 +215,10 @@ Ext.define('Shopware.apps.SwagBackendOrder.view.main.CustomerInformation.Shippin
'<span>{city}</span>',
'</p>',
'<p>',
'<span>{state}</span>',
'<span>{stateName}</span>',
'</p>',
'<p>',
'<span>{country}</span>',
'<span>{countryName}</span>',
'</p>',
'</div>',
'</div>',
Expand Down
7 changes: 7 additions & 0 deletions Tests/Functional/Controller/SwagBackendOrderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,13 @@ public function testGetCustomerSingle(): void
static::assertSame($expectedUser['firstname'], $result['firstname']);
static::assertSame($expectedUser['lastname'], $result['lastname']);
static::assertSame($expectedUser['number'], $result['number']);

static::assertIsArray($result['address']);
static::assertCount(2, $result['address']);
foreach ($result['address'] as $address) {
static::assertArrayHasKey('countryName', $address);
static::assertArrayHasKey('stateName', $address);
}
}

public function testGetProducts(): void
Expand Down
2 changes: 2 additions & 0 deletions plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@

<changelog version="REPLACE_GLOBALLY_WITH_NEXT_VERSION(3.1.1)">
<changes lang="de">
PT-12385 - Land und Bundeland werden nun auch in der Addressauswahl angezeigt;
PT-12411 - Deaktivierte Zahlungs- und Versandarten werden nicht mehr in den entsprechenden Auswahl-Listen zur Verfügung gestellt;
</changes>
<changes lang="en">
PT-12385 - Country and state are now also displayed in the address selection;
PT-12411 - Deactivated payment and shipping methods aren't available anymore in the corresponding selections;
</changes>
</changelog>
Expand Down

0 comments on commit 0e4b30d

Please sign in to comment.