You are here:  » changing search

Support Forum



changing search

Submitted by konpapdo on Fri, 2011-05-20 17:26 in

hey david, need an advice ..
i made my pricetapestry with sub levels categories and i want to use your search(because it has already the html page the sort the navigation etc..)
so i am thinking just to copy my query result to yours, but i cant find the exact point where i can do it ...

i think in the search.php in line 340.. $searchresults["products"] = $rows;
and i was thinking to copy my array of result = to yours.. would that be possible? and how?

thnx in advance ..

Submitted by support on Fri, 2011-05-20 20:23

Hi konpapdo,

Consider how merging results affects paging, but as a starting point look at using PHP's array_merge() function...

http://php.net/manual/en/function.array-merge.php

...so at the point you identified, you could array_merge your subcategory query result rows with the original $rows.

It would probably be best however to combine the queries. I assume that you are constructing a sub-category query using a WHERE clause; so what you could do is add that clause to the $priceWhere variable, which is the price range / filter additional WHERE clause that is set up at the top of search.php. To try this, look for the following code beginning at line 45:

  else
  {
    $priceWhere = "";
  }

...and REPLACE with...

  else
  {
    $priceWhere = "";
  }
  $priceWhere .= " AND additional_where_here";

...where additional_where_here are the additional WHERE clauses you wish to add to the query...

Hope this helps,

Cheers,
David.
--
PriceTapestry.com

Submitted by konpapdo on Tue, 2011-05-24 15:50

hello david, i have one prob with the above..
in your case the $_GET['q'] parameter is already set so adding the additional where you are just filtering your original query... what am i trying to do is to show "all" the products of a category ... i have an extra field in pt_products with name -> subcategory and there i have an id of another table in which is the hierarchy of my categories..

Submitted by support on Tue, 2011-05-24 15:55

Hi konpapdo,

Could you perhaps email me the file in which you are trying to implement this so that I can see everything in context and I'll take a look for you...

Thanks,
David.
--
PriceTapestry.com