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

Unable to get product attribute value for store-view scope type in product collection loaded for a specific store. #18374

Closed
milindsingh opened this issue Oct 4, 2018 · 10 comments
Labels
Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release

Comments

@milindsingh
Copy link
Member

milindsingh commented Oct 4, 2018

Preconditions

  1. Product has a user defined attribute with scope : store-view. Created via:
`/** @var \Magento\Eav\Setup\EavSetup $eavSetup */`
`
$eavSetup->addAttribute(
                    'catalog_product',
                   'ced_profile_id',
                    [
                        'group' => $groupName,
                        'note' => 'Profile Id',
                        'input' => 'text',
                        'type' => 'varchar',
                        'label' => 'Profile Id ',
                        'backend' => '',
                        'visible' => 1,
                        'required' => 0,
                        'sort_order' => 1,
                        'user_defined' => 1,
                        'comparable' => 0,
                        'visible_on_front' => 0,
                        'global' => \Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface::SCOPE_STORE,
                    ]
                );
`
 
  1. Magento is setup with 2 store configuration. [Default Store & My Store]
  2. Attribute ced_profile_id has value 'blank' in All Store Views ( i.e. for Admin store ID - 0), and value '2' for Default Store ( i.e. ID - 1).
  3. On loading product collection with following code:
    $storeId = 1; \** @var Magento\Catalog\Model\ResourceModel\Product\Collection $collection **\ $collection->setStoreId($storeId); $collection->addAttributeToSelect(['ced_profile_id']); $products = $collection->getData();
  4. Environment:
  • Magento CE 2.2.5
  • PHP 7.09
  • MYSQL 5.7

Steps to reproduce

  1. Create a store-wise user-defined attribute.
  2. Have blank value for admin store (i.e. all store views, ID - 0). and Have 'some value' for Default Store i.e. ID - 1.
  3. Load Product collection by setting store id - 1, will get no values for default store - 1 for store -wise user defined attributes.

Expected result

1.$products have 2 attribute for 'ced_profile_id'.

Actual result

  1. $products have null attribute for 'ced_profile_id'.
  2. The Product collection final get SQL query search for Null value in admin store, while there is no row in admin store entity table for blank values. Add a row with null value for admin store and I am able to get the default store values.
    2018-10-04-132110_1366x768_scrot
    In above image, entity_id 2,3,4 have null values for admin store - 0 and collection can get the default store values.
    While entity_id 1 don't have a row in catalog_product_entity_varchar, hence I am not able to get values in product collection for store id 1 i.e. Default Store .
@magento-engcom-team
Copy link
Contributor

Hi @milindsingh. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@milindsingh do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@magento-engcom-team magento-engcom-team added the Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed label Oct 4, 2018
@milindsingh
Copy link
Member Author

@magento-engcom-team give me 2.2.5 instance

@magento-engcom-team
Copy link
Contributor

Hi @milindsingh. Thank you for your request. I'm working on Magento 2.2.5 instance for you

@magento-engcom-team
Copy link
Contributor

Hi @milindsingh, here is your Magento instance.
Admin access: https://i-18374-2-2-5.engcom.dev.magento.com/admin
Login: admin Password: 123123q
Instance will be terminated in up to 3 hours.

@milindsingh
Copy link
Member Author

milindsingh commented Oct 4, 2018

In above Magento Instance (https://i-18374-2-2-5.engcom.dev.magento.com/),
I have created a custom attribute ced_profile_id with Store-View Scope and created a product with SKU: Test Product.

  • The Product SKU: Test Product has blank value in All Store Views and 2. Screen Shot attached below.
    test product products inventory catalog magento admin
  • The Catalog Product grid is added with 2 filters, store filter with value "Default Store View" and "Profile Id" (my created attribute) with value "2", but grid has no results which conflicts the first image.
    products inventory catalog magento admin 1

@milindsingh milindsingh changed the title Unable to get product attribute value for store-wise type after save. Unable to get product attribute value for store-view scope type in product collection loaded for a specific store. Oct 4, 2018
@milindsingh
Copy link
Member Author

milindsingh commented Oct 12, 2018

@magento-engcom-team

Hi @milindsingh. Thank you for your report.
To help us process this issue please make sure that you provided the following information:

  • Summary of the issue
  • Information on your environment
  • Steps to reproduce
  • Expected and actual results

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento-engcom-team give me $VERSION instance

where $VERSION is version tags (starting from 2.2.0+) or develop branches (for example: 2.3-develop).
For more details, please, review the Magento Contributor Assistant documentation.

@milindsingh do you confirm that you was able to reproduce the issue on vanilla Magento instance following steps to reproduce?

  • yes
  • no

@ghost ghost self-assigned this Oct 24, 2018
@magento-engcom-team
Copy link
Contributor

magento-engcom-team commented Oct 24, 2018

Hi @engcom-backlog-nazar. Thank you for working on this issue.
In order to make sure that issue has enough information and ready for development, please read and check the following instruction: 👇

  • 1. Verify that issue has all the required information. (Preconditions, Steps to reproduce, Expected result, Actual result).

    DetailsIf the issue has a valid description, the label Issue: Format is valid will be added to the issue automatically. Please, edit issue description if needed, until label Issue: Format is valid appears.

  • 2. Verify that issue has a meaningful description and provides enough information to reproduce the issue. If the report is valid, add Issue: Clear Description label to the issue by yourself.

  • 3. Add Component: XXXXX label(s) to the ticket, indicating the components it may be related to.

  • 4. Verify that the issue is reproducible on 2.3-develop branch

    Details- Add the comment @magento-engcom-team give me 2.3-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.3-develop branch, please, add the label Reproduced on 2.3.x.
    - If the issue is not reproducible, add your comment that issue is not reproducible and close the issue and stop verification process here!

  • 5. Verify that the issue is reproducible on 2.2-develop branch.

    Details- Add the comment @magento-engcom-team give me 2.2-develop instance to deploy test instance on Magento infrastructure.
    - If the issue is reproducible on 2.2-develop branch, please add the label Reproduced on 2.2.x

  • 6. Add label Issue: Confirmed once verification is complete.

  • 7. Make sure that automatic system confirms that report has been added to the backlog.

@ghost ghost added the Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed label Oct 24, 2018
@ghost ghost added the Component: Catalog label Oct 31, 2018
@ghost ghost added Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed labels Nov 6, 2018
@magento-engcom-team
Copy link
Contributor

@engcom-backlog-nazar Thank you for verifying the issue. Based on the provided information internal tickets MAGETWO-96206, MAGETWO-96207 were created

@magento-engcom-team magento-engcom-team added the Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development label Nov 8, 2018
@ghost ghost removed their assignment Nov 8, 2018
@magento-engcom-team
Copy link
Contributor

Hi @milindsingh. Thank you for your report.
The issue has been fixed in #19911 by @shikhamis11 in 2.2-develop branch
Related commit(s):

The fix will be available with the upcoming 2.2.8 release.

@magento-engcom-team magento-engcom-team added the Fixed in 2.2.x The issue has been fixed in 2.2 release line label Jan 2, 2019
@magento-engcom-team magento-engcom-team added the Fixed in 2.3.x The issue has been fixed in 2.3 release line label Feb 24, 2019
@magento-engcom-team
Copy link
Contributor

Hi @milindsingh. Thank you for your report.
The issue has been fixed in #20071 by @shikhamis11 in 2.3-develop branch
Related commit(s):

The fix will be available with the upcoming 2.3.2 release.

magento-engcom-team pushed a commit that referenced this issue Feb 24, 2019
Fixed issue - #18374
Unable to get product attribute value for store-view scope type in product collection loaded for a specific store.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Fixed in 2.2.x The issue has been fixed in 2.2 release line Fixed in 2.3.x The issue has been fixed in 2.3 release line Issue: Clear Description Gate 2 Passed. Manual verification of the issue description passed Issue: Confirmed Gate 3 Passed. Manual verification of the issue completed. Issue is confirmed Issue: Format is valid Gate 1 Passed. Automatic verification of issue format passed Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Reproduced on 2.2.x The issue has been reproduced on latest 2.2 release Reproduced on 2.3.x The issue has been reproduced on latest 2.3 release
Projects
None yet
Development

No branches or pull requests

2 participants