[eluser]0v3rth3d4wn[/eluser]
Hello!
The site I'm currently making has products which are divided in categories, subcategories and subsub categories. I can have products in all of them. I'm giving an example for each possible page I have:
shoes
shoes/my-product
shoes/leather-shoes
shoes/leather-shoes/myproduct
shoes/leather-shoes/real-leather-shoes
shoes/leather-shoes/real-leather-shoes/myproduct
I have trouble routing these because sometimes my second and third parameter could be either a subcategory, subsubcategory or a product. I don't want to use controller name or function name.
I could do something like this:
Code:
$route['(:any)/(:any)'] = 'category/index/$1/$2';
to show my subcategories but then this collides with category/product also which I'd like to redirect to
Code:
$route['(:any)/(:any)'] = 'product/index/$2';
The only thing that comes to my mind is to use it like that
Code:
$route['category/(:any)'] = 'category/index/$1';
for my category and
Code:
$route['product/(:any)'] = 'product/index/$1';
for any product, but here I would lose my friendly url and instead of category/product, I'll have product/some-id-or-permalink. I want the full path. Any ideas how to do that? Or I'm open to something different ofcourse.
Thanks in advance.