I am working with the amazon API and I am unable to finish the process that needs to be done. Here is my code:
if(is_array($xmlFiles)){ foreach($xmlFiles as $xmlFile){ $xml = simplexml_load_file($xmlFile); if(isset($xml->GetMatchingProductForIdResult['staus'] === 'Success'){ foreach($xml->GetMatchingProductForIdResult as $items){ if(isset($items->Products->Product->AttributeSets->children('ns2', true)->ItemAttributes->ListPrice->Amount) !== False) { $amount = $items->Products->Product->AttributeSets->children('ns2', true)->ItemAttributes->ListPrice->Amount; }else{ $amount = '0.00'; } } } That is to get the information from the XML. I get an error. Here is the error:
Fatal error: Call to a member function children() on null in (File Path) on line 117 Line 117 is the second If statement.
The XML all has amounts. Here is the path to the XML information I am trying to grab:
$xml->GetMatchingProductForIdResult->Products->Product->AttributeSets->children('ns2', true)->ItemAttributes->ListPrice->Amount If someone could help me out and tell me what I am doing wrong, I would greatly appreciate it.
No comments:
Post a Comment