Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-tax
Controller
Adminhtml
Rate
AjaxLoad.php
Go to the documentation of this file.
1
<?php
8
namespace
Magento\Tax\Controller\Adminhtml\Rate
;
9
10
use
Magento\Framework\Exception\NoSuchEntityException
;
11
use
Magento\Framework\Controller\ResultFactory
;
12
13
class
AjaxLoad
extends
\Magento\Tax\Controller\Adminhtml\Rate
14
{
21
public
function
execute
()
22
{
23
$rateId = (int)$this->
getRequest
()->getParam(
'id'
);
24
try
{
25
/* @var \Magento\Tax\Api\Data\TaxRateInterface */
26
$taxRateDataObject = $this->_taxRateRepository->get($rateId);
27
/* @var array */
28
$resultArray = $this->_taxRateConverter->createArrayFromServiceObject($taxRateDataObject,
true
);
29
30
$responseContent = [
31
'success'
=>
true
,
32
'error_message'
=>
''
,
33
'result'
=> $resultArray,
34
];
35
}
catch
(
NoSuchEntityException
$e) {
36
$responseContent = [
37
'success'
=>
false
,
38
'error_message'
=> $e->getMessage(),
39
];
40
}
catch
(\Exception $e) {
41
$responseContent = [
42
'success'
=>
false
,
43
'error_message'
=>
__
(
'An error occurred while loading this tax rate.'
),
44
];
45
}
46
48
$resultJson = $this->resultFactory->create(
ResultFactory::TYPE_JSON
);
49
$resultJson->setData($responseContent);
50
return
$resultJson;
51
}
52
}
Magento\Framework\Controller\ResultFactory\TYPE_JSON
const TYPE_JSON
Definition:
ResultFactory.php:22
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
__
__()
Definition:
__.php:13
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
Magento\Tax\Controller\Adminhtml\Rate\AjaxLoad
Definition:
AjaxLoad.php:13
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Tax\Controller\Adminhtml\Rate
Definition:
Rate.php:16
Magento\Tax\Controller\Adminhtml\Rate
Definition:
Add.php:7
Magento\Framework\Exception\NoSuchEntityException
Definition:
NoSuchEntityException.php:16