Magento 2 checkout选择下拉过滤器

时间:2017-01-10 09:52:25

标签: checkout magento2

有没有办法通过几个选择来过滤选择值。过滤在字段city上完成。我想对字段city和运营商名称执行过滤。

我在layoutProcessor.php中的代码:

$customAttributeCode = 'carrier_type';
        $customField = [
            'component' => 'Magento_Ui/js/form/element/select',
            'config' => [
                'customScope' => 'shippingAddress.custom_attributes',
                'customEntry' => null,
                'template' => 'ui/form/field',
                'elementTmpl' => 'ui/form/element/select'
            ],
           'dataScope' => 'shippingAddress.custom_attributes' . '.' . $customAttributeCode,
            'label' => 'Carrier type',
            'provider' => 'checkoutProvider',
            'sortOrder' => 118,
            'validation' => [
                'required-entry' => false
            ],
            'filterBy' => [
                'target' => '${ $.provider }:shippingAddress.city',
                'field' => 'city'
            ],

            'options' => [
                [
                    'value' => '',
                    'label' => 'Please select',
                ],
                [
                    'value' => 'courier',
                    'title' => 'Courier',
                    'label' => __('Courier'),
                    'city' => 'KI'
                ],
                [
                    'value' => 'pickup',
                    'title' => 'Pickup',
                    'label' => __('Pickup'),
                    'city' => 'KH'
                ]
            ],
            'visible' => true,
        ];
        $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']
        ['children']['shippingAddress']['children']['QMage_Shipping']['children'][$customAttributeCode] = $customField;

0 个答案:

没有答案