Below is my paginate code and it's working fine.
{% paginate craft.entries.section('products').limit(9) as entriesOnPage %}
{% for entry in entriesOnPage %}
<div class="product-box">
<div class="product">
<p class="product-name">
<a href="{{ entry.category.first().url }}">{{ entry.category.first().title }}</a>
</p>
</div>
</div>
{% endfor %}
{% if paginate.nextUrl %}
<a href="{{ paginate.nextUrl }}">Next</a>
{% endif %}
{% endpaginate %}
Below is my code to display specific category data with pagination. and it's not working.
{% set requestCategory = craft.request.getLastSegment() %}
{% paginate craft.entries.section('products').find({
search: 'categories:' ~ requestCategory,
}).limit(9) as entriesOnPage %}
{% for entry in entriesOnPage %}
<div class="product-box">
<div class="product">
<p class="product-name">
<a href="{{ entry.category.first().url }}">{{ entry.category.first().title }}</a>
</p>
</div>
</div>
{% endfor %}
{% if paginate.nextUrl %}
<a href="{{ paginate.nextUrl }}">Next</a>
{% endif %}
{% endpaginate %}
i want to add category filter on that but not working how can i add a category filter?