Saleor: Support more input types for attribute values

Created on 5 Dec 2019  路  10Comments  路  Source: mirumee/saleor

In the Attribute model we have the input_type field which determines how a value can be entered in the dashbaord and how it's rendered in the storefront. Now we have two types:

  • dropdown - to select one value from a list of predefined choices
  • multiselect - as above, but to select multiple values

We need to introduce more input types:

  • text field - for storing simple text values (think CharField in Django)
  • text area
  • datetime
  • boolean - for yes/no attributes
attributes backlog

Most helpful comment

In addition to the above input types, I'd like to motivate the need for numeric types as well.

We have products with attributes such as volume, dimensions, or age which we would like to allow users to filter by using a range search.

All 10 comments

For a customized product I would need a collection of attributes in a form I can validate and send back to the server to get an updated preview image based on the user data entered into the attribute fields.

Data types would be open text fields, file uploads for spreadsheets, photos, logos and other content to build data driven products.

In addition to the above input types, I'd like to motivate the need for numeric types as well.

We have products with attributes such as volume, dimensions, or age which we would like to allow users to filter by using a range search.

@dankolbman Numeric input types are definitely on our roadmap as well.

Yes I am looking for this. Consider I want to have book store. If we have text type and numerical type product attribute option, we can create ISBN13, ISBN10 and Pages as number product attributes. That would be appropriate if added in saleor as soon as possible.

Are there any ideas on how to approach the implementation that would build off the current attribute system?
Particularly integers/floats that would be searchable by ranges (preferably on the DB level).

This is one issue I consistently run into as well. Color and even Image input types especially. For color, we sometimes use hacks such as hex codes, but ideally, it should be a color picker. I've only had one instance where image input type was needed though. That was for textile/fabric patterns.

same

For anyone interested in progress on this topic - we're currently working on many improvements to the attributes system. First, we're adding page types (PR is already open) that will work similarly to product types, but for pages. Then we'll introduce more input types:

  • file uploads
  • references - attributes of this type will be able to reference other items in the system by ID; this will allow you to e.g. create an attribute "related products" and assign a set of products IDs that should be rendered on a product page (or a content page)
  • rich-text - attributes of this type will be rendered in the dashboard as rich-text editor and will store content as JSON; this will unlock CMS-like capabilities for pages (creating new page sections as separate attributes)

And more to come in the future :)

hey @maarcingebala how's that input charfield coming up in the models. If you guys have already patched some changes can you please teach me how to use it in the current version. I'm using 2.10 stable release.

@maarcingebala thank you for the hard work 馃槉
Will you be addressing storing numbers and searching by numbers (inc. ranges)?

Use case:
We have an attribute "Size (meters)" that can range from 0 to 5000.
Instead of having 5000 standalone values in the system (really hurts performance of attribute queries), it would be nice to be able to store it just as one value in the DB, and filter by >, <, =. I was trying to come up with a flexible solution that would use numbers in the DB, but could not tie it into the current implementation (allow users to select Numbers alongside Dropdown & Multiselect).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jujes picture jujes  路  4Comments

Pacu2 picture Pacu2  路  4Comments

flaviocolonna picture flaviocolonna  路  3Comments

Pacu2 picture Pacu2  路  3Comments

timuric picture timuric  路  3Comments