-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Closed
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release
Description
When I tried to update a custom attribute from an existing product using the save method in the ProductRepositoryInterface the code don't throw any errors but the attribute remains with the old data.
Preconditions
- Magento 2.1.8
- PHP 7.0
Steps to reproduce
- namespace Vendor\Module\Cron;
- use Magento\Catalog\Api\ProductRepositoryInterface;
- use Magento\CatalogInventory\Api\StockRegistryInterface;
- class CronDownloadData
- {
-
protected $productRepository;
- protected $stockRegistry;
-
public function __construct(
-
SunskyProductRepositoryInterface $repository,
-
DirectoryList $directoryList,
-
ProductRepositoryInterface $productRepository,
-
StockRegistryInterface $stockRegistry
- ) {
-
$this->productRepository = $productRepository;
-
$this->stockRegistry = $stockRegistry;
-
}
- public function updateLocalProduct($modelObj){
-
try {
-
$local_product = $this->productRepository->get($modelObj->getItem_no());
-
$local_product->setCustomAttribute('description', 'Some description');
-
$this->productRepository->save($local_product);
-
} catch (\Exception $ex){
-
// nothing to do this time;
-
}
-
}
- }
Expected result
- The existing product shows the new description.
Actual result
- Description not update at all
Metadata
Metadata
Assignees
Labels
Fixed in 2.2.xThe issue has been fixed in 2.2 release lineThe issue has been fixed in 2.2 release lineIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedGate 2 Passed. Manual verification of the issue description passedIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedGate 1 Passed. Automatic verification of issue format passedIssue: Ready for WorkGate 4. Acknowledged. Issue is added to backlog and ready for developmentGate 4. Acknowledged. Issue is added to backlog and ready for developmentReproduced on 2.1.xThe issue has been reproduced on latest 2.1 releaseThe issue has been reproduced on latest 2.1 releaseReproduced on 2.2.xThe issue has been reproduced on latest 2.2 releaseThe issue has been reproduced on latest 2.2 releaseReproduced on 2.3.xThe issue has been reproduced on latest 2.3 releaseThe issue has been reproduced on latest 2.3 release