当我将新产品模型导入Akeneo并想要更改家庭变体时,我得到以下消息:
15:25:11 WARNING [batch] The Pim\Component\Connector\Processor\Denormalization\ProductModelProcessor was unable to handle the following item:
[family_variant => name_of_family_variant]
(REASON: family_variant: Property "family_variant" cannot be modified, "name_of_family_variant" given.) [] []现在,我可以通过像这样扩展Pim\Component\Catalog\Updater\ProductModelUpdater来绕过这个异常:
/**
* @param ProductModelInterface $productModel
* @param array $data
* @param array $options
* @return $this|\Akeneo\Component\StorageUtils\Updater\ObjectUpdaterInterface
*/
public function update($productModel, array $data, array $options = [])
{
try {
return parent::update($productModel, $data, $options);
} catch (ImmutablePropertyException $exception) {
// Allow changing of the family_variant field for a product model
if ($exception->getPropertyName() === 'family_variant') {
if ($familyVariant = $this->familyVariantRepository->findOneByIdentifier($exception->getPropertyValue())) {
$productModel->setFamilyVariant($familyVariant);
}
}
return $this;
}
}但我想知道的是(也许Akeneo团队的某个人能回答这个问题)
发布于 2018-03-16 08:08:49
这个特性实际上存在于Akeneo待办事项中(但没有ETA )。
更改产品模型的家族变体是一种巨大的目录影响,需要进行大量检查:
由于所有这些原因,目前还不可能更新产品模型的系列变体。
https://stackoverflow.com/questions/48992287
复制相似问题