Forum for discussing general topics related to Couch.
2 posts Page 1 of 1
Hi,

I'm currently building a product admin for a client in the business of textiles. Currently the way I have the admin set up is I have a cloneable product template to house the various patterns they offer. But within a pattern, they'll have various colors as well (Blue, Brown, Black, etc).

The issue I'm running into is I've set up a repeatable region for available colors, but I'm having trouble targeting the editable region within the repeatable region for the filter. I've been able to successfully set up filters based on fields that are not in a repeatable region, but am running into a wall trying to create a filter for the various colors in the repeatable.

Here's the repeatable region set up:

Code: Select all
        <cms:repeatable name="color_ways" label="Color Ways" order='2' stacked_layout='1'>
       
            <cms:editable
                name="color_img"
                label="Color Image"
                type="image"
                order="0"
            />
           
            <cms:editable
                name="color_name"
                label="Color Name"
                type="text"
                order="1"
            />
           
            <cms:editable
                name="color_category"
                label="Color Category"
                type="text"
                order="2"
            />
   
        </cms:repeatable>


And here's the filter set up:

Code: Select all
<div id="quick-search">
   <cms:form name="quicksearch" id="quicksearch" anchor='0'>
      <cms:if k_success >
           
         <cms:if frm_color_ways!='-' >
            <cms:set my_search_str="<cms:concat my_search_str ' | color_ways==' frm_color_ways />"  scope='global'/>
         </cms:if>
         
           
      </cms:if>
      <div class="row">

        <div class="col-md-4">
         <label>Color</label>
         <cms:input type="checkbox"
                    opt_values="All=- | Gray | Orange | Brown | Blue | Purple | Black"
               opt_selected="-"
               name="color_ways" id="color_ways" />
          </div>
           
        </div>
      
   <cms:input type="submit" class="btn" value="SEARCH" name="submit"/>
      
   </cms:form>

</div>


Let me know if any solutions come to mind, as your help would be greatly appreciated.

Thanks.
Hi,

The searchable content of a repeatable-region consists of data culled from *all* its rows and *all* fields from each row;
So, it can be possible to create a filter based on data from a RR but trying to target an *exact* match will likely fail (because, as explained above, the data is pretty diffused).

In your code, you are using a '==' with 'color_ways' which (as mentioned in the docs https://docs.couchcms.com/tags-referenc ... stom_field) will try to exactly match the search string.

You should try using a single '=' instead which will then try to find a match anywhere within the field and will have a better chance of succeeding.

That said, using free-form data (namely type 'text') for storing colors will always be difficult to set as a target for search; if possible, please try using fixed values (e.g. as you have used for the checkboxes in the search form).

Hope this helps.
2 posts Page 1 of 1
cron