142 votesAhmed commented
We need this feature. Has to be prioritized. It limits your classified tremendously. Implementing this feature will open a lot of doors.
My site is another example where we need this:
Category list of car parts.
For each car part selected a user can then select car model, make and year for that part.
Right now I have to create custom fields of all my car models, makes and years but these fields do not cascade. So if a user selects a make, the other fields should update but they do not... The only way around this now is to create these three fields as categories for every part. Not practical at all
I have been monitoring this thread for a few months now, what is the reason for the delay on this ?
You can easily add code in the your item controller that will not add any stress to the server.
Here is a pseudo code snippet idea:
1) Add a new custom field type in dj_classified that has cascade enabled and allows you to add other custom fields to it.
custom field 1:
Show when value selected: *blank* will show the field regardless of value
linked to: "car part 1", "car part 2", "car part 3" ( can select 1 category or multiple categories or custom fields VERY IMPORTANT)
custom field 2:
special type: "cascade"
Show when value selected: "Honda"
Linked to: "car_make"
custom field 3:
special type: "cascade"
show when value selected: *blank*
linked to: "model_Honda", "model_BMW", "model_VW"...
2) Go to com_djclassifieds\controllers\item.php
3) Go to line 769 where you find the following code:
echo '<input class="inputbox" type="text" size="30" value="'.$value.'" name="se_'.$fl->id.'" />';
4) right after that you can add a code comparison. If $fl->id = id where special_type "cascade" exists Then load related custom field(s) add an onchange handler to grab related fields when custom field changes.
echo '<select class="inputbox" onchange="updateField(*CUSTOM FUNCTION AND VARIABLES*)" name="se_'.$fl->id.'" >';
5) update your mod_djclassifieds_search default view with the updateField function to grab related cascaded fields when a user selects a different value from the current field.
Note: How you handle the sql side is up to you, but since you do a onchange handler you won't be loading all the data in one go. Server load should be ok.Ahmed commented
Just got this component and this feature would definitely add a lot more versatility to it. Up voted, we need this !Ahmed supported this idea ·