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-instant-purchase
Model
ShippingMethodChoose
CarrierFinder.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\InstantPurchase\Model\ShippingMethodChoose
;
7
8
use
Magento\Customer\Model\Address
;
9
use
Magento\Framework\DataObject
;
10
use
Magento\Shipping\Model\Config
as
CarriersConfig
;
11
use
Magento\Store\Model\StoreManagerInterface
;
12
16
class
CarrierFinder
17
{
21
private
$carriersConfig;
22
26
private
$storeManager;
27
33
public
function
__construct
(
34
CarriersConfig
$carriersConfig,
35
StoreManagerInterface
$storeManager
36
) {
37
$this->carriersConfig = $carriersConfig;
38
$this->storeManager =
$storeManager
;
39
}
40
47
public
function
getCarriersForCustomerAddress
(
Address
$address
): array
48
{
49
$request
=
new
DataObject
([
50
'dest_country_id'
=>
$address
->getCountryId()
51
]);
52
53
$carriers = [];
54
foreach
($this->carriersConfig->getActiveCarriers($this->storeManager->getStore()->getId()) as $carrier) {
55
$checked
= $carrier->checkAvailableShipCountries(
$request
);
56
if
(
false
!==
$checked
&&
null
===
$checked
->getErrorMessage() && !empty(
$checked
->getAllowedMethods())) {
57
$carriers[] =
$checked
;
58
}
59
}
60
61
return
$carriers;
62
}
63
}
Magento\InstantPurchase\Model\ShippingMethodChoose\CarrierFinder
Definition:
CarrierFinder.php:16
Magento\InstantPurchase\Model\ShippingMethodChoose\CarrierFinder\__construct
__construct(CarriersConfig $carriersConfig, StoreManagerInterface $storeManager)
Definition:
CarrierFinder.php:33
Magento\Customer\Model\Address
Definition:
AbstractAddress.php:7
Magento\InstantPurchase\Model\ShippingMethodChoose
Definition:
CarrierFinder.php:6
$storeManager
$storeManager
Definition:
paypal_quote.php:14
Magento\Framework\DataObject
Definition:
DataObject.php:15
$address
$address
Definition:
customer.php:38
Magento\InstantPurchase\Model\ShippingMethodChoose\CarrierFinder\getCarriersForCustomerAddress
getCarriersForCustomerAddress(Address $address)
Definition:
CarrierFinder.php:47
Magento\Store\Model\StoreManagerInterface
Definition:
StoreManagerInterface.php:17
Magento\Customer\Model\Address
Definition:
Address.php:23
$request
$request
Definition:
quote_with_configurable_product_last_variation.php:22
$checked
$checked
Definition:
billing.phtml:77
Magento\Shipping\Model\Config
Magento\Framework\DataObject
Definition:
Cache.php:6