gpt4 book ai didi

magento - 我如何在 Magento 的总计框架中输出运输方式

转载 作者:行者123 更新时间:2023-12-04 05:36:23 27 4
gpt4 key购买 nike

Magento 结帐有一行显示文件中的总数:

前端/base/default/template/checkout/onepage/review/info.phtml

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

但是如果客户选择了 cargo 方式而我没有,则此行也会显示运输方式
找到这个从我的总页中取出,我知道我不能从数据库中删除它,因为这个信息用于 cargo 选择。

如果有人知道我会很高兴

现在谢谢

最佳答案

要从总数中删除此数据,您需要覆盖以下类:

将其隐藏在购物车页面中:

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 类(class)。为此,您需要创建一个从 扩展的新 block 。 Mage_Core_Block_Abstract
  • 在您的一些自定义模块中创建 block
    <?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'));
    }
    }
    }
  • 添加布局更新以将您的 block 包含到订单 View 中。
     <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>

  • 在前端的所有页面上进行此类自定义后,您的运输总额将没有有关运输方式的信息......

    关于magento - 我如何在 Magento 的总计框架中输出运输方式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11873606/

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