magento2: Product resource getAttributeRawValue function does not return anything if there is no default value

Preconditions

  1. Magento 2.2.4
  2. PHP 7.1.17

Steps to reproduce

  1. Create a storeview EN
  2. Create a storeview FR
  3. Create a dropdown attribute with some values
  4. Change this attribute value on EN view
  5. Use getAttributeRawValue() to retrieve it, ie
$product->getResource()->getAttributeRawValue($product->getId(), 'attribute_code', $this->_storeManager->getStore()->getId());

Expected result

  1. Value is returned

Actual result

  1. No value is returned because there is no value in default store (store 0).

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (13 by maintainers)

Most upvoted comments

@orlangur no it’s not. It’s not related to the session or translation, the SQL request done by getAttributeRawValue is assuming there is a value for the store 0, but it’s not always the case.