Magento 2: неполный адрес в управлении продажами - PullRequest
0 голосов
/ 11 марта 2020

Я использую magento версии 2.1.8, и когда я получаю заказы с длинными адресами в администрации продаж, поле "улица" появляется сокращенным до 40 символов. Я установил 3 строки адреса клиента по конфигурации, которая работает правильно, и они сохраняются в B BDD хорошо, но при прохождении заказа они обрезаются.

Я проверил, что поле базы данных, где поле адреса сохранено 255, так что я предполагаю, что это будет какая-то конфигурация. Любое решение?

1 Ответ

0 голосов
/ 12 марта 2020

enter image description here

Тип поля улицы в таблице "sales_order_address" - varchar (255), а адрес улицы в кассе имеет 3 строки. Поэтому я думаю, что 255 - это общий символ в 3 строки.

Первое решение: установить максимальную длину для поля ввода Street Address.

magento \ app \ code \ Custom \ Checkout \ etc \ 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">
    <type name="Magento\Checkout\Block\Checkout\LayoutProcessor">
        <plugin name="Custom_Checkout" type="Custom\Checkout\Block\LayoutProcessor" sortOrder="100"/>
    </type>
</config>

magento \ app \ code \ Custom \ Checkout \ Block \ LayoutProcessor. php

namespace Custom\Checkout\Block;

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']['street'] = [
            'component' => 'Magento_Ui/js/form/components/group',
            'label' => __('Street Address'),
            'required' => true,
            'dataScope' => 'shippingAddress.street',
            'provider' => 'checkoutProvider',
            'sortOrder' => 60,
            'type' => 'group',
            'children' => [
                    [
                    'component' => 'Magento_Ui/js/form/element/abstract',
                    'config' => [
                        'customScope' => 'shippingAddress',
                        'template' => 'ui/form/field',
                        'elementTmpl' => 'ui/form/element/input'
                    ],
                    'dataScope' => '0',
                    'provider' => 'checkoutProvider',
                    'validation' => ['required-entry' => true, "min_text_len‌​gth" => 1, "max_text_length" => 50],
                ],
                    [
                    'component' => 'Magento_Ui/js/form/element/abstract',
                    'config' => [
                        'customScope' => 'shippingAddress',
                        'template' => 'ui/form/field',
                        'elementTmpl' => 'ui/form/element/input'
                    ],
                    'dataScope' => '1',
                    'provider' => 'checkoutProvider',
                    'validation' => ['required-entry' => false, "min_text_len‌​gth" => 1, "max_text_length" => 50],
                ]
            ]
        ];
        return $jsLayout;
    }

}

Второе решение: установить тип поля улицы в таблице «sales_order_address» на текст

Goodluck!

...