安装magento:
可以参考 :https://www.kancloud.cn/zouhongzhao/magento2-in-action/628424
配置paypal :
不需要安装插件,直接利用magento后台配置,要申请paypal商业账号,创建商业账号sandbox(us), 得到 商家用户和客户用户 来测试支付和收入。
参考资料:
1,国外资料
https://www.mageplaza.com/kb/how-to-configure-paypal-express-checkout-payment-method-magento-2.html
2,国内资料
https://www.kancloud.cn/zouhongzhao/magento2-in-action/699199
配置 stripe 信用卡支付 (选):
https://stripe.com/docs/plugins/magento-2
Installing the Magento 2 Module | Stripe Documentation
配置好,可以测试:
支付成功,stripe配置是相对容易:
安装mageplaza方的插件,
记得安装 core:
https://github.com/mageplaza/module-core
如果国内环境出现问题,解决方案:
参考:https://github.com/mageplaza/module-core/issues/26
// 修改这里的代码则可以:
**if($params\['extension'\] == 'Mageplaza\_Blog'){**
** $result\['success'\] = true;**
** $result\['key'\] = 'BLOG-XXXXXXXXXXXXXXXX';** //解决验证问题,key在mageplaza后台订单有
**}**
https的配置 :
参考:https://www.kancloud.cn/zouhongzhao/magento2-in-action/647798
SMTP邮件功能
magento需要配置smtp才能发邮件,例如Amazon云的邮件服务,mailgun等
需安装插件: https://www.mageplaza.com/magento-2-smtp/
邮件发信地址配置好:
测试发信成功:
后台配置全部检查一次:(重要)

开发前准备:
1. 开启调试功能 debug
1.1 ,切换到 develop模式
php bin/magento deploy:mode:set developer
1.2,前端页面提示 layout+container:
1.3,debug后台模块位置:
https://bbs.mallol.cn/question/m2-open-foreground-template-debugging-path/
2. 怎样查看Log:
参考:2.1,https://www.kancloud.cn/zouhongzhao/magento2-in-action/681201
2.2,https://devdocs.magento.com/guides/v2.3/config-guide/log/custom-logger-handler.html
~~~
查看log,debug的地方:
主要看debug.log/exception.log
如果还没有可靠的信息的话,就看apache/nginx里配置的error log。
~~~
3,基本知识学习:
https://www.kancloud.cn/zouhongzhao/magento2-in-action (国内)
https://www.mageplaza.com/ (国外)
4, restful api的使用:
REST API reference | Adobe Commerce Developer Guide (magento.com)
参考: https://www.kancloud.cn/zouhongzhao/magento2-in-action/861578
//通过rest/V1/integration/admin/token登录后台生成token
$userData = array("username" => "zou", "password" => "zou用户的密码");
$ch = curl_init("http://magento2demo.texiaoyao.cn/rest/V1/integration/admin/token");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($userData));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Content-Lenght: " . strlen(json_encode($userData))));
$token = curl_exec($ch);
$ch = curl_init("http://magento2demo.texiaoyao.cn/rest/V1/customers/1");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array("Content-Type: application/json", "Authorization: Bearer " . json_decode($token)));
$result = curl_exec($ch);
var_dump($result);
返回结果:
string(641) "{"id":1,"group_id":1,"default_shipping":"1","created_at":"2018-06-11 01:09:31","updated_at":"2018-11-30 05:01:44","created_in":"Default Store View","email":"zouhongzhao@126.com","firstname":"zou","lastname":"hongzhao","store_id":1,"website_id":1,"addresses":[{"id":1,"customer_id":1,"region":{"region_code":"\u6e56\u5317","region":"\u6e56\u5317","region_id":0},"region_id":0,"country_id":"CN","street":["\u9ad8\u65b0\u5927\u9053"],"telephone":"1510232345","postcode":"430000","city":"\u6b66\u6c49","firstname":"zou","lastname":"hongzhao","default_shipping":true}],"disable_auto_group_change":0,"extension_attributes":{"is_subscribed":false}}"
万能命令,修复问题:
php bin/magento maintenance:enable
rm -rf var/di/* && rm -rf var/generation/* && rm -rf var/cache/* && rm -rf var/page_cache/* && rm -rf var/view_preprocessed/* && rm -rf pub/static/* && rm -rf generated/* && mkdir var/di
php bin/magento setup:upgrade && php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f && php bin/magento indexer:reindex && php bin/magento maintenance:disable && php bin/magento cache:clean && php bin/magento cache:flush
服务器配置:
建议:4核16g =》同时250人/min =》达到基本要求