0

I'm using the following soap function to pull my Magento category tree:

<?php

$client = new SoapClient('http://bennettcode.com/store/index.php/api/soap/?wsdl');

// If somestuff requires API authentication,
// then get a session token
$session = $client->login('soap_user', 'password');

$result = $client->call($session, 'catalog_category.tree');

var_dump($result);

// If you don't need the session anymore
//$client->endSession($session);
?>

The following output is generated enter image description here

What tools can I use to sort and manipulate this data so that it is more useful/legible? I'd eventually like to be able to sort and display SOAP function results in a neat manner. I have limited development knowledge, but I'm guessing I would use PHP to further edit the script. Any push (or shove) in the right direction would be great!

1 Answer 1

0

You're using PHP to get the data so let's continue with PHP.

I'm sure you saw that there data it returned is an array that holds a bunch of arrays for each category.

<?php foreach ($result as $category)
 {
var_dump($category);
echo "/n".'-----'."/n";
}

All you're doing here is breaking it down to a smaller subset of arrays so you can actually see what's in there till you get to the point where you can see what data is in there, what parts you want/need and how you want to display it.

By the way, zend_debug::dump($result) will usually give you an easier to read dump of what's going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.