akeneo / pim-community-dev

[Community Development Repository] The open source Product Information Management (PIM)
http://www.akeneo.com
Other
954 stars 514 forks source link

Sort orders in field "Attribute group" #5307

Closed userz58 closed 7 years ago

userz58 commented 7 years ago

I'm reporting a Bug version 1.6.5

tiny bug: i created attribute groups http://demo.akeneo.com/#url=/configuration/attribute-group/ 1-Other (default) 2-Main 3-Technical 4-Documentation 5-Media 6-Marketing

I changed sort orders 1-Main 2-Technical 3-Marketing 4-Media 5-Documentation 6-Other

when i create new attributes, i see at field "Attribute group (required)" rows sorted by id (must by sort_order) http://demo.akeneo.com/#url=/configuration/attribute/create?attribute_type=pim_catalog_text

fabienlem commented 7 years ago

Hello @userz58,

I reproduced this behavior on our environments.

If you feel like contributing, you can submit a pull request on the master branch. We will be happy to help you by reviewing and merging your contribution.

All you need to know for contributing can be found here: https://docs.akeneo.com/latest/contributing/contribution_guide.html. Especially, don't forget to you read and sign our contributor agreement https://www.akeneo.com/contributor-license-agreement/.

To solve the issue, you can adjust the attribute form type: https://github.com/akeneo/pim-community-dev/blob/master/src/Pim/Bundle/EnrichBundle/Form/Type/AttributeType.php#L156 According to this Symfony's documentation: http://symfony.com/doc/2.7/reference/forms/types/entity.html#using-a-custom-query-for-the-entities

Don't hesitate to ping us if you need some help.

Best regards, Fabien

a2xchip commented 7 years ago

In progress

userz58 commented 7 years ago

why don't override the method findAll() in AttributeGroupRepository?

public function findAll() {
    return $this->findBy([], ['sortOrder' => 'ASC']);
}
a2xchip commented 7 years ago

@userz58 to keep it verbose and consistent, is there functional/performance purpose of your suggestion i do not know?

pierallard commented 7 years ago

Hi @userz58 ! @a2xchip did a PR for it, we just merge it on 1.7. It will be available for the next release !