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-msrp
Observer
Frontend
Quote
SetCanApplyMsrpObserver.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Msrp\Observer\Frontend\Quote
;
7
8
use
Magento\Framework\Event\ObserverInterface
;
9
13
class
SetCanApplyMsrpObserver
implements
ObserverInterface
14
{
18
protected
$config
;
19
23
protected
$canApplyMsrp
;
24
28
protected
$msrp
;
29
35
public
function
__construct
(
36
\
Magento
\Msrp\Model\Config
$config
,
37
\
Magento
\Msrp\Model\Quote\Address\CanApplyMsrp
$canApplyMsrp
,
38
\
Magento
\Msrp\Model\Quote\Msrp
$msrp
39
) {
40
$this->config =
$config
;
41
$this->canApplyMsrp =
$canApplyMsrp
;
42
$this->msrp =
$msrp
;
43
}
44
51
public
function
execute
(\
Magento
\Framework\Event\Observer
$observer
)
52
{
54
$quote
=
$observer
->getEvent()->getQuote();
55
56
$canApplyMsrp
=
false
;
57
if
($this->config->isEnabled()) {
58
foreach
(
$quote
->getAllAddresses() as
$address
) {
59
if
($this->canApplyMsrp->isCanApplyMsrp(
$address
)) {
60
$canApplyMsrp
=
true
;
61
break
;
62
}
63
}
64
}
65
$this->msrp->setCanApplyMsrp(
$quote
->getId(),
$canApplyMsrp
);
66
}
67
}
Magento\Framework\Event\ObserverInterface
Definition:
ObserverInterface.php:16
$quote
$quote
Definition:
paypal_quote.php:17
Magento\Msrp\Observer\Frontend\Quote\SetCanApplyMsrpObserver\$msrp
$msrp
Definition:
SetCanApplyMsrpObserver.php:28
$address
$address
Definition:
customer.php:38
Magento\Msrp\Observer\Frontend\Quote\SetCanApplyMsrpObserver\__construct
__construct(\Magento\Msrp\Model\Config $config, \Magento\Msrp\Model\Quote\Address\CanApplyMsrp $canApplyMsrp, \Magento\Msrp\Model\Quote\Msrp $msrp)
Definition:
SetCanApplyMsrpObserver.php:35
Magento\Msrp\Observer\Frontend\Quote
Definition:
SetCanApplyMsrpObserver.php:6
$observer
$observer
Definition:
second_website_with_second_currency.php:38
Magento\Msrp\Observer\Frontend\Quote\SetCanApplyMsrpObserver
Definition:
SetCanApplyMsrpObserver.php:13
Magento
Magento\Msrp\Observer\Frontend\Quote\SetCanApplyMsrpObserver\$config
$config
Definition:
SetCanApplyMsrpObserver.php:18
Magento\Framework\Event\ObserverInterface\execute
execute(Observer $observer)
Magento\Msrp\Observer\Frontend\Quote\SetCanApplyMsrpObserver\$canApplyMsrp
$canApplyMsrp
Definition:
SetCanApplyMsrpObserver.php:23