Skip to content

Commit

Permalink
Merge branch 'feature/101741' into test/stage
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Ortega committed Sep 15, 2023
2 parents 5d099e9 + 93e0543 commit 9d189b8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Updated eslint version to `8.45.0` and `eslint-plugin-vue` to 9.15.1 (DEV-95002)
### Fixed
- Mobile nav sidebar (DEV-101802)
- Category Child and CMS block nodes shouldn't have image fields (DEV-94387)
## [2.23.1] - 2023-07-28
### Fixed
- Fixed issue with closing } missing
Expand Down
15 changes: 9 additions & 6 deletions Controller/Adminhtml/Menu/ImportCategories.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

namespace Snowdog\Menu\Controller\Adminhtml\Menu;

use Exception;
use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Backend\App\Action;
use Magento\Backend\App\Action\Context;
use Magento\Framework\Controller\Result\JsonFactory;
use Snowdog\Menu\Api\MenuManagementInterface;
use Magento\Framework\Exception\NoSuchEntityException;

class ImportCategories extends Action implements HttpPostActionInterface
{
Expand Down Expand Up @@ -47,24 +47,27 @@ public function execute()
{
$categoryId = (int) $this->_request->getParam('category_id');
$depth = $this->_request->getParam('depth');
if (!is_numeric($depth)) {
$depth = null;
}

$result = $this->resultJsonFactory->create();
try {
if (!is_numeric($depth)) {
throw new Exception('Please add a valid number for Level of depth field');
}

$categoryTree = $this->menuManagement->getCategoryNodeList($categoryId, $depth);

$output = [
'success' => 1,
'list' => $categoryTree
];
} catch (NoSuchEntityException $exception) {
} catch (Exception $exception) {
$output = [
'success' => 0,
'message' => $exception->getMessage(),
'list' => []
];
}

$result = $this->resultJsonFactory->create();
$result->setData($output);

return $result;
Expand Down

0 comments on commit 9d189b8

Please sign in to comment.