用Webservice接口导入magento产品分类
时间:2016-11-02 23:19来源:未知 作者:好模板 点击:次
用Webservice接口导入magento产品分类,Php代码 ?php set_time_limit(0); $proxy = new SoapClient( http://localhost/magento/index.php/api/soap/?wsdl ); $sessionId = $proxy -login( crazy , abcdef ); $allCategories = $proxy -call( $sessi
用Webservice接口导入magento产品分类,Php代码
-
<?php
-
set_time_limit(0);
-
$proxy = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl');
-
$sessionId = $proxy->login('crazy', 'abcdef');
-
$allCategories = $proxy->call($sessionId, 'category.tree');
-
$selectedCategory = $allCategories['children'][0];
-
-
$newCategoryId = $proxy->call(
-
$sessionId,
-
'category.create',
-
array(
-
$selectedCategory['category_id'],
-
array('name'=>'New Category Through Soap')
-
)
-
);
-
-
$newData = array('is_active'=>1);
-
$proxy->call($sessionId, 'category.update', array($newCategoryId, $newData, 'default'));
-
?>
上面的代码可以示例了如何导入导出Categories.
-
$proxy = new SoapClient('http://localhost/magento/index.php/api/soap/?wsdl');
指向你的magento soap服务的位置
-
$sessionId = $proxy->login('crazy', 'abcdef');
指定授权的用户名和密码。此用户名和密码是在后台的System->Webservice下事先配置好的(责任编辑:好模板) |
------分隔线----------------------------