Can't get ingredient count above 10
icorners - July 20, 2008 - 17:20
| Project: | Recipe |
| Version: | 6.x-1.0-beta1 |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
Ten ingredients isn't really enough for my purposes, so I'm trying to up the ingredient field to 20. The strange thing is that I previously did this by going into the code and changing one of the "num_ingredients" values to 20, which worked fine.
Then all of a sudden there's only 10 again. I went in and changed every "num_ingredient" reference to 20. Nowhere in the code does it say 10 ingredients, and yet it still only shows 10, no matter how many times I refresh. Any idea what could be causing this?
Thanks!

#1
You can save and edit a recipe, and an additional 10 ingredient fields should appear. No code changes are necessary for that. (There's an existing issue open for adding a 'more ingredients' thing to let these appear during the initial edit.)
#2
The module evidently reads the number of ingredients and automatically adds 10 to that number. If it's a new recipe then it will add 10, giving 10 lines. With the modification, it adds 20 to the initial number of ingredients.
You can change this line from:
for ($i = $num_ingredients; $i < $num_ingredients+10; $i++)
to
for ($i = $num_ingredients; $i < $num_ingredients+20; $i++)
it works for me,
enjoy
#3
Could the form also be themed to let people know 10 more ingredients will be added when the form is saved? We had a bit of a time last night trying to figure out how to add more items.
#4
This should relay start with like 5 fields for ingredients, and have an ajax type button that says [Add More] at the bottom of the list and it would add another line. This would keep the page length down but also keep you on the same page when your putting in a recipe.
#5
It should also be possible to re-order the ingredients without having to manually erase and re-enter them.
#6
Subscribe.... the Ajax thing would be great!
#7
I'd love to see AJAX added to this as well. I agree that 5 is a good starting number.