We have a form on a page in a html/smarty block and we would like to get the products by certain features with ajax.
(我们在html / smarty块中的页面上有一个表单,我们希望使用ajax通过某些功能来获得产品。)
Can anyone help or give some hints on how we would go about doing that?
(任何人都可以帮助或暗示我们将如何做到这一点?)
Basically depending on what options you choose on the form, certain products will be selected by using features and then they would be narrowed down to a few products.(基本上,根据您在表单上选择的选项,将通过使用功能选择某些产品,然后将它们缩小为几种产品。)
That would be the idea, but we need to know firstly how to get the products by feature.(那就是主意,但我们首先需要知道如何按功能获得产品。)
The form would look something like this:
(该表格如下所示:)
<form class="cm-ajax" method="post" enctype="multipart/form-data" id="gform_5" action="index.php"> <input type="hidden" name="result_ids" value="my_id" /> <div class="gform_body"> <ul id="gform_fields_5" class="gform_fields top_label form_sublabel_below description_below"> <li id="field_5_1" class="gfield field_sublabel_below field_description_below gfield_visibility_visible"> <label class="gfield_label">Question 1?</label> <div class="ginput_container ginput_container_radio"> <ul class="gfield_radio" id="input_5_1"> <li class="gchoice_5_1_0"> <input class="cm-product-filters-radio" name="product_filters[31]" type="radio" value="14158" id="elm_radio_122_31_14158"/> <label for="choice_5_1_0" id="label_5_1_0"> <img src="q1-answer-1.png" /> <p>Answer 1</p> </label> </li> <li class="gchoice_5_1_1"> <input class="cm-product-filters-radio" name="product_filters[31]" type="radio" value="14157" id="elm_radio_122_31_14157"/> <label for="choice_5_1_1" id="label_5_1_1"> <img src="q1-answer-2.png" /> <p>Answer 2</p> </label> </li> <li class="gchoice_5_1_2"> <input class="cm-product-filters-radio" name="product_filters[31]" type="radio" value="14160" id="elm_radio_122_31_14160"/> <label for="choice_5_1_2" id="label_5_1_2"> <img src="q1-answer-3.png" /> <p>Answer 3</p> </label> </li> <li class="gchoice_5_1_3 cm-product-filters-radio-container ty-product-filters__group"> <input class="cm-product-filters-radio" name="product_filters[31]" type="radio" value="14159" id="elm_radio_122_31_14159" /> <label for="elm_radio_122_31_14159" id="label_5_1_3"> <img src="q1-answer-4.png" /> <p>Answer 4</p> </label> </li> </ul> </div> </li> <li id="field_5_2" class="gfield field_sublabel_below field_description_below"> <label class="gfield_label">Question 2?</label> <div class="ginput_container ginput_container_radio"> <ul class="gfield_radio" id="input_5_2"> <li class="gchoice_5_2_0"> <input class="cm-product-filters-radio" name="product_filters[32]" type="radio" value="14163" id="elm_radio_122_32_14163" /> <label for="choice_5_2_0" id="label_5_2_0"> <img src="q-2-answer-1.png" /> <p>Answer 1</p> </label> </li> <li class="gchoice_5_2_1"> <input class="cm-product-filters-radio" name="product_filters[32]" type="radio" value="14164" id="elm_radio_122_32_14164" /> <label for="choice_5_2_1" id="label_5_2_1"> <img src="q-2-answer-2.png" /> <p>Answer 2</p> </label> </li> </ul> </div> </li> etc ... <li id="field_5_6" class="gfield gform_validation_container field_sublabel_below field_description_below"> <div class="ginput_container"> <input id="button_products" class="ty-btn ty-btn__primary cm-submit" type="submit" name="dispatch[products.search]" value="Submit" /> </div> </li> </ul> </div> </form> <div class="my_id" id="my_id"> <!--my_id--></div>
ask by Galiu translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…