[SOLVED] How to use WHERE query in advanced tab of CCD

trb

Member
Hi,

I have a retail shop with about 100 products. I have the products displayed on a form using a cascading dropdown element. I want to limit the product options in the dropdown based on the user selection of 2 other radio button elements on the form (or I am open to using other types of elements if radio buttons are not the right choice here). I have the cascading dropdown set to watch one of these radio elements and upon selecting the radio button, it properly limits the options in the CCD. Now I need to further limit these options when the user selects the second radio button element.

I have tried to add a where clause expression to the cascading dropdown Advanced tab Where section but I do not think I am using the correct syntax to get the value of second radio button selection

So I have:
CCD element displaying products from a product table
1st Radio button element which is watched by the CCD and successfully filters the options in the CCD
2nd radio button which I need to further filter the options in the CCD dropdown.

Can I use the Where clause feature of the cascading dropdown element to put an expression there, based on the users selection of the 2nd radio button, which will further filter the options in the cascading dropdown?

If so, can you please suggest the correct syntax for this Where clause .
If not, how can I go about this?

Much thanks!
 
Can I use the Where clause feature of the cascading dropdown element to put an expression there, based on the users selection of the 2nd radio button, which will further filter the options in the cascading dropdown?

If so, can you please suggest the correct syntax for this Where clause .
Yes, you can. Like so often, see the tooltip on how to use it - especially to not use "where" in your clause there.

I do not think I am using the correct syntax to get the value of second radio button selection
We can't know. In case of doubt, copy your expression and paste it here.

Two more tips:
The expression should have the same syntax as the one behind the "where" in any other MySQL clause.
If you really had a syntax error, with Joomla's global error messaging set to maximum you should get an error message telling you where.
 
Last edited:
I would use a databasejoin with "Ajax update"=yes instead of the CDD element.

Then you can add multiple elements in the WHERE part and the condition is updated on change of each of these elements.
I don't think CDD does an Ajax update of its WHERE condition at all (but didn't try).
 
@lousyfool and @troester - thank you both so much for your replies. They have helped me.

I was able to get this to work by changing the product dropdown from a CCD to a dbjoin as Troester suggested. I then placed the below Where clause in the data - where section of the dbjoin element and set ajax update to YES. I'm using the metakey and metadesc fields of the virtuemart product table to match values to the season and payment radio button selections on the form. Now when the user makes selections from the season and payment radio buttons, the product options are dynamically updated in the dbjoin drop down on the form ... works great!

Where {thistable}.metakey = '{jos_multiple_registrations_17_repeat___season_raw}' AND {thistable}.metadesc = '{jos_multiple_registrations_17_repeat___payment_raw}'

Also, I tried using the same clause (minus the Where) with a CCD element but it does not work. It seems the where clause is ignored when using a CCD and only the watched element has any effect on the dropdown options.

Thanks again for your help!
 
We are in need of some funding.
More details.

Thank you.

Members online

Back
Top