Custom messages based on results

  • arcaswebdesign
  • Topic Author
  • Offline
  • New Member
  • New Member
More
7 years 11 months ago - 7 years 11 months ago #2421 by arcaswebdesign
Custom messages based on results was created by arcaswebdesign
Hi, very happy with your component so far and I've managed to get it working in the way we were looking for.

There is one thing which I would like to be able to do and I was looking for a bit of guidance on how/if it is possible and that is to display custom messages above the actual results.

We're using the component to search through Joomla articles on different types of car seats for children based on their age/weight and it's returning results properly after I've tagged them. The client was also looking for a few custom messages to be displayed based on the search criteria to go alongside the results. So if the user has searched for age 1 year old and weight 18kg then certain results are returned (which already works) but also a custom message to be displayed above them?

I'm comfortable performing template overrides and PHP stuff so was hoping it would somehow be possible for me to just manually add in a few custom messages (4 of them) which will only be displayed if certain search criteria have been included? Is this in any way possible? Something like this:
Code:
if field_age is ((0 or 1 or 2 or 3) and field_weight is (15kg or 16kg or 17kg)) then { DISPLAY MESSAGE 1 } if field_weight is (10kg or 11kg or 12kg)) then { DISPLAY MESSAGE 2 }

Are there variables I can tap into to check these values? Or is there another way to do this?
Last edit: 7 years 11 months ago by arcaswebdesign.

Please Log in or Create an account to join the conversation.

More
7 years 11 months ago #2422 by andrea_4g
Replied by andrea_4g on topic Custom messages based on results
There are ways to do that. More than one.
Search parameters are passed to the view as "$this->search_pars".
You can read and process them with a template override.

The cleaner method is to write your own custom *customproperties* plugin that, in turn, will be triggered by the following line in file components/com_customproperties/views/search/view.html.php:
Code:
$pluginOutput = $dispatcher->trigger('onAfterQuery', array (&$items, &$search_pars, &$params, $pagination));

You can then place the output returned by such plugin on your page by means of custom properties parameters:
Results Formatting > Header Layout > Row[x] : Plugin Output

Please Log in or Create an account to join the conversation.

Time to create page: 0.122 seconds