合計からこのデータを削除するには、次のクラスをオーバーライドする必要があります。
ショッピング カート ページで非表示にするには:
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>
フロントエンドのすべてのページでこのようなカスタマイズを行った後、配送合計には配送方法に関する情報が含まれなくなります...