Magento 1.9.x安装部署和API权限开启使用教程

1、解压缩安装包到根目录
http://localhost/

2、建立数据库,执行建库脚本
magento1924.sql

3、数据库配置
\app\etc\config.xml
\app\etc\local.xml
这里的frontName是后台路径

4、设置网站地址
数据库表core_config_data
web/unsecure/base_url=>http://localhost/
web/secure/base_url=>http://localhost/

5、设置管理员密码:
数据库表admin_user

默认密码(admin123):0192023a7bbd73250516f069df18b500

登录后台管理后可以到:System -> my account修改管理员账户信息和密码;

6、删除缓存文件,重启网站
var/cache
var/sessions

7、Magento API
API文档
https://devdocs.magento.com/guides/m1x/api/soap/introduction.html

角色Role和用户User
System/Web Services/Soap XML RPC/Roles 创建角色
System/Web Services/Soap XML RPC/Users 创建角色对应的用户,并且设置api key
使用api user和api key就可以访问Magento API
http://magentohost/api/soap/?wsdl
netnewpower
testapikey

例子:
<?php
$client = new SoapClient(‘http://localhost/api/soap/?wsdl’);

// If somestuff requires API authentication,
// then get a session token
$session = $client->login(‘netnewpower’, ‘testapikey’);

$result = $client->call($session, ‘catalog_category.info’, ‘1’);
echo ‘<pre>’;
print_r($result);

// If you don’t need the session anymore
$client->endSession($session);
?>

发表评论

您的电子邮箱地址不会被公开。