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
AjaxSave.php
Go to the documentation of this file.
1
<?php
7
namespace
Magento\Tax\Controller\Adminhtml\Rate
;
8
9
use
Magento\Framework\Controller\ResultFactory
;
10
11
class
AjaxSave
extends
\Magento\Tax\Controller\Adminhtml\Rate
12
{
19
public
function
execute
()
20
{
21
try
{
22
$rateData = $this->
_processRateData
($this->
getRequest
()->getPostValue());
24
$taxRate
= $this->_taxRateConverter->populateTaxRateData($rateData);
25
$this->_taxRateRepository->save(
$taxRate
);
26
$responseContent = [
27
'success'
=>
true
,
28
'error_message'
=>
''
,
29
'tax_calculation_rate_id'
=>
$taxRate
->getId(),
30
'code'
=> htmlspecialchars(
$taxRate
->getCode()),
31
];
32
}
catch
(\
Magento
\Framework\Exception\LocalizedException $e) {
33
$responseContent = [
34
'success'
=>
false
,
35
'error_message'
=> $e->getMessage(),
36
'tax_calculation_rate_id'
=>
''
,
37
'code'
=>
''
,
38
];
39
}
catch
(\Exception $e) {
40
$responseContent = [
41
'success'
=>
false
,
42
'error_message'
=>
__
(
'We can\'t save this rate right now.'
),
43
'tax_calculation_rate_id'
=>
''
,
44
'code'
=>
''
,
45
];
46
}
47
49
$resultJson = $this->resultFactory->create(
ResultFactory::TYPE_JSON
);
50
$resultJson->setData($responseContent);
51
return
$resultJson;
52
}
53
}
Magento\Framework\Controller\ResultFactory\TYPE_JSON
const TYPE_JSON
Definition:
ResultFactory.php:22
Magento\Tax\Controller\Adminhtml\Rate\AjaxSave
Definition:
AjaxSave.php:11
Magento\Tax\Controller\Adminhtml\Rate\_processRateData
_processRateData($rateData)
Definition:
Rate.php:64
Magento\Framework\Controller\ResultFactory
Definition:
ResultFactory.php:17
__
__()
Definition:
__.php:13
Magento\Framework\App\Action\AbstractAction\getRequest
getRequest()
Definition:
AbstractAction.php:60
Magento\Framework\App\ActionInterface\execute
execute()
Magento\Tax\Controller\Adminhtml\Rate
Definition:
Rate.php:16
Magento
Magento\Tax\Controller\Adminhtml\Rate
Definition:
Add.php:7
$taxRate
$taxRate
Definition:
tax_rule.php:12