Prestashop名称验证和修复

时间:2017-10-28 13:49:24

标签: validation prestashop prestashop-1.6

我在prestashop 1.6中遇到了自己的csv导入程序问题。我的产品名称如下所示:2=1 2 battery& 1 pilot )

Presta验证会收到我的错误:Property Product->name is not valid

你知道吗,我必须如何转换presta验证不会让我错误的名字?

我的代码视图如下:

$object                     = new Product();
$object->price              = number_format($data[$row_header['recommended_selling_price']] * $rate, 2,".","");
$object->id_tax_rules_group = $taxID;

$languages=Language::getLanguages();
foreach($languages as $lang){
    $object->name[$lang['id_lang']]=$namecache;
    $object->link_rewrite[$lang['id_lang']]= $this->slugify($namecache);
    $object->description[$lang['id_lang']]=$data[$row_header['detailed_full_text_en']];
    $object->description_short[$lang['id_lang']]=substr($data[$row_header['full_text_EN']], 0, 800);
}

1 个答案:

答案 0 :(得分:-1)

实际上你可以通过转义或转换字符串来解决问题:

$object->name[$lang['id_lang']] = utf8_encode($namecache);