-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Attribute] Attribute types system modification #3608
[Attribute] Attribute types system modification #3608
Conversation
*/ | ||
public function getType() | ||
{ | ||
return DefaultAttributeTypes::CHECKBOX; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these constants should be on *AttributeType classes
Storage type constants should live on AttributeValueInterface, because this is where we have storages defined. Wdyt?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, here should be self::TYPE
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or even static::TYPE
so we can overwrite the contents of constant in child class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pjedrzejewski 👍 @pamil 👍
Also, when we are at it - we should remove Presentation and make the name translatable. Previously, name was serving as a unique code, now we have proper code property, so let's remove presentation and replace it with name. Make sure to keep it translatable. 👍 |
@Zales0123 And code should be unique, immutable after an attribute is created. |
This is great job thanks @Zales0123, It would be awesome if we could have something like this for Options too. It would be great if we could have a display type (alongside form and storage) which is the way we render the attribute/option in storefront e.g.:
|
@aramalipoor For options - we will think about it. Actually, at some point I was thinking that Attributes could be used instead of Options in general - just like Akeneo does it, but it is complex and probably not for 1.0. Regarding rendering - for attributes we plan to do it simple for now, where every attribute type will be able to have it's own template. Or even being able to select the template in backend from some list, defined ... somewhere, not sure where yet. :) Goal is to get this basic version merged (with validation and simple rendering) and then expand it even more - introduce scope (per channel), translatable values and unique attribute validation stuff. |
@pjedrzejewski Sure thing about presentation and code, I don't know why it's not implemented now, as it is quite obvious :) |
@pjedrzejewski That's awesome man! It's better to improve step by step ;) |
I send love to this PR ❤️ great job ! |
70669f9
to
61ee0f8
Compare
@tristanbes Thank you for such a great optimism 😄 I really hope this change will reach expectations :) |
Now it's autogenerated based on attributeType type
+ some fixes in specs + fix in store product show template
- added options to configure specific attribute - added date attribute type
Also make name translatable.
7234057
to
517136c
Compare
517136c
to
b8bfa7c
Compare
@pjedrzejewski @michalmarcinkowski @pamil @lchrusciel @stloyd @tuka217 @Arminek (plenty of people, isn't it?) Thank you all for the review :) I hope these changes that I've just pushed are final. I know there are some things to improve (some very good points from @pjedrzejewski) and I will be very happy to manage them on the base of this PR in the nearest future (at least I will try 😄) |
…cation [Attribute] Attribute types system modification
Boom! 💥 Thank you Mateusz! Great work. 👍 Anyone willing to add more configurations/validation or even whole new attribute types? Should be simple after this is merged. :) |
…modification [Attribute] Attribute types system modification
PR contains basic implementation of new attribute types system. It is partially inspired by Akeneo.
Each attribute type is now separate service, which is defined with type, storage type, form type etc.
AttributeValue
value is stored in database based on attribute typestorageType
.For now, there are few simple attribute types implemented:
Each of them has corresponding form type and it's name is set as
'sylius_attribute_type_'.$type
.Also creating attribute and adding attribute to product UI's have changed a little bit.
Attribute type is chosen as a first step of creation and it's not possible to change it later:
![attribute-type-picker](https://cloud.githubusercontent.com/assets/6212718/11337118/d00018b8-91ea-11e5-9054-a49fa0e7fdb3.png)
![attribute-create](https://cloud.githubusercontent.com/assets/6212718/11337124/d59135b4-91ea-11e5-98bc-76f2d67e9790.png)
While adding attribute to product, we first choose target attributes from modal. It is possible to pick more than one attribute at once. Added attribute forms are rendered with AJAX request.
![attribute-picker](https://cloud.githubusercontent.com/assets/6212718/11337338/8c95ae06-91ec-11e5-8901-e1df083996bb.png)
![adding-attribute](https://cloud.githubusercontent.com/assets/6212718/11337344/97f3c8f0-91ec-11e5-8ee5-a3e87792c18f.png)
It is really preliminary PR, so there is lots of work to do: