Skip to main content
Published: March 12 2007, 12:43:00 PMUpdated: November 28 2020, 1:19:38 PM

I am making a call to GetItem and using the DOM method getElementsByTagName to the response to get the Item Title. The title does not match with the ItemID - why is this happening?

Summary

If you use the API version 483 or lower to make the GetItem call, IncludeCrossPromotions is set to true by default.  Besides information about the main item, it will return cross promoted items as well.  If you use a DOM method like getElementsByTagName('Title'),  it will return the NodeList containing the title of the cross promoted items as well.  Hence if you display the value of the first node, you will most likely get a mismatch of the title for the ItemID.
 


Detailed Description
 

Here are suggested methods to resolve the issue:
1.  Do not retrieve the cross promoted items if you do not need them.  If you use version 485 or higher, it is not returned by default, unless you set the tag IncludeCrossPromotion to true. 
     If you use version 483 or lower, you can set the tag IncludeCrossPromotion to false as below:

<?xml version="1.0" encoding="utf-8"?>

<GetItemRequest xmlns="urn:ebay:apis:eBLBaseComponents">

  <Version>483</Version>

  <ItemID>150097678717</ItemID>

  <IncludeCrossPromotion>false</IncludeCrossPromotion>

  <RequesterCredentials>

    <eBayAuthToken>*****</eBayAuthToken>

  </RequesterCredentials>

</GetItemRequest>

2.  If you need the cross promoted items, then you need to access the last node in the NodeList that is returned by getElementsByTagName('Title').
     Here is a PHP sample to illustrate it:
$titleNode = $responseDoc->getElementsByTagName('Title');
echo '<BR>title: ', $titleNode->item($titleNode->length - 1)->nodeValue;


Version Info

The code example above was based on the versions specified below:

API Schema Version 483


Additional Resources

How well did this answer your question?
Answers others found helpful