在Magento中隐藏结账表单中的自定义运输方式


Hide custom shipping method from checkout form in Magento

我为magento创建了自定义运输方法。这种方法只需要用于从其他模块以编程方式创建的订单。

问题:如何在不在商店设置中禁用此方法的情况下从结账表单中隐藏此方法?

我假设其他模块将从管理上下文使用您的运输方法;所以你可以这样做:

更新你的collectRates方法如下:

public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
    if (!Mage::app()->getStore()->isAdmin())) {
        return false;
    }
    // rest of your code

这样,您应该能够激活运输方法,但只能在管理上下文中使用。