Prestashop 1.6 扩展产品特征值的最大尺寸 [英] Prestashop 1.6 extend max size of product feature value

查看:47
本文介绍了Prestashop 1.6 扩展产品特征值的最大尺寸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我关于 stackoverflow 的第一个问题 :)我需要导入产品功能值超过 128 个字符的 csv 文件.如何在 prestashop 1.6 中扩展产品特征值的最大大小?

This is my first question on stackoverflow :) I need to import a csv file with product features values longer than 128 characters. How can I extend the maximum size of product features values in prestashop 1.6?

推荐答案

特征值字段的长度应该是 255 个字符,除非您使用了一些特殊字符或不同的编码.

The feature value field should be 255 characters long, unless you are using some special characters or different encoding.

无论如何,将 ps_feature_value_lang 表中的列类型更改为您的首选项,

Anyway, change the column type in ps_feature_value_lang table to your preference,

然后覆盖 FeatureValue.php 类.在 override/classes/FeatureValue.php 和这个文件里面创建一个文件:

Then make an override for FeatureValue.php class. Make a file at override/classes/FeatureValue.php and inside this file:

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 匹配 db 列.

Modify 'size' => 255 to match the db column.

这篇关于Prestashop 1.6 扩展产品特征值的最大尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