/** * sample_AddItem::dispatchCall() * * Dispatch the call * * @param array $params array of parameters for the eBay API call * * @return boolean success */ public function dispatchCall($params) { $a = new ShippingServiceOptionsType(); $a->setShippingService('UPS2ndDay'); $a->setShippingServicePriority('1'); $a->setShippingServiceCost('5'); $b = new ShippingDetailsType(); //print '<pre>'.print_r(get_class_methods($b),true).'</pre><br>'; $b->setShippingServiceOptions($a); //$b->setDefaultShippingCost(5); $b->setShippingType('Flat'); $req = new AddItemRequestType(); $item = new ItemType(); $item->setTitle($params['Title']); $item->setQuantity($params['Quantity']); $item->setCurrency($params['Currency']); $item->setCountry($params['Country']); $item->setStartPrice($params['StartPrice']); $item->setListingDuration($params['ListingDuration']); $item->setLocation($params['Location']); $item->setPaymentMethods($params['PaymentMethods']); $item->setListingType($params['ListingType']); $item->setDescription($params['Description']); $item->ShippingService = 'UPS Ground'; $item->setShippingDetails($b); //print '<pre>'.print_r(get_class_methods($a),true).'</pre><br>'; //$this->dumpObject($a); //$this->dumpObject($item); $primaryCategory = new CategoryType(); $primaryCategory->setCategoryID($params['CategoryID']); $item->setPrimaryCategory($primaryCategory); $req->setItem($item); $res = $this->proxy->AddItem($req); $this->dumpObject($res); if ($this->testValid($res)) { $this->dumpObject($res); return true; } else { return false; } }
/** * sample_AddItem::dispatchCall() * * Dispatch the call * * @param array $params array of parameters for the eBay API call * * @return boolean success */ public function dispatchCall($params) { $req = new AddItemRequestType(); $item = new ItemType(); $item->setTitle($params['Title']); $item->setQuantity($params['Quantity']); $item->setCurrency($params['Currency']); $item->setCountry($params['Country']); $item->setStartPrice($params['StartPrice']); $item->setListingDuration($params['ListingDuration']); $item->setLocation($params['Location']); $item->setPaymentMethods($params['PaymentMethods']); $item->setListingType($params['ListingType']); $item->setDescription($params['Description']); $item->setSubTitle($params['SubTitle']); $item->setHitCounter($params['HitCounter']); $item->setListingEnhancement($params['ListingEnhancement']); $listingDesigner = new ListingDesignerType(); $listingDesigner->setLayoutID($params['LayoutID']); $listingDesigner->setThemeID($params['ThemeID']); $item->setListingDesigner($listingDesigner); $primaryCategory = new CategoryType(); $primaryCategory->setCategoryID($params['CategoryID']); $item->setPrimaryCategory($primaryCategory); $secondaryCategory = new CategoryType(); $secondaryCategory->setCategoryID($params['secondaryCategoryID']); $item->setSecondaryCategory($secondaryCategory); $picture = new PictureDetailsType(); $picture->setPictureURL($params['PictureURL']); $item->setPictureDetails($picture); $req->setItem($item); $res = $this->proxy->AddItem($req); if ($this->testValid($res)) { $this->dumpObject($res); return true; } else { return false; } }
/** * sample_AddItem::dispatchCall() * * Dispatch the call * * @param array $params array of parameters for the eBay API call * * @return boolean success */ public function dispatchCall($params) { $reqPic = new UploadSiteHostedPicturesRequestType(); $reqPic->setPictureData(file_get_contents("/var/www/apache2-default/playground/johann/php5/Fotolia.jpg")); $reqPic->setPictureSet(PictureSetCodeType::CodeType_Supersize); $resPic = $this->proxy->UploadSiteHostedPictures($reqPic); if ($this->testValid($resPic)) { $pictureUrl = $resPic->getSiteHostedPictureDetails()->getFullURL(); $reqItem = new AddItemRequestType(); $item = new ItemType(); $item->setTitle('ipod'); $item->setQuantity(1); $item->setCurrency('EUR'); $item->setCountry('DE'); $item->setStartPrice('5.00'); $item->setListingDuration('Days_7'); $item->setLocation('Cologne'); $item->setPaymentMethods('CashOnPickup'); $item->setListingType('Chinese'); $item->setDescription('Neuer iPod mit Kopfhörer Ladekabel und Pc-Anschlusskabel.'); $item->setSubTitle('Brandneuer iPod Mini!'); $item->setHitCounter('BasicStyle'); $item->setListingEnhancement('Highlight'); $listingDesigner = new ListingDesignerType(); $listingDesigner->setLayoutID('7710001'); $listingDesigner->setThemeID('7730714'); $item->setListingDesigner($listingDesigner); $primaryCategory = new CategoryType(); $primaryCategory->setCategoryID(10610); $item->setPrimaryCategory($primaryCategory); $secondaryCategory = new CategoryType(); $secondaryCategory->setCategoryID(8267); $item->setSecondaryCategory($secondaryCategory); $picture = new PictureDetailsType(); $picture->setPictureURL($pictureUrl); $item->setPictureDetails($picture); $attSet = new AttributeSetType(); $attSet->setTypeAttribute('attributeSetID', 1950); $att = new AttributeType(); $att->setTypeAttribute('attributeID', 10244); $attValue = new ValType(); $attValue->setValueID(10426); $att->setValue($attValue, 0); $attSet->setAttribute($att, 0); $atts = new AttributeSetArrayType(); $atts->setAttributeSet($attSet, 0); $attSet2 = new AttributeSetType(); $attSet2->setTypeAttribute('attributeSetID', 2136); $att2 = new AttributeType(); $att2->setTypeAttribute('attributeID', 3803); $attValue2 = new ValType(); $attValue2->setValueID(32040); $att2->setValue($attValue2, 0); $att3 = new AttributeType(); $att3->setTypeAttribute('attributeID', 3806); $attValue3 = new ValType(); $attValue3->setValueID(-3); $attValue3->setValueLiteral('siehe Artikelbeschreibung'); $att3->setValue($attValue3, 0); $attSet2->setAttribute($att3, 1); $atts->setAttributeSet($attSet2, 1); $item->setAttributeSetArray($atts); $reqItem->setItem($item); $resItem = $this->proxy->AddItem($reqItem); if ($this->testValid($resItem)) { $this->dumpObject($resItem); return true; } else { return false; } } else { return false; } }
function addItem($id, $session) { // skip this item if item status not allowed $allowed_statuses = array('prepared', 'verified'); if (!$this->itemHasAllowedStatus($id, $allowed_statuses)) { return $this->result; } // build item $ibm = new ItemBuilderModel(); $item = $ibm->buildItem($id, $session); if (!$ibm->checkItem($item)) { return $ibm->result; } // eBay Motors (beta) if ($item->Site == 'eBayMotors') { $session->setSiteId(100); } // preparation - set up new ServiceProxy with given session $this->initServiceProxy($session); // switch to FixedPriceItem if product has variations $listing_item = self::getItem($id); // $useFixedPriceItem = ( ProductWrapper::hasVariations( $listing_item['post_id'] ) ) ? true : false; // $useFixedPriceItem = ( 'FixedPriceItem' == $listing_item['auction_type'] ) ? true : false; WPLE()->logger->info("Adding #{$id}: " . $item->Title); if (self::listingUsesFixedPriceItem($listing_item)) { $req = new AddFixedPriceItemRequestType(); $req->setItem($item); WPLE()->logger->debug("Request: " . print_r($req, 1)); $res = $this->_cs->AddFixedPriceItem($req); } else { $req = new AddItemRequestType(); $req->setItem($item); WPLE()->logger->debug("Request: " . print_r($req, 1)); $res = $this->_cs->AddItem($req); } // handle response and check if successful if ($this->handleResponse($res)) { // save ebay ID and fees to db $listingFee = self::getListingFeeFromResponse($res); $data['ebay_id'] = $res->ItemID; $data['fees'] = $listingFee; $data['status'] = 'published'; self::updateListing($id, $data); // get details like ViewItemURL from ebay automatically $this->updateItemDetails($id, $session); $this->postProcessListing($id, $res->ItemID, $item, $listing_item, $res, $session); WPLE()->logger->info("Item #{$id} sent to ebay, ItemID is " . $res->ItemID); } // call successful self::processErrorsAndWarnings($id, $this->result); return $this->result; }