不确定它是什么时候开始发生的,但我在购物车页面上有一个运费估算器不起作用。填写信息并单击“获取报价”后,页面会重新加载,但不会向用户显示任何运输方式……就好像表单是用空白值提交的一样。表格指向:
checkout/cart/estimatePost
其中的内容(在 app/code/core/Mage/Checkout/controllers/CartController.php 中):
public function estimatePostAction()
{
$country = (string) $this->getRequest()->getParam('country_id');
$postcode = (string) $this->getRequest()->getParam('estimate_postcode');
$city = (string) $this->getRequest()->getParam('estimate_city');
$regionId = (string) $this->getRequest()->getParam('region_id');
$region = (string) $this->getRequest()->getParam('region');
$this->_getQuote()->getShippingAddress()
->setCountryId($country)
->setCity($city)
->setPostcode($postcode)
->setRegionId($regionId)
->setRegion($region)
->setCollectShippingRates(true);
$this->_getQuote()->save();
$this->_goBack();
}
我在这里添加了一个 Mage::log 来检查请求:
$request = $this->getRequest()->getParams();
Mage::log($request, null, 'temp.log');
记录的数组完全是空的。甚至没有参数到达这里。
我查看了表单本身,它与开发站点上的表单完全相同(工作正常)。所以问题不在于表单本身。
唯一真正合乎逻辑的结论是另一个模块把事情搞砸了。我已经检查了用于覆盖 CartController.php 的不同模块,虽然有一些正在这样做,但没有一个与 estimatePostAction() 方法混淆。
我有点疑惑,有什么想法吗?
最佳答案
神圣的烟雾。站点所有者必须在服务器上更改了 https: 相关内容,因为我将表单的操作更改为:
$this->getUrl('checkout/cart/estimatePost')
收件人:
$this->getUrl('checkout/cart/estimatePost', array('_secure'=>true))
现在可以了。
关于Magento Shipping Estimator - 不工作(空结果),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9740872/