Skip to content

Commit 0155243

Browse files
committed
Merge pull request #7329 in SW/shopware from ntr/5.5/country-sorting to 5.5
* commit '2957da598eaf289726aef91d24d29adff596a61d': NTR - Add more sorting for countries
2 parents d739238 + 2957da5 commit 0155243

File tree

14 files changed

+184
-14
lines changed

14 files changed

+184
-14
lines changed

engine/Shopware/Controllers/Backend/Order.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,19 @@ public function loadStoresAction()
276276
return $paymentStateItem;
277277
}, $paymentState);
278278

279+
$countriesSort = [
280+
[
281+
'property' => 'countries.active',
282+
'direction' => 'DESC',
283+
],
284+
[
285+
'property' => 'countries.name',
286+
'direction' => 'ASC',
287+
],
288+
];
289+
279290
$shops = $this->getShopRepository()->getBaseListQuery()->getArrayResult();
280-
$countries = $this->getCountryRepository()->getCountriesQuery()->getArrayResult();
291+
$countries = $this->getCountryRepository()->getCountriesQuery(null, $countriesSort)->getArrayResult();
281292
$payments = $this->getPaymentRepository()->getAllPaymentsQuery()->getArrayResult();
282293
$dispatches = $this->getDispatchRepository()->getDispatchesQuery()->getArrayResult();
283294
$documentTypes = $this->getRepository()->getDocumentTypesQuery()->getArrayResult();

engine/Shopware/Controllers/Backend/Payment.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function getPaymentsAction()
9191
public function getCountriesAction()
9292
{
9393
$result = $this->getCountryRepository()
94-
->getCountriesQuery()
94+
->getCountriesQuery(null, $this->Request()->getParam('sort', []))
9595
->getArrayResult();
9696
$this->View()->assign(['success' => true, 'data' => $result]);
9797
}

