X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   Custom search with extra fields (https://forum.x-cart.com/showthread.php?t=63180)

Ger Somers 04-05-2012 04:24 AM

Custom search with extra fields
 
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"  />&nbsp;All&nbsp;&nbsp;
            <input type="radio" id="OEM" value="OEM" name="productType" />&nbsp;Original&nbsp;&nbsp;
            <input type="radio" id="COMPAT" value="COMPAT" name="productType" />&nbsp;Compatibles&nbsp;&nbsp;
            <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


All times are GMT -8. The time now is 10:53 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.