2

Magento チェックアウトには、ファイル内の合計を示す行があります。

フロントエンド/ベース/デフォルト/テンプレート/チェックアウト/ワンページ/レビュー/info.phtml

<?php echo $this->getChildHtml('totals'); ?>

ただし、この行には、顧客が配送方法を選択した場合の配送方法も表示されますが、これが私の合計ページに表示されませんでした。この情報は配送方法の選択に使用されているため、データベースから削除できないことはわかっています。 .

誰かが知っていれば、私はとても満足しています

今までありがとう

4

2 に答える 2

3

合計からこのデータを削除するには、次のクラスをオーバーライドする必要があります。

ショッピング カート ページで非表示にするには:

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から拡張された新しいブロックを作成する必要があります

  1. 一部のカスタム モジュールでブロックを作成する

    <?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'));
            }
        }
    }
    
  2. レイアウトの更新を追加して、ブロックを注文ビューに含めます。

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

フロントエンドのすべてのページでこのようなカスタマイズを行った後、配送合計には配送方法に関する情報が含まれなくなります...

于 2012-08-09T08:23:12.280 に答える
0

ローカルの 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>
于 2015-03-15T05:09:49.160 に答える