1

我以编程方式向 Prestashop 1.6 添加属性,如下所示:

$newGroup = new AttributeGroup();
$newGroup->name = $this->createMultiLangField('test');
$newGroup->public_name = $this->createMultiLangField('test');
$newGroup->group_type = 'select';
$newGroup->add();

$newAttribute = new Attribute();
$newAttribute->name = $this->createMultiLangField('test');
$newAttribute->id_attribute_group = $newGroup->id;
$newAttribute->add();

当我查看我的目录时,这个属性和它的组就在那里,一切似乎都井井有条。但是,当我在执行此操作后单击我的任何产品上的组合时,ajax 加载程序会无限旋转(我无法再在我的任何产品上创建组合)。有没有人经历过这样的事情?

4

1 回答 1

4

代码应该是:

$newGroup = new AttributeGroup();
$newGroup->name = $this->createMultiLangField('test');
$newGroup->public_name = $this->createMultiLangField('test');
$newGroup->group_type = 'select';
$newGroup->add();

$newAttribute = new Attribute();
$newAttribute->name = $this->createMultiLangField('test');
$newAttribute->id_attribute_group = $newGroup->id;
$newAttribute->add();
于 2014-07-16T23:49:43.223 回答