简体   繁体   English

肥皂产品列表输出-Magento

[英]Soap Product List Output - Magento

I have tried using the Magento API documentation via SOAP times output my product list, the whole thing looks like this: ( http://www.magentocommerce.com/api/soap/introduction.html ) 我尝试通过SOAP时间使用Magento API文档输出我的产品列表,整个过程看起来像这样:( http://www.magentocommerce.com/api/soap/introduction.html

<?php
//include the Magento API file - replace with your server path to the file
require_once('/absolut-dirl/app/Mage.php');

/***** Configuration ******/
$myAPILogin = 'login';
$myAPIKey = 'key';


// Begin SOAP Requests
$client = new SoapClient('https://shop-url.com/index.php/api/soap/?wsdl');
$session = $client->login($myAPILogin, $myAPIKey);

//get all my database products into an array
$products = $client->call($session, 'catalog_product.list');

echo "Starting product loop...<br/><br/>";
var_dump($products);
?>

However, I always get NULL as a result. 但是,我总是得到NULL。 What am I doing wrong? 我究竟做错了什么? About fast help, I would appreciate it. 关于快速帮助,我将不胜感激。

Greetings Roley 问候劳力

// Sorry for my bad english. // 对不起,我的英语不好。

Its may be problem with login credential. 登录凭据可能有问题。 Use try catch block and check. 使用try catch块并检查。

try
{
    $proxy  = new SoapClient($magento_webserver."api/soap/?wsdl");
    $sessionId  = $proxy->login($magento_webservices_username,  $magento_webservices_passwd);
    echo "Soap login complete! <br/>";
    echo "======================== <br/>";
}
catch (SoapFault $fault)
{
    die("\n\n SOAP Fault: (fault code: {$fault->faultcode},
    fault string: {$fault->faultstring}) <br/>");
}

I added the try-catch block and get the following result: 我添加了try-catch块并获得以下结果:

Soap Login complete!
========================

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM