0

This is the content of totals.phtml:

<?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?>">
        <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?>

I want to remove the subtotal from email confirmation but keep it in the "Email Copy of Invoice" . How can I do that ?

1
0

Create a copy of the file in ...yourtheme/template/sales/order/totals.phtml and make the following modification:

<?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?>">
    <td <?php echo $this->getLabelProperties()?>>
        <?php if ($_total->getStrong()):?>
        <strong><?php echo $this->escapeHtml($_total->getLabel());?></strong>
        <?php else:?>
            <?php if (strpos(Mage::helper('core/url')->getCurrentUrl(),"sales_order_invoice/save/order_id")): ?> //checks for admin url
                <?php echo $this->escapeHtml($_total->getLabel());?>
            <?php else: ?>
                <?php if ($_code != 'subtotal'):?>
                    <?php echo $this->escapeHtml($_total->getLabel());?>
                <?php endif ?>
            <?php endif ?>
        <?php endif?>
    </td>
    <td <?php echo $this->getValueProperties()?>>
        <?php if ($_total->getStrong()):?>
        <strong><?php echo $this->formatValue($_total) ?></strong>
        <?php else:?>
            <?php if (strpos(Mage::helper('core/url')->getCurrentUrl(),"sales_order_invoice/save/order_id")): ?> //checks for admin url
                <?php echo $this->formatValue($_total);?>
            <?php else: ?>
                <?php if ($_code != 'subtotal'):?>
                    <?php echo $this->formatValue($_total);?>
                <?php endif ?>
            <?php endif; ?>
        <?php endif?>
    </td>
</tr>
<?php endif?>

Your order confirmation email will now no longer include the subtotal information.

8
  • Now I sawa that my post is not complete: It works but i want to keep in the Email Copy of Invoice . – Attila Naghi Aug 17 '15 at 9:05
  • Are you referring to an email attachment? – Moose Aug 17 '15 at 9:06
  • when i finish shopping there is an email confirmation email. Here I want to remove the subtotal. But in the admin panel from orders->invoice-> there is a checkbox with Email copy of invoice. Here I want to keep the subtotal.There are using the same subtotals.phtml file – Attila Naghi Aug 17 '15 at 9:09
  • Do you understand what i mean ? :D – Attila Naghi Aug 17 '15 at 9:14
  • Yes. I've updated my answer and I believe this is what you're looking for. Kind of a hack and slash approach, but unfortunately Mage::app()->getStore()->isAdmin() isn't returning true when added the .phtml file. Hence the check for the /sales_order/email/order_id in the current URL, this validates whether or not the code is called from admin. This way, orders placed via the front-end do not contain the subtotal text in the order confirmation. But when clicking "Send Email", it will. – Moose Aug 17 '15 at 9:46
0

Override method _initSubtotal() in class Mage_Tax_Block_Sales_Order_Tax
Add below code

$parent->removeTotal('subtotal');

after code

$parent->addTotal($totalExcl, 'subtotal');
$parent->addTotal($totalIncl, 'subtotal_excl');

Basically you need to remove subtotal instead of adding it.

2
  • yeah I want to remove it form email confirmation but keep it in the order->invoice->email copy of invoice – Attila Naghi Aug 17 '15 at 9:12
  • can you explained with more details, I don;t get it – Attila Naghi Aug 17 '15 at 9:21

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.