Magento 2 Enterprise,
With Magento Reward module
,
Inside layout file checkout_cart_index.xml
file with reward block is defined as below.
<block class="Magento\Reward\Block\Tooltip\Checkout" name="reward.tooltip.checkout" template="tooltip.phtml">
<arguments>
<argument name="reward_type" xsi:type="string">Magento\Reward\Model\Action\OrderExtra</argument>
</arguments>
<action method="setWrapperClass">
<argument name="class" xsi:type="string">reward-checkout</argument>
</action>
<action method="setRewardMessage">
<argument translate="true" name="message" xsi:type="string">Check out now and earn %1 for this order.</argument>
</action>
<action method="setIsGuestNote">
<argument name="value" xsi:type="string">1</argument>
</action>
</block>
I want to this reward blocks html content into Checkout module Customerdata/Cart.php
file,
How can i call above block content into
vendor/magento/module-checkout/CustomerData/Cart.php file with below function,
public function getSectionData()
{
$totals = $this->getQuote()->getTotals();
return [
'summary_count' => $this->getSummaryCount(),
'subtotal' => isset($totals['subtotal'])
? $this->checkoutHelper->formatPrice($totals['subtotal']->getValue())
: 0,
'possible_onepage_checkout' => $this->isPossibleOnepageCheckout(),
'items' => $this->getRecentItems(),
'extra_actions' => $this->layout->createBlock('Magento\Catalog\Block\ShortcutButtons')->toHtml(),
'isGuestCheckoutAllowed' => $this->isGuestCheckoutAllowed(),
'rewards' => $this->layout->createBlock('Magento\Reward\Block\Tooltip\Checkout','reward.tooltip.checkout')
->toHtml(),
];
}
I have try to call this block using,
'rewards' => $this->layout->createBlock('Magento\Reward\Block\Tooltip\Checkout','reward.tooltip.checkout')->toHtml(),
But rewards always return null
In same calling in minicart.phtml
file,
$this->getLayout()->createBlock('Magento\Reward\Block\Tooltip\Checkout','reward.tooltip.checkout')->toHtml()
Result,
Check out now and earn 100 Reward points for this order. Learn more This applies only to registered users and may vary when a user is logged in.
In above function with rewards argument, I want result of reward.toottip.checkout phtml content using above way.
How to resolve this issue in magento 2?