0

I recently created a custom component for Joomla! 3.x designed to handle quotes. It's quite simple: I insert various quotes in the database and I want to show them in frontend lists.

I also created a table called "players", because every quote can be associated to one or more players. I did that because I want users to be able to filter the quotes by players, so I put search filters in the frontend lists.

Now, the backend and the frontend lists works well: I'm perfectly able to create a quote and associate it to one on more players, and the quotes are shown correctly in the frontend lists.

The problem is in the search tools. I had a Player filter (it's a SQL field) which let me filter quotes by a player, and it works. But I wanted to let user search by one or more players, so I added "multiple='multiple'" to the xml file. It actually becomes multiple, letting me select more elements, but the search system stops working.

What can I do? I'm sorry for the lack of details, but I'm quite new to Joomla! development and I created the component with an automatic component creator, adjusting it by my needs.

Thank you all.

0

If you have added multiple='multiple' then the form is getting an array of values (instead of a scalar value).

These array of values has to be translated in the SQL query to a statement like this one:

SELECT ... FROM #__Players WHERE xxx IN (a,b,c,d)

Check how the form is being applied in the query. For instance, SELECT statement can be created in this way:

        $query = $db->getQuery(true)
            ->select('*')
            ->from('#__Players')
            ->where('xxx IN (' . implode(',', $pks) . ')');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.