有关zen cart集成支付宝借口时提示ILLEGAL_SIGN 错误解决
这次开发zencart的过程中要用过国内大名鼎鼎的支付宝接口,从zencart.cn上下了jack的 zen cart 支付宝模块从后台安装一切ok,可是测试购物的时候遇到了 ILLEGAL_SIGN错误,找了很多答案,仔仔细细看了阿里提供的api文档,还是找不出问题所在。看来得靠自己了,对着firebug,一个个核对网站传输给支付宝的post数据,发现多了 btn_submit.x,btn_submit.x 这两个参数,我把form 的method改成get,从地址栏中去掉这两个参数再打开,成功转向支付宝收银台页面,看来果然是两个参数搞得鬼!
google了下submit.x,得到如下答案
根据图形提交按钮行为W3C的描述 :
When a pointing device is used to click on the image, the form is submitted and the click coordinates passed to the server.
当指针设备用于在图像上点击,表单提交和点击坐标传递给服务器。The x value is measured in pixels from the left of the image, and the y value in pixels from the top of the image.
在x值的单位是像素从左边的形象,以像素为单位从图像的顶部y值。The submitted data includes name.x=x-value and name.y=y-value where “name” is the value of the name attribute, and x-value and y-value are the x and y coordinate values, respectively.
提交的数据包括name.x = x值和name.y = y值在“名称”的名称属性值和x值和y值是x和y坐标值。
于是这还是W3C的标准,现在的问题就是如何避免浏览器“多此一举”了,很简单,在表单添加onsubmit=”this.submit();return false;”,即修改zencart的订单确认页面模板tpl_checkout_confirmation_default.php文件中的
echo zen_draw_form(‘checkout_confirmation’, $form_action_url, ‘post’, ‘id=”checkout_confirmation” onsubmit=”submitonce();”‘);
修改为
echo zen_draw_form(‘checkout_confirmation’, $form_action_url, ‘post’, ‘id=”checkout_confirmation” onsubmit=”this.submit();return false;”‘);
lz高手啊!!
手到bug除
我修改了,还是出现这个错误,很奇怪!
厉害!我也发现了多余的x,y参数,可是抓狂了很久都不知道怎么解决,还得靠LZ的高招!
@飘雨
可能是因为其它参数不对,我下载的支付宝模块v3.2是需要修改提交service参数的值才行的:
从trade_create_by_buyer改成create_partner_trade_by_buyer;
希望对你有用。
请问楼主,更改的btn_submit.x,btn_submit.x 这两个参数在第几页!
我想请请教一下
调试错误,请回到请求来源地,重新发起请求。
错误代码 HAS_NO_PRIVILEGE
这个错误如何解决啊。