通过在导入等级价格cvs文件后使用Magento 2.1.3,我无法再在后端编辑产品 . 后端的错误是
警告:第74行上的vendor / magento / module-catalog / Model / Product / Attribute / Backend / Tierprice.php中的非法字符串偏移'price_qty'
在报告中,我发现了25份报告,最新的报告是
#1 / vendor / magento / modulecatalog / Controller / Adminhtml / Product / Attribute / Validate.php(108):Magento \ Catalog \ Controller \ Adminhtml \ Product \ Attribute \ Validate-> checkUniqueOption(Object(Magento \ Framew ork \ DataObject) ),数组) .
有人可以帮我解决这个问题 . 非常感谢 . Tierprice.php
命名空间Magento \ Catalog \ Model \ Product \ Attribute \ Backend;
class Tierprice extends \ Magento \ Catalog \ Model \ Product \ Attribute \ Backend \ GroupPrice \ AbstractGroupPrice {
protected $_productAttributeBackendTierprice;
/**
* @param \Magento\Directory\Model\CurrencyFactory $currencyFactory
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
* @param \Magento\Catalog\Helper\Data $catalogData
* @param \Magento\Framework\App\Config\ScopeConfigInterface $config
* @param \Magento\Framework\Locale\FormatInterface $localeFormat
* @param \Magento\Catalog\Model\Product\Type $catalogProductType
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
* @param \Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $productAttributeTierprice
*/
public function __construct(
\Magento\Directory\Model\CurrencyFactory $currencyFactory,
\Magento\Store\Model\StoreManagerInterface $storeManager,
\Magento\Catalog\Helper\Data $catalogData,
\Magento\Framework\App\Config\ScopeConfigInterface $config,
\Magento\Framework\Locale\FormatInterface $localeFormat,
\Magento\Catalog\Model\Product\Type $catalogProductType,
\Magento\Customer\Api\GroupManagementInterface $groupManagement,
\Magento\Catalog\Model\ResourceModel\Product\Attribute\Backend\Tierprice $productAttributeTierprice
) {
$this->_productAttributeBackendTierprice = $productAttributeTierprice;
parent::__construct(
$currencyFactory,
$storeManager,
$catalogData,
$config,
$localeFormat,
$catalogProductType,
$groupManagement
);
}
protected function _getResource()
{
return $this->_productAttributeBackendTierprice;
}
protected function _getAdditionalUniqueFields($objectArray)
{
$uniqueFields = parent::_getAdditionalUniqueFields($objectArray);
$uniqueFields['qty'] = $objectArray['price_qty'] * 1;
return $uniqueFields;
}
protected function _getDuplicateErrorMessage()
{
return __('We found a duplicate website, tier price, customer group and quantity.');
}
protected function _isPriceFixed($priceObject)
{
return $priceObject->isTierPriceFixed();
}
public function isScalar()
{
return false;
}
}
2 回答
在产品保存时,我也遇到了层级定价的相同问题 . 我刚刚在使用它之前检查了$ objectArray ['price_qty']是否已设置并暂时解决了我的问题 . 但是,它暂时修复但现在可以使用
只需更换下面的功能
同
我在2.2.5 EE中遇到了同样的问题
按照这些步骤后,我设法解决了这个问题 .
https://github.com/magento/magento2/issues/8426
备份数据库(可选)
找到您的"tier_price"属性ID(商店 - >属性 - >产品 - >搜索"tier_price")或从eav_attribute表中找到
使用tier_price属性的attribute_id搜索catalog_product_entity_decimal,catalog_product_entity_int,catalog_product_entity_text和catalog_product_entity_varchar .
删除这些行
尝试再次保存产品 .