服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > php教程 > magento教程 >

自动填写Magento进货地址字段

时间:2016-10-22 16:30来源:未知 作者:最模板 点击:
自动填写Magento进货地址字段,在这种情况下,你需要为这个插件。 创建di.xml[Vendor/Module/etc/frontend/di.xml] ?xml version=1.0?config xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:noNamespaceSchemaLocation

自动填写Magento进货地址字段,在这种情况下,你需要为这个插件。

创建di.xml [Vendor/Module/etc/frontend/di.xml]

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
 </config>

 

创建LayoutProcessor.php [Vendor/Module/Plugin/Checkout/Model/Checkout/LayoutProcessor.php]

namespace Vendor\Module\Plugin\Checkout\Model\Checkout;


class LayoutProcessor
{
    /**
     * @param \Magento\Checkout\Block\Checkout\LayoutProcessor $subject
     * @param array $jsLayout
     * @return array
     */
    public function afterProcess(
        \Magento\Checkout\Block\Checkout\LayoutProcessor $subject,
        array  $jsLayout
    ) {
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['firstname']['value'] = 'FirstName';

        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
        ['shippingAddress']['children']['shipping-address-fieldset']['children']['company']['value'] = 'Demo Company';
        return $jsLayout;
    }
}

(责任编辑:最模板)
顶一下
(0)
0%
踩一下
(0)
0%
------分隔线----------------------------
栏目列表
热点内容