Your IP : 216.73.216.97


Current Path : /var/www/clients/client3/web2/web/vendor/magento/module-msrp/Model/Quote/Address/
Upload File :
Current File : /var/www/clients/client3/web2/web/vendor/magento/module-msrp/Model/Quote/Address/CanApplyMsrp.php

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
namespace Magento\Msrp\Model\Quote\Address;

class CanApplyMsrp
{
    /**
     * @var \Magento\Msrp\Helper\Data
     */
    protected $msrpHelper;

    /**
     * @param \Magento\Msrp\Helper\Data $msrpHelper
     */
    public function __construct(\Magento\Msrp\Helper\Data $msrpHelper)
    {
        $this->msrpHelper = $msrpHelper;
    }

    /**
     * @param \Magento\Quote\Model\Quote\Address $address
     * @return bool
     */
    public function isCanApplyMsrp($address)
    {
        $canApplyMsrp = false;
        foreach ($address->getAllItems() as $item) {
            if (!$item->getParentItemId()
                    && $this->msrpHelper->isShowBeforeOrderConfirm($item->getProductId())
                    && $this->msrpHelper->isMinimalPriceLessMsrp($item->getProductId())
            ) {
                $canApplyMsrp = true;
                break;
            }
        }
        return $canApplyMsrp;
    }
}