2

In magento 1

$canApplyMsrp = Mage::helper('catalog')->canApplyMsrp($_item->getProduct(), Mage_Catalog_Model_Product_Attribute_Source_Msrp_Type::TYPE_BEFORE_ORDER_CONFIRM);

how can I set this in the magento 2.

0
public function __construct(
        /Magento/Msrp/Helper/Data $helper
    ) {
        $this->helper = $helper;
    }

inside function you can call,

public function msrpcall(){
    $this->helper->canApplyMsrp($product, Type::TYPE_BEFORE_ORDER_CONFIRM));
}
  • Thanks for reply But i want in phtml file not in block with objectmanager can you tell me please how i set in phtml file – Rahul Katoch Jan 17 '17 at 13:14
  • $om = \Magento\Framework\App\ObjectManager::getInstance(); $msrp = $om->get('Magento/Msrp/Helper/Data')->canApplyMsrp($product, Type::TYPE_BEFORE_ORDER_CONFIRM)); – Rakesh Jesadiya Jan 17 '17 at 13:20
  • Above formula is worked for you? – Rakesh Jesadiya Jan 19 '17 at 5:24
  • you can accept as answer so other community users can helpful in future. – Rakesh Jesadiya Jan 19 '17 at 5:36
  • @Rahulocodewire, Whats the issue have you faced? – Rakesh Jesadiya Jan 20 '17 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.