From ca9a9be386bd21415245937fbb110d706e1a5d05 Mon Sep 17 00:00:00 2001 From: Hugo Date: Sat, 1 Dec 2012 16:09:52 +0100 Subject: Bug 812054: JavaScript error on the Advanced Search page when a classification has a product invisible to the user r/a=LpSolit --- template/en/default/search/field.html.tmpl | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'template/en/default') diff --git a/template/en/default/search/field.html.tmpl b/template/en/default/search/field.html.tmpl index 34a480f31..ab7380857 100644 --- a/template/en/default/search/field.html.tmpl +++ b/template/en/default/search/field.html.tmpl @@ -158,10 +158,21 @@ }); [% SET sub_field = value_controllers.${field.name}.$accessor %] + [% SET prod_per_class = {} %] + [% IF field.name == "classification" %] + [% FOREACH p = product %] + [% prod_per_class.${p.classification_id}.${p.id} = 1 %] + [% END %] + [% END %] + [% FOREACH legal_value = legal_values %] [% SET controlled_ids = [] %] - [% FOREACH sub_value = legal_value.$accessor %] - [% controlled_ids.push(sub_value.id) %] + [% IF field.name == "classification" %] + [% controlled_ids = prod_per_class.${legal_value.id}.keys %] + [% ELSE %] + [% FOREACH sub_value = legal_value.$accessor %] + [% controlled_ids.push(sub_value.id) %] + [% END %] [% END %] [% NEXT IF !controlled_ids.size %] showValueWhen('[% sub_field.name FILTER js %]', -- cgit v1.2.3-24-g4f1b