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)
-   -   Searching Extra Fields (https://forum.x-cart.com/showthread.php?t=2503)

kpriest 04-29-2003 08:16 PM

Searching Extra Fields
 
Now I need to add to the Advanced search page - I will have a drop down box with a list of values that may be found in ANY of the extra fields. So, I want to add the value selected to the advanced search.

The problem is that I think the values assigned in the <Select> drop down list need to be passed through smarty (?) somehow and then I would add this to the query:


Code:

        $search_ef_condition = " AND ($sql_tbl[products].param01 like '%$ef_search%' or $sql_tbl[products].param02 like '%$ef_search%' or $sql_tbl[products].param03 like '%$ef_search%' or $sql_tbl[products].param04 like '%$ef_search%' or $sql_tbl[products].param05 like '%$ef_search%' or $sql_tbl[products].param06 like '%$ef_search%' or $sql_tbl[products].param07 like '%$ef_search%' or $sql_tbl[products].param08 like '%$ef_search%') "

(Note: I am skipping param00 and param09 intentionally)
$ef_search would be the value of what was selected in the drop-down, but HOW do I get it to pick up the value from the <select> box?? The drop down looks something like this:
Code:

        <select class="combobox" name="ef_search" size="1">
          <option value="">    </option>
          <option value="choice1">choice1</option>
          <option value="choice2">choice2</option>
          <option value="choice3">choice3</option>
          <option value="choice4">choice4</option>
          <option value="choice5">choice5</option>
        </select>

There's actually 15 or 20 choices in the drop down and they are hardcoded in there and they won't change.

And I modified the $search_query to include the $search_ef_condition:
Code:

        $search_query = "($sql_tbl[products].product like '%$substring%' or $sql_tbl[products].descr like '%$substring%') and $sql_tbl[categories].category like '$search_category%' and $sql_tbl[products].forsale='Y' and $sql_tbl[categories].avail='Y' $search_ef_condition $price_condition ";

It's looking like I'm in over my head, but I feel I am close. Any ideas? Am I going about this the wrong way? You see what I am wanting to add to the query - Search all of the param0x fields for a value that was selected from the drop down added to the advanced search page.

Help? :cry:

B00MER 04-30-2003 08:23 AM

Print the complete query string and give it a whirl in phpMyAdmin to see if you've got any syntax errors or if you need to restructure the query.

hth. ;)

kpriest 04-30-2003 08:35 AM

To do that, I would have to translate the variables first and this is exactly the problem - the $ef_search is not getting set by the drop down value. I believe it has to go through smarty because the other variables in the advanced search page have this: value="{$smarty.get.substring}"

I don't know enough to be able to pass the value selected in the drop down, through smarty (if that's what I need) and then to the search.php script, so the $ef_search variable contains the value selected in the drop down.

John7 07-03-2003 09:24 PM

Any progress?
 
Any progress?

It would be realy nice if the search could search feilds that are in the extra feilds.

Thanks, John7


All times are GMT -8. The time now is 05:57 AM.

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