我使用的是magento 2.1.8版本,当我在销售管理中收到带有长地址的订单时,“街道”字段显示为40个字符。我已经通过配置设置了3个客户端地址线,它们工作正常,并保存在BBDD ok中,但当通过命令时,它们会被切断。
我已经检查了保存address字段的数据库字段是255,所以我认为这是一些配置。有什么解决方案吗?
发布于 2020-03-12 12:35:26

表"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_length" => 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_length" => 1, "max_text_length" => 50],
]
]
];
return $jsLayout;
}
}第二种解决方案:将表"sales_order_address“中字段street的类型设置为text
祝你好运!
https://stackoverflow.com/questions/60640231
复制相似问题