Php 在Magento中从签出表单隐藏自定义装运方法
我为magento创建了自定义装运方法。并且这个方法只需要用于从其他模块以编程方式创建的订单Php 在Magento中从签出表单隐藏自定义装运方法,php,magento,shipping,Php,Magento,Shipping,我为magento创建了自定义装运方法。并且这个方法只需要用于从其他模块以编程方式创建的订单 问题:如何在不禁用商店设置中的此方法的情况下从签出表单中隐藏此方法?我假设其他模块将从管理上下文中使用您的发送方法;所以你可以这样做: public function collectRates(Mage_Shipping_Model_Rate_Request $request) { if (!Mage::app()->getStore()->isAdmin())) {
问题:如何在不禁用商店设置中的此方法的情况下从签出表单中隐藏此方法?我假设其他模块将从管理上下文中使用您的发送方法;所以你可以这样做:
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
if (!Mage::app()->getStore()->isAdmin())) {
return false;
}
// rest of your code
按如下方式更新您的collectRates
方法:
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
{
if (!Mage::app()->getStore()->isAdmin())) {
return false;
}
// rest of your code
这样,您应该能够激活shipping方法,但只能在管理上下文中使用