Description
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”.