有没有办法通过几个选择来过滤选择值。过滤在字段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;