devcccc/magento2-address-validation

支持使用Endereco服务的Magento 2地址验证!

安装次数: 2,248

依赖项: 0

建议者: 0

安全: 0

星标: 4

关注者: 1

分支: 1

开放问题: 1

语言:JavaScript

类型:magento2模块

2.0.15 2022-09-22 00:00 UTC

This package is auto-updated.

Last update: 2024-09-21 13:52:00 UTC


README

对于Magento:针对Web服务的扩展地址验证

关于

使用Endereco作为验证Web服务的地址验证模块,适用于Magento 2.2、2.3和2.4。需要单独的Endereco账户(https://www.endereco.de/)。

该模块支持在结账时对收货地址进行地址验证,以及一些自动完成功能——电子邮件验证也作为测试版集成。

安装

安装后

php bin/magento module:enable CCCC_Addressvalidation
php bin/magento setup:upgrade

如果您的Magento安装处于生产模式,您还必须部署静态内容文件

php bin/magento setup:static-content:deploy

对于开发系统,我们建议清理生成的和pub/static/frontend文件夹

rm -Rf generated pub/static/frontend

直接请求

重要:要使用更快的直接请求,需要额外的Web服务器配置。

对于nginx,您需要在您的nginx站点配置中添加一个新的location-block。对于Apache,您需要复制DirectProxy.php文件并在.htaccess中添加重写。

有关进一步说明,请参阅以下内容。

Apache Web服务器

安装/更新后,将DirectProxy文件复制到pub目录

cd {{YOUR MAGENTO MAIN DIRECTORY}}
cp vendor/endereco/magento2-address-validation/Controller/Proxy/DirectProxy.php pub/

编辑pub文件夹中的.htaccess。为DirectProxy.php添加重写。必须在此重写index.php重写之前完成此重写。

将以下行添加到pub/.htaccess

RewriteRule cccc_adressvalidation/direct DirectProxy.php [L]

为此在index.php重写之前,您的pub/.htaccess可能看起来像这样

....
RewriteRule cccc_adressvalidation/direct DirectProxy.php [L]

############################################
## Never rewrite for existing files, directories and links
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
....

现在在Magento管理后端扩展设置中启用直接请求。

菜单:商店 => 配置。选择“CCCC配置” => Endereco地址验证 => “使用直接请求” => 是

nginx Web服务器

对于nginx,需要在您的nginx站点配置中添加一个新的location-block。添加以下位置

location /cccc_adressvalidation/direct {
    proxy_pass https://<your domain>>/DirectProxy.php;
}

此location-block应直接放置在用于Magento商店的server-block中。

在现有的nginx配置中,我们必须扩展“PHP主应用程序的入口点”的script-whitelist。通常它看起来像这样

location ~ /(index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {

您必须在此处添加DirectProxy

location ~ /(DirectProxy|index|get|static|errors/report|errors/404|errors/503|health_check)\.php$ {

现在重启nginx,然后在Magento管理后端扩展设置中启用直接请求。

菜单:商店 => 配置。选择“CCCC配置” => Endereco地址验证 => “使用直接请求” => 是