Skip to content

Commit 2546e77

Browse files
committed
MAGETWO-93807: [Forwardport] Some improvements on product create|edit page in admin area
1 parent 77ff046 commit 2546e77

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

app/code/Magento/Catalog/Model/ProductRepository.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,21 @@ public function get($sku, $editMode = false, $storeId = null, $forceReload = fal
235235
$cacheKey = $this->getCacheKey([$editMode, $storeId]);
236236
$cachedProduct = $this->getProductFromLocalCache($sku, $cacheKey);
237237
if ($cachedProduct === null || $forceReload) {
238+
$product = $this->productFactory->create();
239+
238240
$productId = $this->resourceModel->getIdBySku($sku);
239241
if (!$productId) {
240242
throw new NoSuchEntityException(
241243
__("The product that was requested doesn't exist. Verify the product and try again.")
242244
);
243245
}
244-
245-
$product = $this->getById($productId, $editMode, $storeId, true);
246-
246+
if ($editMode) {
247+
$product->setData('_edit_mode', true);
248+
}
249+
if ($storeId !== null) {
250+
$product->setData('store_id', $storeId);
251+
}
252+
$product->load($productId);
247253
$this->cacheProduct($cacheKey, $product);
248254
$cachedProduct = $product;
249255
}

0 commit comments

Comments
 (0)