private function parseItem($item)
 {
     $itemId = (string) $item->itemId;
     foreach ($this->items as $_item) {
         if ($_item->itemId == $itemId) {
             @$this->duplicates_ids[$itemId]++;
             $this->duplicates_count++;
             return true;
         }
     }
     $buyItNow = -1;
     if ($item->listingInfo->buyItNowAvailable == 'true') {
         $buyItNow = (double) $item->listingInfo->buyItNowPrice;
         //$new_item['BuyItNow'] =
     }
     $picture_url = (string) $item->pictureURLLarge;
     if (empty($picture_url)) {
         $picture_url = (string) $item->galleryURL;
     }
     $new_item = EbayItem::getSearchItem(isset($item->sellingStatus->bidCount) ? (int) $item->sellingStatus->bidCount : '0', $buyItNow, (string) $item->sellingStatus->currentPrice['currencyId'], strtotime($item->listingInfo->startTime), strtotime($item->listingInfo->endTime), $itemId, (string) $item->viewItemURL, $picture_url, (double) $item->sellingStatus->currentPrice, $this->request['request'], $this->getShipping($item->shippingInfo->shippingServiceCost, $item->shippingInfo->shipToLocations), $this->parseTimeLeft($item->sellingStatus->timeLeft), (string) $item->title, (string) $item->listingInfo->listingType);
     $this->items[] = $new_item;
     return TRUE;
 }
 /**
  *
  */
 protected function parseXML()
 {
     if (empty($this->xml)) {
         $this->error_msg = $this->errors['response-empty'];
         return;
     } elseif ($this->xml->Ack != "Success") {
         $this->error_msg = $this->errors['response-filed'];
         return;
     }
     $i = $this->items_iterator;
     foreach ($this->xml->Item as $item) {
         $currency_attrs = $item->CurrentPrice->attributes();
         $itemId = (string) $item->ItemID;
         $title = (string) $item->Title;
         $pictureUrls = (array) $item->PictureURL;
         $pictureUrl = $pictureUrls[0];
         $itemUrl = (string) $item->ViewItemURLForNaturalSearch;
         $dateOfAdded = strtotime($item->StartTime);
         $dateOfEnded = strtotime($item->EndTime);
         $timeLeft = $this->parseTimeLeft($item->TimeLeft);
         $quantity = (int) $item->Quantity;
         $quantitySold = (int) $item->QuantitySold;
         $bidCount = (int) $item->BidCount;
         $price = (double) $item->CurrentPrice;
         $currency = (string) $currency_attrs['currencyID'];
         $buyItNow = (isset($item->BuyItNowAvailable) and $item->BuyItNowAvailable == 'true') ? (double) $item->ConvertedBuyItNowPrice : -1;
         $paymentMethods = (string) $item->PaymentMethods;
         $returnPolicy = (string) $item->ReturnPolicy->ReturnsAccepted;
         $shipping = (array) $item->ShipToLocations;
         $excludeShipLocations = (array) $item->ExcludeShipToLocation;
         $globalShipping = intval($item->GlobalShipping == 'true');
         $condition = (string) $item->ConditionDescription;
         $auctionType = (string) $item->ListingType;
         $item = EbayItem::getListingItem($bidCount, $buyItNow, $currency, $dateOfAdded, $dateOfEnded, $itemId, $itemUrl, $pictureUrl, $price, $shipping, $timeLeft, $title, $excludeShipLocations, $quantitySold, $quantity, $returnPolicy, $paymentMethods, $condition, $globalShipping, $auctionType);
         $this->items[] = $item;
         /*
                         $this->xml_data_arr[$i]['ItemID'] = $item->ItemID;
                         $this->xml_data_arr[$i]['PictureURL'] = $item->PictureURL[0];
                         $this->xml_data_arr[$i]['ItemURL'] = $item->ViewItemURLForNaturalSearch;
                         $this->xml_data_arr[$i]['Title'] = $item->Title;
                         $this->xml_data_arr[$i]['Price'] = $item->ConvertedCurrentPrice;
                         $this->xml_data_arr[$i]['BidCount'] = $item->BidCount;
                         $this->xml_data_arr[$i]['TimeLeft'] = $item->TimeLeft;				
                         $this->xml_data_arr[$i]['AvailableQuantity'] = (int)$item->Quantity - (int)$item->QuantitySold;				
                         $this->xml_data_arr[$i]['BuyItNow'] = -1;
         
                         if(isset($item->BuyItNowAvailable))
                         {
                             if(strcmp($item->BuyItNowAvailable, 'true') == 0)
                             {
                                 $this->xml_data_arr[$i]['BuyItNow'] = (double)$item->ConvertedBuyItNowPrice;
                             }
                         }
         
                         //$query = "SELECT `ShippingInfo` FROM `articles` WHERE `EbayId`='" . $item->ItemID . "'";
                         //$resp_shipInfo = mysql_query($query);
                         //$row_shipInfo = mysql_fetch_row($resp_shipInfo);
                         //$this->xml_data_arr[$i]['Shipping'] = $row_shipInfo[0];
         */
         $i++;
         $this->items_iterator++;
     }
     if (!empty($this->sortMethod)) {
         //$this->xml_data_arr = $mainClass->sortItemsXML($this->xml_data_arr, $this->sortMethod);
     }
 }