Hi
I'm trying to add a customised search option to search for products relating a machine. Each machine has multiple products and each product relates to more than one machine. I have loaded a list of relevant machine codes separated by a comma in an Extra Field called 'machineCodes' and the product type in an extra field called productType.
The user selects a machine from a list and also needs to select a product type. I have set up a form where the user selects their machine and and product type.
HTML Code:
<form id="partfinder" method="post" action="search.php" name="searchform">
<input name="posted_data[substring]" value="" />
<input type="radio" id="ALL" value="all" name="productType" checked="checked" /> All
<input type="radio" id="OEM" value="OEM" name="productType" /> Original
<input type="radio" id="COMPAT" value="COMPAT" name="productType" /> Compatibles
<input type=hidden name="posted_data[extra_fields][1]" value="checked" />
<input type=hidden name="sort_field" value="price" />
<input type=hidden name="sort_direction" value="ASC" />
<button title="Search" type="submit" class="button main-button">
<span class="button-right"><span class="button-left">Search</span></span></button>
</form>
At the moment the form is submitted to search.php. It works in that it returns the products based on the machine code entered. I am trying to get x-cart to search both of the Extra Fields I've created as an
AND search.
I thought this might be possible by calling the form fields
posted_data[extra_fields][1] and
posted_data[extra_fields][2] , but it doesn't seem to work for me.
I would also like the results page to always display the results sorted by price assending. The sort options above don't seem to over ride the user selected sort option.
But maybe its not that simple?
Many Thanks