themes/Backend/ExtJs/backend/base/attribute/Shopware.attribute.Form.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ Ext.define('Shopware.attribute.Form', {
394394
Ext.create('Shopware.attribute.MediaFieldHandler'),
395395
Ext.create('Shopware.attribute.ProductFieldHandler'),
396396
Ext.create('Shopware.attribute.BlogFieldHandler'),
397+
Ext.create('Shopware.attribute.CountryFieldHandler'),
397398
Ext.create('Shopware.attribute.BooleanFieldHandler'),
398399
Ext.create('Shopware.attribute.DateFieldHandler'),
399400
Ext.create('Shopware.attribute.DateTimeFieldHandler'),
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* Shopware 5
3+
* Copyright (c) shopware AG
4+
*
5+
* According to our dual licensing model, this program can be used either
6+
* under the terms of the GNU Affero General Public License, version 3,
7+
* or under a proprietary license.
8+
*
9+
* The texts of the GNU Affero General Public License with an additional
10+
* permission and of our proprietary license can be found at and
11+
* in the LICENSE file you have received along with this program.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* "Shopware" is a registered trademark of shopware AG.
19+
* The licensing of the program under the AGPLv3 does not imply a
20+
* trademark license. Therefore any rights, title and interest in
21+
* our trademarks remain entirely with us.
22+
*
23+
* @category Shopware
24+
* @package Base
25+
* @subpackage Attribute
26+
* @version $Id$
27+
* @author shopware AG
28+
*/
29+
30+
//{namespace name="backend/attributes/fields"}
31+
32+
// {block name="backend/base/attribute/field/country_grid"}
33+
Ext.define('Shopware.form.field.CountryGrid', {
34+
extend: 'Shopware.form.field.Grid',
35+
alias: 'widget.shopware-form-field-country-grid',
36+
mixins: ['Shopware.model.Helper'],
37+
38+
createSearchField: function() {
39+
return Ext.create('Shopware.form.field.CountrySingleSelection', this.getComboConfig());
40+
}
41+
});
42+
// {/block}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* Shopware 5
3+
* Copyright (c) shopware AG
4+
*
5+
* According to our dual licensing model, this program can be used either
6+
* under the terms of the GNU Affero General Public License, version 3,
7+
* or under a proprietary license.
8+
*
9+
* The texts of the GNU Affero General Public License with an additional
10+
* permission and of our proprietary license can be found at and
11+
* in the LICENSE file you have received along with this program.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* "Shopware" is a registered trademark of shopware AG.
19+
* The licensing of the program under the AGPLv3 does not imply a
20+
* trademark license. Therefore any rights, title and interest in
21+
* our trademarks remain entirely with us.
22+
*
23+
* @category Shopware
24+
* @package Base
25+
* @subpackage Attribute
26+
* @version $Id$
27+
* @author shopware AG
28+
*/
29+
30+
//{namespace name="backend/attributes/fields"}
31+
32+
// {block name="backend/base/attribute/field/country"}
33+
Ext.define('Shopware.form.field.CountrySingleSelection', {
34+
extend: 'Shopware.form.field.SingleSelection',
35+
alias: 'widget.shopware-form-field-country-single-selection',
36+
37+
getComboConfig: function() {
38+
var me = this;
39+
var config = me.callParent(arguments);
40+
41+
config.store.remoteSort = true;
42+
config.store.sort([
43+
{
44+
property: 'active',
45+
direction: 'DESC'
46+
},
47+
{
48+
property: 'name',
49+
direction: 'ASC'
50+
}
51+
]);
52+
53+
return config;
54+
}
55+
});
56+
// {/block}

themes/Backend/ExtJs/backend/base/attribute/field/Shopware.form.field.SingleSelection.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ Ext.define('Shopware.form.field.SingleSelection', {
4747
var store = me.store;
4848
me.store = Ext.create('Ext.data.Store', {
4949
model: store.model,
50-
proxy: store.getProxy()
50+
proxy: store.getProxy(),
51+
remoteSort: store.remoteSort,
52+
sorters: store.getSorters(),
5153
});
5254
me.items = me.createItems();
5355

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Shopware 5
3+
* Copyright (c) shopware AG
4+
*
5+
* According to our dual licensing model, this program can be used either
6+
* under the terms of the GNU Affero General Public License, version 3,
7+
* or under a proprietary license.
8+
*
9+
* The texts of the GNU Affero General Public License with an additional
10+
* permission and of our proprietary license can be found at and
11+
* in the LICENSE file you have received along with this program.
12+
*
13+
* This program is distributed in the hope that it will be useful,
14+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
15+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
* GNU Affero General Public License for more details.
17+
*
18+
* "Shopware" is a registered trademark of shopware AG.
19+
* The licensing of the program under the AGPLv3 does not imply a
20+
* trademark license. Therefore any rights, title and interest in
21+
* our trademarks remain entirely with us.
22+
*
23+
* @category Shopware
24+
* @package Base
25+
* @subpackage Attribute
26+
* @version $Id$
27+
* @author shopware AG
28+
*/
29+
30+
// {block name="backend/base/attribute/field_handler/country"}
31+
Ext.define('Shopware.attribute.CountryFieldHandler', {
32+
extend: 'Shopware.attribute.AbstractEntityFieldHandler',
33+
entity: "Shopware\\Models\\Country\\Country",
34+
singleSelectionClass: 'Shopware.form.field.CountrySingleSelection',
35+
multiSelectionClass: 'Shopware.form.field.CountryGrid'
36+
});
37+
// {/block}

themes/Backend/ExtJs/backend/base/bootstrap.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,11 @@
253253
{include file='backend/base/attribute/field/Shopware.form.field.ProductGrid.js'}
254254
{include file='backend/base/attribute/field/Shopware.form.field.PropertyOptionGrid.js'}
255255
{include file='backend/base/attribute/field/Shopware.form.field.BlogGrid.js'}
256+
{include file='backend/base/attribute/field/Shopware.form.field.CountryGrid.js'}
256257
{include file='backend/base/attribute/field/Shopware.form.field.CategoryGrid.js'}
257258
{include file='backend/base/attribute/field/Shopware.form.field.ProductSingleSelection.js'}
258259
{include file='backend/base/attribute/field/Shopware.form.field.BlogSingleSelection.js'}
260+
{include file='backend/base/attribute/field/Shopware.form.field.CountrySingleSelection.js'}
259261
{include file='backend/base/attribute/field/Shopware.form.field.PropertyOptionSingleSelection.js'}
260262
{include file='backend/base/attribute/field/Shopware.form.field.CategorySingleSelection.js'}
261263
{include file='backend/base/attribute/field/Shopware.form.field.VoucherSingleSelection.js'}
@@ -292,6 +294,7 @@
292294
{include file='backend/base/attribute/field_handler/Shopware.attribute.AbstractEntityFieldHandler.js'}
293295
{include file='backend/base/attribute/field_handler/Shopware.attribute.CategoryFieldHandler.js'}
294296
{include file='backend/base/attribute/field_handler/Shopware.attribute.BlogFieldHandler.js'}
297+
{include file='backend/base/attribute/field_handler/Shopware.attribute.CountryFieldHandler.js'}
295298
{include file='backend/base/attribute/field_handler/Shopware.attribute.ProductFieldHandler.js'}
296299
{include file='backend/base/attribute/field_handler/Shopware.attribute.PropertyOptionFieldHandler.js'}
297300
{include file='backend/base/attribute/field_handler/Shopware.attribute.MediaFieldHandler.js'}

themes/Backend/ExtJs/backend/customer/view/address/detail/address.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ Ext.define('Shopware.apps.Customer.view.address.detail.Address', {
7676

7777
var factory = Ext.create('Shopware.attribute.SelectionFactory');
7878
var countryStore = factory.createEntitySearchStore("Shopware\\Models\\Country\\Country");
79+
countryStore.remoteSort = true;
7980

8081
countryStore.sort([{
8182
property: 'active',
@@ -185,7 +186,10 @@ Ext.define('Shopware.apps.Customer.view.address.detail.Address', {
185186
select: me.onCountrySelect,
186187
scope: me
187188
},
188-
store: countryStore
189+
store: countryStore,
190+
xtype: 'pagingcombobox',
191+
valueField:'id',
192+
displayField: 'name'
189193
},
190194
stateId: {
191195
fieldLabel: me.snippets.fields.state,

themes/Backend/ExtJs/backend/customer/view/customer_stream/conditions/has_address_with_country_condition.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ Ext.define('Shopware.apps.Customer.view.customer_stream.conditions.HasAddressWit
5353

5454
_create: function() {
5555
var factory = Ext.create('Shopware.attribute.SelectionFactory');
56+
var store = factory.createEntitySearchStore('Shopware\\Models\\Country\\Country');
57+
store.remoteSort = true;
58+
store.sort([
59+
{
60+
property: 'active',
61+
direction: 'DESC'
62+
},
63+
{
64+
property: 'name',
65+
direction: 'ASC'
66+
}
67+
]);
5668

5769
return {
5870
title: '{s name="has_address_with_country_condition_selection"}{/s}',
@@ -65,7 +77,7 @@ Ext.define('Shopware.apps.Customer.view.customer_stream.conditions.HasAddressWit
6577
useSeparator: false,
6678
allowBlank: false,
6779
store: factory.createEntitySearchStore('Shopware\\Models\\Country\\Country'),
68-
searchStore: factory.createEntitySearchStore('Shopware\\Models\\Country\\Country')
80+
searchStore: store,
6981
}]
7082
};
7183
}

0 commit comments

Comments
 (0)