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-checkout
Controller
ShippingRates
Index.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Checkout\Controller\ShippingRates
;
7
8
use
Magento\Framework\App\Action
;
9
use
Magento\Framework\App\Action\Context
;
10
use
Magento\Framework\App\RequestInterface
;
11
use
Magento\Framework\App\ResponseInterface
;
12
13
class
Index
extends
\Magento\Framework\App\Action\Action
14
{
18
protected
$result
;
19
23
protected
$checkoutSession
;
24
30
public
function
__construct
(
31
Context
$context,
32
\
Magento
\Checkout\Model\
Session
$session
33
) {
34
$this->checkoutSession =
$session
;
35
parent::__construct($context);
36
}
37
44
public
function
execute
()
45
{
46
$quote
= $this->checkoutSession->getQuote();
47
$address
=
$quote
->getShippingAddress();
48
$address
->collectShippingRates()->save();
49
$rates
=
$address
->getGroupedAllShippingRates();
50
$result
= $this->resultFactory->create(\
Magento
\Framework\Controller\
ResultFactory::TYPE_JSON
);
51
$result
->setData(
$rates
);
52
return
$result
;
53
}
54
}
Magento\Framework\Controller\ResultFactory\TYPE_JSON
const TYPE_JSON
Definition:
ResultFactory.php:22
Magento\Checkout\Controller\ShippingRates\Index
Definition:
Index.php:13
$quote
$quote
Definition:
paypal_quote.php:17
$rates
$rates
Definition:
tax.phtml:35
$address
$address
Definition:
customer.php:38
$session
$session
Definition:
quote_with_configurable_product_last_variation.php:62
Magento\Checkout\Controller\ShippingRates\Index\__construct
__construct(Context $context, \Magento\Checkout\Model\Session $session)
Definition:
Index.php:30
Magento\Checkout\Controller\ShippingRates
Definition:
Index.php:6
Magento\Checkout\Controller\ShippingRates\Index\execute
execute()
Definition:
Index.php:44
Magento\Checkout\Controller\ShippingRates\Index\$result
$result
Definition:
Index.php:18
Magento\Framework\App\RequestInterface
Definition:
RequestInterface.php:14
Magento
Magento\Checkout\Controller\ShippingRates\Index\$checkoutSession
$checkoutSession
Definition:
Index.php:23
Magento\Checkout\Model\Session
Definition:
Session.php:17
Magento\Framework\App\Action\Context
Definition:
Context.php:24
Magento\Framework\App\ResponseInterface
Definition:
ResponseInterface.php:14
Magento\Framework\App\Action\Action
Definition:
Action.php:25
Magento\Framework\App\Action
Definition:
AbstractAction.php:8