Magento 结帐有一行显示文件中的总数:
前端/base/default/template/checkout/onepage/review/info.phtml
<?php echo $this->getChildHtml('totals'); ?>
但是如果客户选择了一种货运方式,这一行也显示了运输方式,而我没有找到这个从我的总页中取出,我知道我不能从数据库中删除它,因为这个信息用于货运选择.
如果有人知道我会很高兴
现在谢谢
要从总数中删除此数据,您需要覆盖以下类:
将其隐藏在购物车页面中:
Mage_Sales_Model_Quote_Address_Total_Shipping::fetch()方法需要通过自定义模块覆盖:
public function fetch(Mage_Sales_Model_Quote_Address $address)
{
$originalShippingDescription = $address->getShippingDescription(); // Keep old description value
$address->unsShippingDescription(); // Removes description of shipping method
parent::fetch($address);
$address->setShippingDescription($originalShippingDescription); // Sets back original description of shipping method
return $this;
}
要在用户帐户的订单概览页面上隐藏它,您需要执行另一个自定义Mage_Sales_Block_Order_Totals类。为此,您需要创建一个从Mage_Core_Block_Abstract扩展的新块
在您的一些自定义模块中创建块
<?php
class Custom_Module_Block_Shipping_Total extents Mage_Core_Block_Abstract
{
public function initTotals()
{
if ($this->getParentBlock() && $this->getParentBlock()->getTotal('shipping')) {
$this->getParentBlock()->getTotal('shipping')->setLabel($this->__('Shipping & Handling'));
}
}
}
添加布局更新以将您的块包含到订单视图中。
<layout>
<!-- Your custom total on invoices view -->
<custom_invoice_totals>
<reference name="invoice_totals">
<block name="custom_total" type="custom_module/shipping_total" />
</reference>
</custom_invoice_totals>
<!-- Your custom total on shipments view -->
<custom_shipment_totals>
<reference name="shipment_totals">
<block name="custom_total" type="custom_module/shipping_total" />
</reference>
</custom_shipment_totals>
<!-- Your custom total on creditmemos view -->
<custom_creditmemo_totals>
<reference name="creditmemo_items">
<block name="custom_total" type="custom_module/shipping_total" />
</reference>
</custom_creditmemo_totals>
<!-- Applying your handles to particular pages in customer account -->
<sales_order_view>
<update handle="custom_order_totals" />
</sales_order_view>
<sales_order_print>
<update handle="custom_order_totals" />
</sales_order_print>
<sales_email_order_items>
<update handle="custom_order_totals" />
</sales_email_order_items>
<!-- applies your total in email -->
<sales_email_order_items>
<update handle="custom_order_totals" />
</sales_email_order_items>
<sales_guest_view>
<update handle="custom_order_totals" />
</sales_guest_view>
<!-- invoice pages -->
<sales_order_invoice>
<update handle="custom_invoice_totals" />
</sales_order_invoice>
<sales_order_printinvoice>
<update handle="custom_invoice_totals" />
</sales_order_printinvoice>
<sales_email_order_invoice_items>
<update handle="custom_invoice_totals" />
</sales_email_order_invoice_items>
<sales_guest_invoice>
<update handle="custom_invoice_totals" />
</sales_guest_invoice>
<!-- shipment pages -->
<sales_order_shipment>
<update handle="custom_shipment_totals" />
</sales_order_shipment>
<sales_order_printshipment>
<update handle="custom_shipment_totals" />
</sales_order_printshipment>
<sales_email_order_shipment_items>
<update handle="custom_shipment_totals" />
</sales_email_order_shipment_items>
<sales_guest_shipment>
<update handle="custom_shipment_totals" />
</sales_guest_shipment>
<!-- creditmemo pages -->
<sales_order_creditmemo>
<update handle="custom_creditmemo_totals" />
</sales_order_creditmemo>
<sales_order_printcreditmemo>
<update handle="custom_creditmemo_totals" />
</sales_order_printcreditmemo>
<sales_email_order_creditmemo_items>
<update handle="custom_creditmemo_totals" />
</sales_email_order_creditmemo_items>
<sales_guest_creditmemo>
<update handle="custom_creditmemo_totals" />
</sales_guest_creditmemo>
</layout>
在前端的所有页面上进行此类自定义后,您的运输总额将没有有关运输方式的信息......
在您本地的 cart.phtml 中,使用以下代码段:
<div class="cart-totals-wrapper">
<div class="cart-totals">
<div class="cart-totals-container">
<!-- <?php echo $this->getChildHtml('totals'); ?> -->
<?php
$_quote = Mage::getSingleton('checkout/session')->getQuote();
$_cartValue = 0;
$_items = $_quote->getAllItems();
foreach ($_items as $_item) {
$_cartValue += $_item->getRowTotalInclTax();
}
?>
<table id="shopping-cart-totals-table">
<colgroup>
<col>
<col width="1">
</colgroup>
<tbody>
<tr>
<td class="a-right" colspan="1" style=""><?php echo $this->__('Subtotal'); ?></td>
<td class="a-right" style="">
<span class="price"><?php echo $_quote->getStore()->formatPrice($_cartValue); ?></span>
</td>
</tr>
</table>
<p class="message"><?php echo $this->__('Shipping will be calculated at checkout'); ?></p>
</div>