Skip to content

Commit bcf7d9c

Browse files
committed
MAGETWO-98357: The required product attribute is not displayed when change attribute set
1 parent f14ffca commit bcf7d9c

File tree

1 file changed

+6
-3
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Product

1 file changed

+6
-3
lines changed

app/code/Magento/Catalog/Controller/Adminhtml/Product/Builder.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\Catalog\Controller\Adminhtml\Product;
99

10+
use Magento\Catalog\Api\Data\ProductInterface;
1011
use Magento\Catalog\Model\ProductFactory;
1112
use Magento\Cms\Model\Wysiwyg as WysiwygModel;
1213
use Magento\Framework\App\RequestInterface;
@@ -86,11 +87,11 @@ public function __construct(
8687
* Build product based on user request
8788
*
8889
* @param RequestInterface $request
89-
* @return \Magento\Catalog\Model\Product
90+
* @return ProductInterface
9091
* @throws \RuntimeException
9192
* @throws \Magento\Framework\Exception\LocalizedException
9293
*/
93-
public function build(RequestInterface $request): Product
94+
public function build(RequestInterface $request): ProductInterface
9495
{
9596
$productId = (int) $request->getParam('id');
9697
$storeId = $request->getParam('store', 0);
@@ -100,7 +101,9 @@ public function build(RequestInterface $request): Product
100101
if ($productId) {
101102
try {
102103
$product = $this->productRepository->getById($productId, true, $storeId);
103-
$product->setAttributeSetId($attributeSetId);
104+
if ($attributeSetId) {
105+
$product->setAttributeSetId($attributeSetId);
106+
}
104107
} catch (\Exception $e) {
105108
$product = $this->createEmptyProduct(ProductTypes::DEFAULT_TYPE, $attributeSetId, $storeId);
106109
$this->logger->critical($e);

0 commit comments

Comments
 (0)