2011 Posts in 1436 Topics by 620 members
Page: 1 2
|Go to End|
27 April 2010 at 11:09pm Last edited: 27 April 2010 11:09pm
This became more complicated than i thought.
Filtering while searching is of course much better. Should have thought about that. Thank you guys.
But i cannot push a new Hiddenfield into the searchform since that value doesn't exist in the searchContext. Even if I do that the search ignores that field.
I guess it would be possible to push something similar into $context but that is to complex of a variable for me to understand when i print_r it.
Adding a new value to searchable_fields on the dataobject (so that it will be included in defaultSearchContext) works. I can then remove the field from the form and then add the key-value pair again right before doing the search:
$context = singleton('Apartment')->getDefaultSearchContext();
//Add fields so that only published are shown and only related.
$data['ApartmentStatus'] = "Publicerad";
$data['ApartmentListID'] = $this->ID;
$results = $context->getResults($data);
Page: 1 2
|Go to Top|