Friday, March 29, 2013

Product / Category Tree Help

I am building a shopping plugin and at the point where I am stuck with routing the correct/ custom path and breadcrumbs.

 

The Category model actsAs Tree so that houses all the categories / sub categories and the product belongs to the specific category so all that is fine.

 

The end goal is to be something like site/products/mens/shoes/{product_slug}
but how to properly build the route with unknown levels of the path since the end admin can make it to an unknown level deep like site/products/womens/jackets/leather/spring/{product_slug}

 

And same for the breadcrumb trail to easily navigate back any number of steps if needed.

What is the correct way to do this?

And is the best to paginate from which controller (products or categories?)

Pull products based on the category in ProductsController or get products based on the Category.id in CategoriesController $this->Category->Product->getProducts($category_id)?

 

Thanks for any insight / best approach.

 

Dave

No comments: