用Webservice接口导入产品分类
发布时间:2020-12-17 01:19:16 所属栏目:安全 来源:网络整理
导读:?phpset_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'); // Get all categories.$selectedCategor
<?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'); // Get all categories. $selectedCategory = $allCategories['children'][0]; // Get the fisrt categories as parent category // insert test $newCategoryId = $proxy->call( $sessionId,'category.create',array( $selectedCategory['category_id'],array('name'=>'New Category Through Soap') ) ); // update test. $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下事先配置好的 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |