Does anyone know how to edit the following to have the name of the coupon as the label on the new order sales email instead of the coupon code?
<?php foreach ($this->getTotals() as $_code => $_total): ?>
<?php if ($_total->getBlockName()): ?>
<?php echo $this->getChildHtml($_total->getBlockName(), false); ?>
<?php else:?>
<tr class="<?php echo $_code?>">
<?php
if ($_code=="discount") {
$code_used = trim(str_replace(array("Discount (",")"),array(""),$this->escapeHtml($_total->getLabel())));
$coupon = Mage::getModel('salesrule/coupon');
$coupon->load($code_used, 'code');
$rule = Mage::getModel('salesrule/rule')->load($coupon->getRuleId());
$rule_name = $rule->getName();
}
?>
<td <?php echo $this->getLabelProperties()?>>
<?php if ($_total->getStrong()):?>
<strong><?php echo $this->escapeHtml($_total->getLabel());?></strong>
<?php else:?>
<?php echo $this->escapeHtml($_total->getLabel());?>
<?php endif?>
</td>
<td <?php echo $this->getValueProperties()?>>
<?php if ($_total->getStrong()):?>
<strong><?php echo $this->formatValue($_total) ?></strong>
<?php else:?>
<?php echo $this->formatValue($_total) ?>
<?php endif?>
</td>
</tr>
<?php endif?>
<?php endforeach?>