Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed store get attribute raw value #1034

Merged
merged 2 commits into from
Jun 24, 2020
Merged

Fixed store get attribute raw value #1034

merged 2 commits into from
Jun 24, 2020

Conversation

midlan
Copy link
Contributor

@midlan midlan commented Jun 9, 2020

My collegue found another bug in method getAttributeRawValue. It retured values for other attributes when passed array of attributes to second parameter $attribute and store value does not exist for some of the attributes.

@tmotyl
Copy link
Contributor

tmotyl commented Jun 9, 2020

Can you describe steps how can I test it? (even if it requires an xdebug session)

@kiatng
Copy link
Contributor

kiatng commented Jun 9, 2020

I tested with

$result = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue(
    1,
    [74,99,98],
    0
);

The result is the same for the existing code and the modified code:

 array(3) {
  ["description"] => string(38) "Product Description"
  ["url_key"] => string(31) "product-description"
  ["status"] => string(1) "2"
}

@sreichel sreichel added the Component: Catalog Relates to Mage_Catalog label Jun 9, 2020
@tmotyl
Copy link
Contributor

tmotyl commented Jun 9, 2020

Thanks @kiatng. I would also like to tests the case which was broken before and now is fixed.

@kiatng
Copy link
Contributor

kiatng commented Jun 10, 2020

I managed to replicate the bug. As per description:

... and store value does not exist for some of the attributes.

Test code:

$result =$result = Mage::getResourceSingleton('catalog/product')->getAttributeRawValue(
    1,
    [74,99,98,'custom_layout_update'],
    2
);

Test result with code in the PR:

 array(4) {
  ["description"] => string(19) "Product Description"
  ["custom_layout_update"] => string(22) "<!-- custom design -->"
  ["url_key"] => string(19) "product-description"
  ["status"] => string(1) "2"
}

Test result with core code:

 array(4) {
  ["description"] => string(22) "<!-- custom design -->"
  ["custom_layout_update"] => string(22) "<!-- custom design -->"
  ["url_key"] => string(19) "product-description"
  ["status"] => string(1) "2"
}

The PR is correct.

A screenshot from PMA can shed more light:

image

Copy link
Contributor

@kiatng kiatng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can replicate the bug and this PR indeed fixes it.

@midlan
Copy link
Contributor Author

midlan commented Jun 10, 2020

@kiatng yes thats the usage which is buggy, with different store than default 0, I am talking about

@tmotyl tmotyl merged commit e61cd64 into OpenMage:1.9.4.x Jun 24, 2020
@sreichel sreichel added this to the Release 19.4.4 milestone Jun 26, 2020
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Aug 20, 2020
…called for multiple attributes and non-admin store

If some attributes don't have a value for the requested store view values
from other attributes are returned.
edannenberg pushed a commit to edannenberg/magento-lts that referenced this pull request Aug 24, 2020
…called for multiple attributes and non-admin store

If some attributes don't have a value for the requested store view values
from other attributes are returned.
@midlan midlan deleted the fixed_store_getAttributeRawValue branch September 1, 2020 21:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Component: Catalog Relates to Mage_Catalog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants