# 基礎系統功能
## Smtp功能:
magento需要配置smtp才能發郵件,例如Amazon云的郵件服務,mailgun等,
需安裝插件: [https://www.mageplaza.com/magento-2-smtp/](https://www.mageplaza.com/magento-2-smtp/)

郵件發信地址配置好:

測試發信成功:

*****
## Transaction 郵件配置:
Magento商城各種郵件配置,聯系郵件,發送郵件,系統郵件,回復郵件等,郵件內容格式設計:
這些都可以在magento后臺配置,注意:相關配置是比較多,要測試
參考:https://www.mageplaza.com/kb/magento-2-tutorial/?

### 8,**聯系我們 表單功能 和 郵件接收,Newletter功能**
1,smtp配置好,測試發送郵件功能
2,后臺要設置發送地址, 接收人郵件,發送人等
3,新增發送各種郵件的模板
4,預覽郵件,測試發送
5,newsletter-popup
https://www.mageplaza.com/magento-2-newsletter-popup/
*****
## **后臺翻譯成中文**
1,安裝中文翻譯包,參考 : https://github.com/zouhongzhao/magento2\_zh\_hans\_cn
2,后臺,用戶,配置 locale, 選擇中文

*****
## Abandoned cart(購物車未結算提醒 (Cart Abandon Reminder))
magento自帶手動 abandoned cart reminder 功能。
自動化的插件有:
https://www.mageplaza.com/magento-2-abandoned-cart-email/
## 各種認證掛件,
MacAfee Secure ,WordFence
## Restful API接口
magento自帶功能:https://devdocs.magento.com/redoc/2.3/
*****
## webhook 回調接口
插件實現:
https://docs.mageplaza.com/webhook/#:~:text=Webhook%20is%20the%20configuration%20that%20allows%20sending%20the,the%20event%20of%20Magento%20when%20some%20events%20occur.
*****
## 第三方存儲:Oss, s3, cloudflare
官方提供:https://devdocs.magento.com/guides/v2.4/config-guide/remote-storage/config-remote-storage-aws-s3.html
第三方:https://magecomp.com/blog/configure-amazon-s3-with-magento-2/
*****
## QA功能
1,直接做頁面+Block+html
*****
## 多語言
magento自帶功能
參考:http://www.hmoore.net/zouhongzhao/magento2-in-action/628431
*****
*****
### **多貨幣****顯示**
magento自帶功能實現:https://docs.magento.com/user-guide/stores/currency-configuration.html
步驟:
1,例如需要美元,加拿大元
2,magento后臺:商店\-》設置\-》貨幣設置
3,magento后臺:商店\-》貨幣\-》貨幣匯率
4,也可以對接第三方接口,自動cron 調整新匯率
參考:https://www.mageplaza.com/kb/how-to-configure-currency-magento-2.html


## 權限管理員,定義不同后臺顯示
TODO
## 批發商系統 【Wholesale Program】【B2B】
梯度價格功能 magento自帶功能:https://www.mageplaza.com/kb/how-to-setup-tier-price-in-magento-2.html
更強大的實現,需要插件:https://www.mageplaza.com/magento-2-extensions/b2b.html
## 聯系方式(Contact Us)頁面
magento自帶實現,例如:
https://magento.liangdabiao.com/contact/
## elasticseach增強搜索功能
magento自帶功能:
參考:https://www.mageplaza.com/kb/how-to-configure-elasticseach-in-magento-2.html
*****
### **社交媒體集成**
參考;https://www.mageplaza.com/magento-2-social-share/
*****
## Notifications
onesignal 短信推送
TODO
*****
## url rewrite
Magento自帶有此功能 ?Rewrite Url:
url路徑配置,可以兼容shopify等的url路徑格式
參考:https://www.mageplaza.com/kb/magento-2-tutorial/?

## facebook登錄功能
利用了插件 ?[https://www.mageplaza.com/magento-2-social-login-extension/](https://www.mageplaza.com/magento-2-social-login-extension/)
可以社交網絡登錄,原理就是oauth, 第三方獲得用戶授權信息,創建用戶,登錄
1要用facebook 開發者賬號 新建app, 正確填寫資料,才能登錄。
2Magento后臺配置賬號密碼:

## Restful API接口
[REST API reference | Adobe Commerce Developer Guide (magento.com)](https://devdocs.magento.com/redoc/2.3/)
參考: http://www.hmoore.net/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}}"
~~~
*****