I'm trying to make a function that return all related product of a product, using the productId
So I make this in /var/www/website/api/catalog/get_collection.php :
require_once dirname(__FILE__).'/../app/Init.php';
$task = new Init(__FILE__);
> try {
>
> $client = $task->getSOAPClient();
> $session = $task->getSOAPSession($client);
>
> $productId = $_GET['productId'];
> $productId = (string)$productId;
> $result = $client->call($session, 'catalog_product_link.list', array('type' => 'related', 'product' => $productId));
> var_dump ($result);
}
catch(Exception $e) {
> $task->errorResponse($e->getMessage());
}
I call this "get_collection.php" file from my google chrome with this line :
http://magento.dev.website.com/api/catalog/get_collection.php?productId=557
And this is the result I get :
{ error: "Product not exists." }
I try to replace $productId in the array of argument by the value of the productId, but still the same error.
Please, help me >.< Oh, it's on Magento 1.8.0, if this can help someone helping me ^^
app/Init.php
. Seems you want to use SOAP in order to get related products. This is described here.