init
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Esun\Reward\Block\Order;
|
||||
|
||||
use Magento\Framework\DataObject;
|
||||
use Magento\Framework\View\Element\Template;
|
||||
|
||||
class RewardTotals extends Template
|
||||
{
|
||||
public function initTotals(): self
|
||||
{
|
||||
$parent = $this->getParentBlock(); $source = $parent?->getSource();
|
||||
if ($parent && $source && (float)$source->getData('reward_discount_amount') > 0) {
|
||||
$parent->addTotal(new DataObject([
|
||||
'code' => 'reward_discount',
|
||||
'value' => -(float)$source->getData('reward_discount_amount'),
|
||||
'label' => __('Points Discount (%1 points)', (int)$source->getData('reward_points_used'))
|
||||
]), 'discount');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user