I have searched high and low and tried multiple different solutions to this and I cannot seem to get it to work.
Basically I have products and categories.
Categories has and belongs to many products, and products HABTM categories. They are obviously related in a join table products_categories with id,product_id,category_id fields.
After a simple full bake- models views and controllers are baked – some categories and products are added and their relationships are set I can go to a specific category view page and the pre baked view will show products that are related to this category.
However, there is quite a few products (and will be more) and I am struggling to work out how to paginate all of this related data..as it is unfeasible to just simply list all of the products in a category (there could be 100s or more)
Can anybody help? It seems there are quite a few unanswered topics on this and various different solutions, none of which I can get to work! Please help!
CakePHP controllers have built in pagination. The documentation is thorough, so I would recommend reading that first. Afterwards, I’d be happy to answer any questions you have on the subject.
Without knowing the specific code involved, here is a simple example of how to paginate your model data: