Skip to content

Commit 1184fb8

Browse files
author
Serhiy Shkolyarenko
committed
MAGETWO-32010: Catalog product model and tables cleaning
fixed logic on save controller
1 parent 84dc765 commit 1184fb8

File tree

1 file changed

+5
-1
lines changed
  • app/code/Magento/Catalog/Controller/Adminhtml/Product

1 file changed

+5
-1
lines changed

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ public function execute()
6363
$storeId = $this->getRequest()->getParam('store');
6464
$redirectBack = $this->getRequest()->getParam('back', false);
6565
$productId = $this->getRequest()->getParam('id');
66+
$resultRedirect = $this->resultRedirectFactory->create();
6667

6768
$data = $this->getRequest()->getPost();
6869
if ($data) {
@@ -121,9 +122,12 @@ public function execute()
121122
$this->_session->setProductData($data);
122123
$redirectBack = $productId ? true : 'new';
123124
}
125+
} else {
126+
$resultRedirect->setPath('catalog/*/', ['store' => $storeId]);
127+
$this->messageManager->addError('No data to save');
128+
return $resultRedirect;
124129
}
125130

126-
$resultRedirect = $this->resultRedirectFactory->create();
127131
if ($redirectBack === 'new') {
128132
$resultRedirect->setPath(
129133
'catalog/*/new',

0 commit comments

Comments
 (0)