Low search of a Cartthrob options field
Is it possible to use Low search to filter based on a CartThrob Order Items field?
{exp:low_search:results
channel="orders"
order_items="11820"}
{order_customer_full_name}
{order_customer_email}
{order_customer_phone}
{entry_date format="%d %M %Y"}
{order_items}
{item:entry_id}
{item:title}
{/order_items}
{/exp:low_search:results}
This is returning all orders not just ones where the product purchased has an entry id 11820. Is there any way to get this working or am barking up the wrong tree?
Replies
Low 23 May 2016 16:50
I'm not sure how CartThrob/EE stores its data in the Order Items field, so it's hard to comment. You should check out the database and see what EE stores in the exp_channel_data table for that field.
That said, field_name="11820" is never gonna work, as that is not a valid syntax for any of the available filters. You might be able to get it working with the Field Search filter, which means you'd need a syntax like search:order_items="11820", which will look for the 11820 substring inside the field (again, if this works, depends on how it is stored).
Otherwise, you might need a custom filter.
Tim Print 23 May 2016 19:58
Thanks for the quick reply.
search:order_items="11820" doesn't come up with any results. The 'exp_channel_data' for the order items field is 'none'. It looks like the data is stored in a separate 'exp_cartthrob_order_items' table.
I'll take a look at custom filters and see if I can get something working.