First some context. I'm using Smart Map for Craft to display some location based events in a listing. My structure is as follows:
- Events channel
- Locations channel
Each event can occur multiple times, so I created a matrix field for this, where they can add blocks with a time and select a location.
The problem occurs when I want to filter the list of results based on the city of the location. Smartmaps doesn't support filtering by cities and I do want to use pagination, so I went with the custom plugin solution mentioned in that question. Unfortunately I can't comment yet on that answer, so therefore I created my new question.
The problem is that Craft {% paginate %}
doesn't work with the Array
result of EntryModel::populateModels
. I'm getting the following error in my search results page:
Argument 1 passed to Craft\TemplateHelper::paginateCriteria() must be an instance of Craft\ElementCriteriaModel, array given
So my question is, how can I modify the ElementCriteriaModel
to join content from different tables (in this case Smartmaps') and still return an ElementCriteriaModel
to be used by the Craft pagination?
I also have read some more explanation about ElementCriteriaModel
and some similar issues like this one and this one, but without any luck. Maybe there is a much simpler solution, but I'm out of options for now.