| 
	例如,有的时候我们的magento商城并不是支持所有地区都可以货到付款的。 
	那么这个时候就会根据不同城市 选择性的显示货到付款支付方式。 
	但首先我们要在后台做一些可控的配置 
	例如:  
	当然还要有那些城市是可以货到付款的。这里就不显示出来了。(因为我自己是在另一个 选项卡了配置这个信息的。) 
	(后台开发可以去网上搜索教程。) 
	之后在文件 
	app\design\frontend\base\default\template\checkout\onepage\payment\methods.phtml中  
	代码 
	[php] view plain copy 
	$methods = $this->getMethods();   
	   $oneMethod = count($methods) <= 1;   
	下添加代码: 
	[php] view plain copy 
	$showCashOnDeliever = Mage::getStoreConfig('payment/cashondelivery/accordingCityActive'); // 根据自己编写情况找到实际位置   
	    if($showCashOnDeliever){   
	        $checkout = Mage::getSingleton('checkout/session')->getQuote();   
	        $shipping = $checkout->getShippingAddress(); // 获取当前运送的城市   
	        $CityStr = Mage::getStoreConfig('payment/cashondelivery/city');   
	        $CityArr = explode(' ',$CityStr); // 获取货到付款的城市   
	    }   
	然后找到代码 
	[php] view plain copy 
	foreach ($methods as $_method):   
	       $_code = $_method->getCode();   
	下面添加 代码: 
	[php] view plain copy 
	if($showCashOnDeliever){   
	            if($_code == "cashondelivery"){   
	                $destCity = $shipping->getCity();   
	                if(!in_array($destCity,$CityArr )){   
	                    continue;   
	                }   
	            }   
	        }   
	这时候你就可以结账试试了。 ^_^ 
	--------------------------------------------------唠叨两句---------------------------------------- 
	这只是通过判断的方式使得前台不显示货到付款的支付方式了。同样的你可以去掉任何你需要的支付方式。 
	当然,有人说我截取post数据修改支付方式为货到付款,那么订单支付方式当然还会是货到付款了。你若真要 
	细致考虑,那你就在确认订单的时候再去判断合法性。(责任编辑:最模板) | 



 Logancee多用途外贸服饰鞋包
							人气:435
							Logancee多用途外贸服饰鞋包
							人气:435
						 Indigo简洁大气商城 Magent
							人气:570
							Indigo简洁大气商城 Magent
							人气:570
						 Tiffany模板ecshop模板
							人气:939
							Tiffany模板ecshop模板
							人气:939
						 shopex拍鞋模板
							人气:1327
							shopex拍鞋模板
							人气:1327
						 shopex红色模板
							人气:451
							shopex红色模板
							人气:451
						 ecshop仿御灵珠宝商城模板
							人气:497
							ecshop仿御灵珠宝商城模板
							人气:497