Problems, need help? Have a tip or advice? Post it here.
6 posts Page 1 of 1
I have a quick question relating to this from the documentation on pages:
Code: Select all
<cms:pages masterpage='blog.php' custom_field='my_blog_author=jeffrey | my_blog_text=fellow countrymen'></cms:pages>

This example would fetch all pages that contain 'jeffery' within 'my_blog_author' AND contain 'fellow countrymen' within 'my_blog_text'
(The pipe stands for a boolean AND)

I'm really hoping that there is an equivalent for OR, as in
Code: Select all
<cms:pages masterpage='blog.php' custom_field='my_blog_author=jeffrey OR my_blog_text=fellow countrymen'></cms:pages>

So that all pages would be fetched which had an author of jeffrey OR contained the text "fellow countrymen".
If there is such an OR method that would be great (and save me a lot of hassle). If not I'll maybe be back with further questions.
Hi Ewan,

No 'OR' supported by the 'custom_field' parameter, I am afraid :(
Oh well. Thanks KK. It was worth a try.

Basically what I'm doing is:
I have a filterable search. Each supplier has a service and a location.
It now needs redone so that each supplier can have multiple locations (and probably multiple services too, hasn't been mentioned yet!)
I couldn't quite get my head around the relations documentation, so I was trying to make it work myself. (building a string with multiple supplier_area fields, then using the elusive OR operator).

Something that might help me, on this page http://www.couchcms.com/docs/concepts/r ... ships.html it talks about modifying the artists.php template. Does this mean there is a working example of many to many relationships that I could download and mess around with?
I can't seem to find it in the docs.

It's a job for a friend's girlfriend (unpaid), so I'm really not wanting to spend a lot of time and effort on it at this stage!
Can you please tell us a little more as to how the search will work with the multiple locations?
I don't really have a firm grasp on it yet to be honest.

There are 12 possible areas. Each supplier can supply any number of the areas.
All the suppliers are listed on the page, then they are filtered using a dropdown.
(based on the files downloaded from this thread viewtopic.php?f=8&t=7620)

Code: Select all
<cms:editable
  name='supplier_area'
  label='Supplier Area'
  opt_values=' Please choose=- | Ayrshire | Aberdeen | Central | Dumfries | Dundee | Edinburgh | Fife | Glasgow and Argyll | Highlands and Islands | Lanarkshire | Perth | The Borders'
  opt_selected = 'Ayrshire'
  type='dropdown'
/>


So For Example: The Flower Shop can supply to both Edinburgh and Fife.

The dropdown is like so:
Code: Select all
<cms:input type="dropdown" 
       name="area"
       opt_values="Any=- | Ayrshire | Aberdeen | Central | Dumfries | Dundee | Edinburgh | Fife | Glasgow and Argyll | Highlands and Islands | Lanarkshire | Perth | The Borders"
   /></div>

If I select Edinburgh from the dropdown on the site, The Flower Shop should be displayed.
If I select Fife from the dropdown, The Flower Shop is displayed.
If I select Lanarkshire, it is not.

I probably need to restructure the whole thing I think. Obviously the supplier editable will need to have a method of inputting multiple areas (repeatable areas I suppose).
Maybe just inputting each area in a comma separated string? Not sure how I would process that in the search though.

Don't worry about it if there isn't an easy way to do this. I may just have to tell her it's too much work for just now.
Actually, I think I've come up with a solution for now.

If the list of areas is entered in a comma separated string (using only the pre-determined areas) instead of the dropdown, and if I use the single = instead of == it will filter the results properly I think.
I'll give it a proper try tomorrow and post if I'm successful.

Thanks KK.
6 posts Page 1 of 1
cron