I have a relatively simple structure for products that I am building an advanced search for. I access the products using craft.entries.section('products')
, but these products have fields with options for those fields within them.
So my question is, how do I access these? This is my attempt so far.
{% set parameters=
{
section: 'products',
limit: '1'
}
%}
{% set query = craft.request.getParam('entry') %}
{% if query %}
{% set entries = craft.entries(parameters).relatedTo(query).order('score') %}
{% else %}
{% set entries = craft.entries(parameters) %}
{% endif %}
I know this is incorrect, because I need to look at an object within an object within products and check a field belonging it. For instance, if the product was a phone, it would have something like "mobilityOptions" and under that would be "Cordless", "Desk", and "Wall".
My search form has got those mobility options through a for option in products loop of the section, followed by a for block in option.mobilityOptions.options
that then makes checkboxes for each option, but to use it with the ".relatedTo" functionality I don't think it would work.