1

I am working on a Magento 2 website. I found that the boolean product attributes are not visible on the extra specifications tab on the product page. After a while, I ended up on the official github of Magento with this issue: https://github.com/magento/magento2/pull/8623

Based on that, it should have been fixed. In my case, it hasn't. So, I tried to apply the fix myself.

I went to

vendor\magento\magento-catalog\block\product\view\attributes.php

and changed the line 89 from:

if (is_string($value) && strlen($value)) {

to

if ($value instanceof Phrase || (is_string($value) && strlen($value))) {

Then I ran an upgrade on console: ./bin/magento setup:upgrade

But I still have the problem. Anyone was able to solve it?

P.S. Magento CE 2.1.6

  • Have you found any answer for this? I am also struggling to find a proper solution for this. Once you go to the admin and save the product value, then it appear in the Product Object but without that it does not appear. This is a huge issue when the default value is 1 for the boolean attribute. – MudithaE May 26 '17 at 3:40
0

I have posted my finding in https://github.com/magento/magento2/pull/8623. I am repeating the comment here as well.

In Related to community version 2.1.6 I think real reason for this kind of behaviour is lies in the logic of fetching attributes. vendor/magento/module-eav/Model/ResourceModel/ReadHandler.php

foreach ($connection->fetchAll($unionSelect) as $attributeValue) {
                if (isset($attributesMap[$attributeValue['attribute_id']])) {
                    $entityData[$attributesMap[$attributeValue['attribute_id']]] = $attributeValue['value'];
                } else {
                    $this->getLogger()->warning(
                        "Attempt to load value of nonexistent EAV attribute '{$attributeValue['attribute_id']}'
                        for entity type '$entityType'."
                    );
                }
            }

I think $attributesMap array should be the one that need to be loop. If the result from all $unionSelect doesn't have any value for the $attributesMap element, then it should fetch the default value for the attribute.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.