gpt4 book ai didi

php - magento - 在发货电子邮件中添加总计 block

转载 作者:搜寻专家 更新时间:2023-10-31 21:14:32 25 4
gpt4 key购买 nike

我有个问题一整天都解决不了。我想在发货电子邮件中显示总计 block ,就像在发票电子邮件中订购的商品一样。 (当订单状态从管理更改时)这是我在 sales.xml 中的代码

<sales_email_order_shipment_items>
<block type="sales/order_email_shipment_items" name="items" template="email/order/shipment/items.phtml">
<action method="addItemRender"><type>default</type><block>sales/order_email_items_default</block><template>email/order/items/shipment/default.phtml</template></action>
<block type="sales/order_invoice_totals" name="invoice_totals" template="sales/order/totals.phtml">
<action method="setLabelProperties"><value>colspan="3" align="right" style="padding:3px 9px"</value></action>
<action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
<block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml"/>
</block>
</block>
<block type="core/text_list" name="additional.product.info" />
</sales_email_order_shipment_items>

在 template\email\order\shipment\items.phtml 我添加了这个

<tfoot>
<?php echo $this->getChildHtml('invoice_totals'); ?>
</tfoot>

但什么也没发生。

谁能帮帮我?

最佳答案

我自己解决了这个问题。如果有人需要在发货电子邮件中添加价格,请点击此处:

打开 app/design/frontend/base/default/template/email/order/shipment/items.phtml 并用以下代码替换所有代码:

    <?php $_shipment = $this->getShipment() ?>
<?php $_order = $this->getOrder() ?>
<?php if ($_shipment && $_order): ?>
<table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
<thead>
<tr>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
<th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
<th align="center" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px"><?php echo $this->__('Price'); ?>:</th>
</tr>
</thead>

<?php $i=0; foreach ($_shipment->getAllItems() as $_item): ?>
<?php if($_item->getOrderItem()->getParentItem()) continue; else $i++; ?>
<tbody<?php echo $i%2 ? ' bgcolor="#F6F6F6"' : '' ?>>
<?php echo $this->getItemHtml($_item) ?>
</tbody>
<?php endforeach; ?>
<tfoot>
<tr class="subtotal">
<td colspan="3" align="right" style="padding:3px 9px">
Subtotal
</td>
<td align="right" style="padding:3px 9px">
<span class="price"><?php echo $_order->formatPriceTxt($_order->getSubtotal()); ?></span>
</td>
</tr>
<tr class="shipping">
<td colspan="3" align="right" style="padding:3px 9px">
Delivery:
</td>
<td align="right" style="padding:3px 9px">
<span class="price"><?php echo $_order->formatPriceTxt($_order->getShippingAmount()); ?></span>
</td>
</tr>
<tr class="grand_total">
<td colspan="3" align="right" style="padding:3px 9px">
<strong>Total</strong>
</td>
<td align="right" style="padding:3px 9px">
<strong><span class="price"><?php echo $_order->formatPriceTxt($_order->getSubtotal() + $_order->getShippingAmount()); ?></span></strong>
</td>
</tr>
</tfoot>
</table>
<?php endif; ?>

现在我们包含了总计,但我们需要在 tbody 中显示每个产品的价格。

打开app/design/frontend/base/default/template/email/order/items/shipment/default.phtml之后

<?php $_item = $this->getItem() ?>

添加这个

<?php $_order = $this->getItem()->getOrder(); ?>

在关闭 tr 标签之前的代码末尾添加以下行:

<td align="center" valign="top" style="font-size:11px; padding:3px 9px;">
<?php echo $_order->formatPrice($_item->getPrice()); ?>

关于php - magento - 在发货电子邮件中添加总计 block ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12039999/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com