Skip to content

Filtering products by custom model field via swell-js #9

Answered by logeshswell
logeshswell asked this question in Help
Discussion options

You must be logged in to vote
  1. Create a custom content model Restaurant with at least 2 fields slug ("dominos") and name ("Domino's Pizza") along with auto-generated fields id, date_created and date_updated.
  • Model data could be accessible from the Swell frontend APIs (or swell-js) if it is created with the content namespace.
  1. In Product model containing the actual information of food dishes, create a custom lookup field (restaurant_id) that is mapped to the restaurant model.
  • restaurant_id refers to the restaurant to which the food dish belongs.
  1. You can use the following method to fetch the list of records:
import swell from 'swell-js'
swell.init('store_id', 'public_key')

queryParams = {
  restaurant_id: 'domi…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Answer selected by logeshswell
Comment options

You must be logged in to vote
1 reply
@dirums
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment