So i'm trying to pass the variables from a dynamic route to a template and then to use those variables to filter trough entries. the catch is that the same template is used to display an "organic"(by organic i mean that it is set up from the CP) category as well.
This is the routes.php
'shop/(?P<segmentCategory>(new|used))/(?P<segmentEntryType>[a-z]+)' => 'shop/category',
And this is from the template:
{% if segmentCategory is defined %}
{% set category = craft.categories(segmentCategory) %}
{% set games = craft.entries({
type: segmentEntryType,
relatedTo: ['and',
{ sourceElement: craft.entries.section(segmentEntryType).status(null) },
{ targetElement: category }
]
}) %}
{% else %}
{% set entries = craft.entries.relatedTo(category) %}
{% endif %}
The error:
Object of class Craft\ElementCriteriaModel could not be converted to string
craft/templates/shop/category.html(47)
47 {% extends "_layout" %} ||||||||||||||(Highlighted)||||||||||||||||
48 {% block content %}