当前位置:编程学习 > 网站相关 >>

magento API 代码

$mageUrl    = 'http://www.astrashoponline.com/coolseason/api/?wsdl';
$mageUser   = 'apiuserterry';
$mageApiKey = 'terry1112';

$soap = new SoapClient($mageUrl); www.zzzyk.com

$sessionID = $soap->login($mageUser, $mageApiKey);

var_dump($soap->call($sessionID, 'catalog_category.info',10));


得到的值为api.xml配置文件中:

<config>
    <api>
        <resources>
            <catalog_category translate="title" module="catalog">
                <model>catalog/category_api</model>
                <title>Category API</title>
                <acl>catalog/category</acl>
                <methods>
                    <info translate="title" module="catalog">
                        <title>Retrieve category data</title>
                        <acl>catalog/category/info</acl>
                    </info>

对应的方法为:

<model>catalog/category_api</model>

制定文件为:Mage_Catalog_Model_Category_Api

方法为info方法

因为这个方法需要传递值,

所以:$soap->call($sessionID, 'catalog_category.info',10)

10传递的是分类的id。

补充:Web开发 , 其他 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,