Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento2 如何以编程方式更新属性前端标签?_Magento2 - Fatal编程技术网

Magento2 如何以编程方式更新属性前端标签?

Magento2 如何以编程方式更新属性前端标签?,magento2,Magento2,如何以编程方式更新属性前端标签 $attributeModel = \Magento\Framework\App\ObjectManager::getInstance() ->get(\Magento\Eav\Model\Attribute::class)->load($id); ... 我找到了解决方案: $attributeModel = \Magento\Framework\App\ObjectManager::getInstance() -&g

如何以编程方式更新属性前端标签

 $attributeModel = \Magento\Framework\App\ObjectManager::getInstance()
        ->get(\Magento\Eav\Model\Attribute::class)->load($id);

 ...

我找到了解决方案:

$attributeModel = \Magento\Framework\App\ObjectManager::getInstance()
    ->get(\Magento\Eav\Model\Attribute::class)
    ->load($id);
  $storeLabels = $attributeModel->getStoreLabels();
  $storeLabels[$storeId] = $labelTitle;
  $attributeModel->setStoreLabels($storeLabels);

  \Magento\Framework\App\ObjectManager::getInstance()
     ->get($attributeModel->getResourceName())
     ->save($attributeModel);