Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Custom search with extra fields

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 04-05-2012, 04:24 AM
 
Ger Somers Ger Somers is offline
 

Newbie
  
Join Date: Aug 2011
Posts: 2
 

Default 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
__________________
Version 4.4.3
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 11:12 PM.

   

 
X-Cart forums © 2001-2020