Jump to content

Item Ingredients using Page References


Pip
 Share

Recommended Posts

Hi Everyone!

I'm currently working on a game site. In games you got items you can build with specific ingredients. I've made every page for each ingredient. I wanted to make a field in each item page to show the ingredients. Some product requires multiple ingredients and duplicates even.

Example: 

  • Pizza Dough (1 page) 
  • Sauce (1 Page)
  • Pineapple (1 page) 
  • Cheese (1 page) 
  • Ham (1 page) 
  • Hawaiian Pizza (1 page) 
    • Ingredients field Pizza Dough + Sauce + Pineapple + Cheese + Cheese + Ham  (Image avatar with link to respective pages)

How do I do this without doing some manual editing on the editor? 

Problem 1: I tried doing the field as a page reference but when it comes to duplicate pages it just doesn't work.

Problem 2: I did a repeater with a Page Reference (Single page, auto complete). Repeater works fine BUT the Page Reference is still Multiple Page Reference (weird I know). 

Problem 3: I did a repeater with a Page Reference (Single page, Select). Select is unsorted alphabetically and I have more than 100 ingredients!  

Any recommendations on the work around? 

Link to comment
Share on other sites

5 hours ago, Pip said:

Problem 1: I tried doing the field as a page reference but when it comes to duplicate pages it just doesn't work.

Hi Pip, for me, it is not clear what you mean here - basically, using a Page Reference field sounds like a good approach for such an assignment of (a number of) 'ingredient' pages to an 'item' page. I think we need some more details to analyze the problem...

Link to comment
Share on other sites

Hey @Pip,

you're on the right way - keep on going... I would do it this way:

  1. Create a template for the items
  2. Create a template for the ingredients
  3. Create a page for holding all ingredients
    • I normally use an empty template called "placeholder" for these pages 
  4. Create a "Page Reference Field" called ingredients and assign this field to the items template
    • Make sure to use "Choose multiple" in "Input" tab
      It's on your side to choose which one works best for you - just play around
      2120730508_2020-05-2523_45_33.jpg.134f1b4dff46201a8993368bd8a2174f.jpg
       
    • Choose the parent page "ingredients" as parent - see 3.)
    • You can check "Allow Creating new Pages" - this gives you the option to add new ingredients directly from the item page.

      83347169_2020-05-2523_48_07.jpg.2122d215a948755a3081e2ddc35681de.jpg
  5.  Now every thing should be set up to create a new "item" page.
  6. You should be able to select or create new ingredients directly from this page.

Your page tree should look like this in the end:

- Items
    - Pizza Dough
    - Hawaiian Pizza 

- Ingredients
	- Sauce 
	- Pineapple 
	- Cheese 
	- Ham

Even if this video is a little bit old, here's Ryan showing how it works:

 

  • Like 2
Link to comment
Share on other sites

Hi @HerTha @DV-JF

 

Thanks for the response. Though Page Reference seems ideal as what I mentioned: 
 

Problem 1: I tried doing the field as a page reference but when it comes to duplicate pages it just doesn't work.

What I intend for the proper output: 

Quote

 Pizza Dough + Sauce + Pineapple + Cheese + Cheese + Ham

In the actual Page Reference field, it would come out like this instead: 

Quote

 Pizza Dough + Sauce + Pineapple + Cheese +  Ham

The extra Cheese is omitted as this is a duplicate.

Hope this clears things.  

Link to comment
Share on other sites

28 minutes ago, Pip said:

extra Cheese

In the Items template you can use a Repeater field (Ingredients) with two or three fields: Ingredient (Page reference) + Quantity (Float) + Unit (Dropdown)  .. for ml, mg, oz, etc.

Link to comment
Share on other sites

22 hours ago, Pixrael said:

In the Items template you can use a Repeater field (Ingredients) with two or three fields: Ingredient (Page reference) + Quantity (Float) + Unit (Dropdown)  .. for ml, mg, oz, etc.

Thanks for the response @Pixrael but I don't need quantities or measurements. Just the type of ingredient. The game itself doesn't stack the ingredients. To stick with how the game is representing the ingredient, we're trying to mention it twice. 

Thanks. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...