api — Magento /home/content/05/456357285/html/example/test_api.php Вызов функции-члена getRole () для необъекта?

Я получил эту ошибку при получении продукта из magento, используя его API

Я попробую следующий код для получения продукта, пожалуйста, предоставьте какое-то решение по этому вопросу

<?php
$time_start = microtime(true);
try{
$devClient = new Soapclient('http://example.org/example/index.php/api/?wsdl', array('trace'=>1, 'exceptions'=>1));
$devSession = $devClient->login('test', 'test@321');

$productList = $devClient->call($devSession, 'catalog_product.list');
foreach ($productList as $product){
$theProduct = array();
$theProduct['product'] = $product;
$theProduct['attributeSet'] = current($devClient->call($devSession, 'product_attribute_set.list'));
$theProduct['info'] = $devClient->call($devSession, 'catalog_product.info', $product['sku']);
$theProduct['related'] = $devClient->call($devSession, 'catalog_product_link.list', array('related', $product['sku']));
$theProduct['up_sell'] = $devClient->call($devSession, 'catalog_product_link.list', array('up_sell', $product['sku']));
$theProduct['cross_sell'] = $devClient->call($devSession, 'catalog_product_link.list', array('cross_sell', $product['sku']));
$theProduct['grouped'] = $devClient->call($devSession, 'catalog_product_link.list', array('grouped', $product['sku']));
$theProduct['images'] = $devClient->call($devSession, 'catalog_product_attribute_media.list', $product['sku']);
$theProduct['tierprice'] = $devClient->call($devSession, 'product_tier_price.info', $product['sku']);
$theProduct['stock'] = $devClient->call($devSession, 'product_stock.list', $product['sku']);

$allProducts[] = $theProduct;
}
echo '$allProducts: <pre>' . print_r($allProducts, true) . '</pre>';

}
catch (Exception $e){
echo 'Error on line '. $e->getLine().' in '. $e->getFile() . $e->getMessage();
}

$time_end = microtime(true);
$time = $time_end - $time_start;
echo "<br/><br/>execution time " . $time;

?>

1

Решение

Задача ещё не решена.

Другие решения

Других решений пока нет …

По вопросам рекламы ammmcru@yandex.ru
Adblock
detector