Skip to content
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

Add "from" and "to" to price ranges in filters #39

Closed
pkarw opened this issue Oct 6, 2017 · 5 comments
Closed

Add "from" and "to" to price ranges in filters #39

pkarw opened this issue Oct 6, 2017 · 5 comments
Labels
good first issue Tasks that requires just basic understanding of Vue Storefront

Comments

@pkarw
Copy link
Collaborator

pkarw commented Oct 6, 2017

Assigned to: @patrykpiston
Take a look at: /src/pages/Category.vue:118:

          if (attrToFilter !== 'price') {
            for (let option of res.aggregations['agg_terms_' + attrToFilter].buckets) {
              self.filters[attrToFilter].push({
                id: option.key,
                label: self._attributeOptionName(attrToFilter, option.key)
              })
            }
          } else { // special case is range filter for prices
            for (let option of res.aggregations['agg_range_' + attrToFilter].buckets) {
              self.filters[attrToFilter].push(option.key)
            }
          }
        }

The second part. To change the logic here we need to change the data model as well (the same file lines from 170):

      filters: { // filters should be set by category, and should be synchronized with magento
        color: [{'id': 165, 'label': 'red'}, {'id': 166, 'label': 'blue'}],
        size: [
            {'id': 50, 'label': 'XS'},
            {'id': 51, 'label': 'S'},
            {'id': 52, 'label': 'M'},
            {'id': 53, 'label': 'L'},
            {'id': 54, 'label': 'XL'}
        ],
        price: ['0.00 - 50.00', '50.01 - 100.00', '100.01 - 150.00', '150.01 and more']
      }
    }

we need to have something like:

        price: [ { from: 0, to: 50, label: '0 - 50PLN'} ... ] 

Does it make sense?

@pkarw pkarw added the good first issue Tasks that requires just basic understanding of Vue Storefront label Oct 6, 2017
@pkarw pkarw assigned pkarw and unassigned pkarw Oct 6, 2017
@sudo-at-night
Copy link
Contributor

If the price filter buttons have from-to values passed by the object, alongside the label like it's done now, it will be easy to dispatch the filtering action. I can take this task this week.

@karolbzik karolbzik added this to the MVP milestone Oct 13, 2017
@pkarw
Copy link
Collaborator Author

pkarw commented Oct 24, 2017

Done!

@pkarw pkarw closed this as completed Oct 24, 2017
filrak pushed a commit that referenced this issue Apr 20, 2020
@snsakib
Copy link

snsakib commented Sep 3, 2020

Is there any documentation on how to implement this feature?

@ThermScissorpunch
Copy link
Contributor

I would also like to implement this!

@sudo-at-night sudo-at-night removed their assignment Nov 20, 2020
@sudo-at-night
Copy link
Contributor

I unassigned myself since I no longer maintain the VSF project for quite some time now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Tasks that requires just basic understanding of Vue Storefront
Projects
None yet
Development

No branches or pull requests

5 participants