Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static function search($tekst, $kategoria, $woj)
- {
- //zapytanie po starym api, dla referencji
- /* $search_request = array(
- "sessionHandle" => allegro::$session,
- "searchQuery" => array(
- "searchString" => $tekst,
- "searchCategory" => $kategoria)
- );
- if($woj != 0)
- $seach_request["searchQuery"]["searchState"] = $woj;
- return allegro::$soapClient->doSearch($search_request); */
- //koniec starego zapytania
- //sprawdzić kategorię - jeśli 0 to olać.
- $filters = array();
- if($kategoria != 0)
- {
- //searchCategory
- array_push($filters, array(
- "filterId" => "category",
- "filterValueId" => array($kategoria)
- ));
- }
- //searchString
- array_push($filters, array(
- "filterId" => "search",
- "filterValueId" => array($tekst))
- );
- //nowe api nie umie w województwa jeśli szukamy po całym allegro -.-
- if($woj != 0 && $kategoria != 0)
- {
- //searchState
- array_push($filters, array(
- "filterId" => "state",
- "filterValueId" => array($woj))
- );
- }
- $new_search_request = array(
- "countryId" => ALLEGRO_COUNTRY,
- "webapiKey" => ALLEGRO_KEY,
- "filterOptions" => $filters
- );
- $test = allegro::$soapClient->doGetItemsList($new_search_request);
- return allegro::resultTranslator($test);
- /* resultTranslator tłumaczy wynik funkcji na stare api,
- http://pastebin.com/3zVx05re */
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement