Skip to content

Use command update product and category will add store id 1 data #37221

Open
@yihang861

Description

@yihang861

Preconditions and environment

  • Magento version
  • Anything else that would help a developer reproduce the bug
    magento2.4.4

Steps to reproduce

1 create a new command update product and setCategoryIds
protected function execute(InputInterface $input, OutputInterface $output)
{
$this->appState->setAreaCode('frontend');
$this->areaList->getArea(Area::AREA_FRONTEND)->load(Area::PART_TRANSLATE);
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$storeManager = $objectManager->get('\Magento\Store\Model\StoreManagerInterface');
$storeId = $storeManager->getStore()->getStoreId();
$productCollectionFactory = $objectManager->get('\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory');
$collection = $productCollectionFactory->create();
$collection->addAttributeToFilter('sku', 'test product 1');
$collection->addAttributeToSelect('*');
foreach ($collection as $product)
{
$product->setData('name', 'test update product name 0001');
$product->setCategoryIds(['3']);
$product->save();
echo "Product Updated". $product->getId().' storeId:'.$storeId;
}
}

2 execute command
3 will update store_id 1 data ,admin default scope can not see the data change
4 frontend product data changed .
5 table catalog_category_entity_varchar add data with store id = 1
SELECT * FROM catalog_category_entity_varchar WHERE store_id = 1
6 if change product data in magento backend default scope , frontend data can not update any more.

Expected result

use command change product and category data with store id 0

Actual result

in admin backend need change store scope can see the data change.
in default scope can not see the change data.
and in catalog_category_entity_varchar table will add data with store id = 1

Additional information

No response

Release note

No response

Triage and priority

  • Severity: S0 - Affects critical data or functionality and leaves users without workaround.
  • Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
  • Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
  • Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
  • Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: CatalogComponent: ConsoleIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P2A defect with this priority could have functionality issues which are not to expectations.Progress: ready for devReported on 2.4.4Indicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branchTriage: Dev.ExperienceIssue related to Developer Experience and needs help with Triage to Confirm or Reject it

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions