More recursive madness |
[eluser]skunkbad[/eluser]
A couple of days ago I was working on a recursive function that builds the category menu for my ecommerce application. I finished that with code handed to me by Tominator, and then I went on to work on the way that the new URLs were being handled by the product controller / model, so that the appropriate category would show products or sub-categories, even if more than one category had the same name. So last night I finished up on yet another recursive function. This time I got it right, but I'm wondering if it couldn't be simplified. Since I'm not so good with recursive functions, perhaps you could offer advice. I'm just going to post a link to the file on Bitbucket: http://bitbucket.org/skunkbad/community-..._model.php I'm specifically looking at lines 80 through 157, which includes two methods: 1) get_category_steps() 2) get_category_parents() ALSO, The make_category_menu() method in the same file is not recursive. It only goes 7 levels deep, which I thought would be enough for most stores, but if somebody has a truly recursive way to do what I need done here, I would love to see the solution. Any help is greatly appreciated, and you can receive credit in the code for your help if you wish. |
Messages In This Thread |
More recursive madness - by El Forum - 04-20-2010, 06:11 PM
More recursive madness - by El Forum - 04-20-2010, 07:06 PM
More recursive madness - by El Forum - 04-20-2010, 07:09 PM
More recursive madness - by El Forum - 04-20-2010, 08:55 PM
More recursive madness - by El Forum - 04-21-2010, 03:06 AM
More recursive madness - by El Forum - 04-21-2010, 09:11 AM
More recursive madness - by El Forum - 04-21-2010, 02:05 PM
|