Pip Posted May 25, 2020 Share Posted May 25, 2020 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 More sharing options...
HerTha Posted May 25, 2020 Share Posted May 25, 2020 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 More sharing options...
DV-JF Posted May 25, 2020 Share Posted May 25, 2020 Hey @Pip, you're on the right way - keep on going... I would do it this way: Create a template for the items Create a template for the ingredients Create a page for holding all ingredients I normally use an empty template called "placeholder" for these pages 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 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. Now every thing should be set up to create a new "item" page. 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: 2 Link to comment Share on other sites More sharing options...
Pip Posted May 26, 2020 Author Share Posted May 26, 2020 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 More sharing options...
Pixrael Posted May 26, 2020 Share Posted May 26, 2020 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 More sharing options...
Pixrael Posted May 26, 2020 Share Posted May 26, 2020 If you have access to ProFields, it should be easier to use the Table field: https://processwire.com/store/pro-fields/table/ Link to comment Share on other sites More sharing options...
Pip Posted May 27, 2020 Author Share Posted May 27, 2020 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now