public static function ebay_search($request)
 {
     $options = CE_Ebay::get_option();
     extract($request);
     $paged = isset($paged) ? $paged : 1;
     $number = isset($number) ? $number : 10;
     $url = self::URL_API_SEARCH;
     $url .= '&GLOBAL-ID=' . $site;
     $url .= '&SECURITY-APPNAME=' . $options['app_id'];
     $url .= '&RESPONSE-DATA-FORMAT=XML&outputSelector[0]=SellerInfo&outputSelector[1]=PictureURLLarge';
     $url .= "&paginationInput.entriesPerPage=" . $number;
     $url .= "&paginationInput.pageNumber=" . $paged;
     if ($options['use_affiliate']) {
         $url .= '&affiliate.networkId=' . $options['network_id'];
         $url .= '&affiliate.trackingId=' . $options['tracking_id'];
         $url .= '&affiliate.customId=' . $options['custom_id'];
     }
     if (!empty($user_id)) {
         $url .= "&itemFilter(0).name=Seller";
         $url .= "&itemFilter(0).value={$user_id}";
     }
     if (!empty($keywords)) {
         $url .= '&keywords=' . $keywords;
     }
     if ($category != '-1') {
         $url .= '&categoryId=' . $category;
     }
     $items = array();
     $resp = simplexml_load_file($url);
     if ($resp->ack == 'Success') {
         foreach ($resp->searchResult->item as $item) {
             $item->currencyId = (string) $item->sellingStatus->currentPrice['currencyId'];
             $item->currencyConvert = (string) $item->sellingStatus->convertedCurrentPrice['currencyId'];
             $endTime = (string) $item->listingInfo->endTime;
             $time = strtotime($endTime);
             $item->end_time = date('Y-m-d H:i:s', $time);
             $item->title = str_replace('"', "''", $item->title);
             $item->time_left = getPrettyTimeFromEbayTime($item->sellingStatus->timeLeft);
             $items[] = (array) $item;
         }
         $resp = array('success' => true, 'msg' => __('Search success'), 'data' => $items, 'paginationOutput' => $resp->paginationOutput);
     } else {
         $resp = array('success' => false, 'msg' => __('Search ebay false'));
     }
     return $resp;
 }
                }
                $link = $item->ViewItemURLForNaturalSearch;
                $title = $item->Title;
                $price = sprintf("%01.2f", $item->ConvertedCurrentPrice);
                $ship = sprintf("%01.2f", $item->ShippingCostSummary->ShippingServiceCost);
                $total = sprintf("%01.2f", (double) $item->ConvertedCurrentPrice + (double) $item->ShippingCostSummary->ShippingServiceCost);
                // Determine currency to display - so far only seen cases where priceCurr = shipCurr, but may be others
                $priceCurr = (string) $item->ConvertedCurrentPrice['currencyID'];
                $shipCurr = (string) $item->ShippingCostSummary->ShippingServiceCost['currencyID'];
                if ($priceCurr == $shipCurr) {
                    $curr = $priceCurr;
                } else {
                    $curr = "{$priceCurr} / {$shipCurr}";
                    // potential case where price/ship currencies differ
                }
                $timeLeft = getPrettyTimeFromEbayTime($item->TimeLeft);
                $endTime = strtotime($item->EndTime);
                // returns Epoch seconds
                $endTime = $item->EndTime;
                $results .= "<tr><td><a href=\"{$link}\"><img src=\"{$picURL}\"></a></td><td><a href=\"{$link}\">{$title}</a></td>" . "<td>{$price}</td><td>{$ship}</td><td>{$total}</td><td>{$curr}</td><td>{$timeLeft}</td><td><nobr>{$endTime}</nobr></td></tr>";
            }
            $results .= "</table>";
        } else {
            $results = "<p><i><b>No items found<b></i></p>";
        }
        $priceRangeMin = $priceRangeMax;
        // set up for next iteration
    }
    // foreach
}
// if