Prestashop 1.6 扩展产品特征值的最大尺寸
Prestashop 1.6 extend max size of product feature value
这是我关于 Whosebug 的第一个问题 :)
我需要导入一个产品特征值超过 128 个字符的 csv 文件。如何在 prestashop 1.6 中扩展产品特征值的最大大小?
特征值字段的长度应为 255
个字符,除非您使用某些特殊字符或不同的编码。
无论如何,
根据您的喜好更改 ps_feature_value_lang
table 中的列类型,
然后覆盖 FeatureValue.php
class。在 override/classes/FeatureValue.php
和此文件内创建一个文件:
class FeatureValue extends FeatureValueCore
{
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'feature_value',
'primary' => 'id_feature_value',
'multilang' => true,
'fields' => array(
'id_feature' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'custom' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
'value' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
),
);
}
修改 'size' => 255
以匹配数据库列。
这是我关于 Whosebug 的第一个问题 :) 我需要导入一个产品特征值超过 128 个字符的 csv 文件。如何在 prestashop 1.6 中扩展产品特征值的最大大小?
特征值字段的长度应为 255
个字符,除非您使用某些特殊字符或不同的编码。
无论如何,
根据您的喜好更改 ps_feature_value_lang
table 中的列类型,
然后覆盖 FeatureValue.php
class。在 override/classes/FeatureValue.php
和此文件内创建一个文件:
class FeatureValue extends FeatureValueCore
{
/**
* @see ObjectModel::$definition
*/
public static $definition = array(
'table' => 'feature_value',
'primary' => 'id_feature_value',
'multilang' => true,
'fields' => array(
'id_feature' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'custom' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
'value' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
),
);
}
修改 'size' => 255
以匹配数据库列。