Magento 2:销售管理中的地址不完整

问题描述 投票:0回答:1

我使用的是magento的2.1.8版本,当我在销售管理部门收到带有长地址的订单时,“街道”字段将显示为40个字符。我已经通过配置设置了3条客户端地址行,它们可以正常工作,并且已保存在BBDD中,但在传递命令时将被剪切。

我已经检查过保存地址字段的数据库字段是否为255,所以我想这将是一些配置。有解决方案吗?

magento2 magento2.1
1个回答
0
投票

<< img src =“ https://image.soinside.com/eyJ1cmwiOiAiaHR0cHM6Ly9pLnN0YWNrLmltZ3VyLmNvbS85TndoZi5wbmcifQ==” alt =“在此处输入图像描述”>

表“ sales_order_address”中字段街道的类型为varchar(255),而结帐中的街道地址有3行。所以我认为255是3行的总字符。

第一个解决方案:设置输入字段街道地址的最大长度。

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”中的野外街道类型设置为文本

祝你好运!

© www.soinside.com 2019 - 2024. All rights reserved.