'Magento Attribute-Codes with Uppercase Letters need to work
Hello Guys,
is there any possibility to make the Magento 2 Import-Module uppercase insensitive?
I have attribute-codes like "ColorName" or "BaseColor" and I need them to be working. Right now the data in CSV-File is ignored by Magento for those attributes. The Problem is: I can not change them. There is too much code already written. So i really need magento to recognize uppercase attribute-codes. There is no other solution.
But, is this even possible?
Thanks!
Solution 1:[1]
Not sure if this helps, but the attribute code is comverted to lowercase in Magento\CatalogImportExport\Model\Import\Product::retrieveAttributeByCode.
the method looks like this
/**
* Retrieve attribute by code
*
* @param string $attrCode
* @return mixed
*/
public function retrieveAttributeByCode($attrCode)
{
/** @var string $attrCode */
$attrCode = mb_strtolower($attrCode);
if (!isset($this->_attributeCache[$attrCode])) {
$this->_attributeCache[$attrCode] = $this->getResource()->getAttribute($attrCode);
}
return $this->_attributeCache[$attrCode];
}
you can try to override the method and remove the $attrCode = mb_strtolower($attrCode); line or create an around plugin for it.
Solution 2:[2]
Had to run the command like this -> /home/ubuntu/.nvm/versions/node/v16.13.0/bin/pm2
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Marius |
| Solution 2 | labago |
