I override totals.phtml, but when I am calling my custom block in it, its not working.

File path:


Override File path:


File: sales_order_view.xml

    <referenceBlock name="order_totals">
        <action method="setTemplate">
            <argument name="template" translate="true" xsi:type="string">SimpleMagento_RewardPoint::order/totals.phtml</argument>

Override totals.phtml:

  /* @var \SimpleMagento\RewardPoint\Block\Sales\Order\ShowReward $block */
 <table class="data-table admin__table-secondary order-subtotal-table">
    <td class="label"><strong>Customer's Reward Point:</strong></td>
    <td><?php $getValue = $block->getReward(); ?>
       <strong> <?= $getValue ?></strong>

$getVaue displays null, however, I when I change in sales_order_view.xml

  <referenceContainer name="order_additional_info">
        <block class="SimpleMagento\RewardPoint\Block\Sales\Order\ShowReward" name="sales_order_view_custom" template="order/view/custom.phtml" />

File: ShowReward.php



public function getReward(){
    $id = $this->getRequest()->getParam('order_id');
    $getOrder = $this->factory->create()->load($id);
    return $getOrder['reward_point'];

and its displayed value perfectly, but its not showing in order totals box, so I override totals.phtml

  • post your getReward() function Commented Jan 8, 2020 at 6:29
  • @RkRathod I updated the question, As I mentioned block is working perfectly in my other phtml file Commented Jan 8, 2020 at 6:33
  • in order object you can directly get the value so you dont want to create this function Commented Jan 8, 2020 at 6:34
  • I did not understand, what you are trying to say Commented Jan 8, 2020 at 6:37
  • you get the reward point value in order object like this $order->getRewardPoint(); or $order->getData('reward_point')?? Commented Jan 8, 2020 at 6:38

1 Answer 1


In totals.phtml file :-

/* @var \Magento\Sales\Block\Adminhtml\Order\Totals $block */

$order = $block->getOrder();
$rewardPoint = $order->getRewardPoint();
  • its working, :) Commented Jan 8, 2020 at 6:53
  • can you please explain me little bit about your answer Commented Jan 8, 2020 at 6:54
  • 1
    in this file module-sales/Block/Order/Totals.php around line no. 73 Commented Jan 8, 2020 at 6:56
  • 1
    you are find this function getOrder() so simply you can use this function,, :) Commented Jan 8, 2020 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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