有一些opencart 1.5.5.1和paypal标准的问题。我正在使用Paypal.com.au(在澳大利亚)当我开始时,没有电话,没有州从opencart传递到贝宝。其余字段(地址,电子邮件,姓名)都已预先填充。所以我进入了paypayl标准代码并将其添加到控制器:
$this->data['night_phone_b'] = html_entity_decode($order_info['telephone'], ENT_QUOTES, 'UTF-8');
和tpl文件:
<input type="hidden" name="night_phone_b" value="<?php echo $night_phone_b; ?>" />
然而,无论我为国家做什么,我都无法让它发挥作用。我看着做这样的事情:
$this->data['state'] = html_entity_decode($order_info['payment_zone_code'], ENT_QUOTES, 'UTF-8');
与上述相同,但将['payment_zone_code']
替换为['payment_zone_id']
和['zone_id']
并在tpl文件中:
<input type="hidden" name="state" value="<?php echo $state; ?>" />
无论如何,我很难将州转交给PayPal。
编辑在Paypal的澳大利亚网站上查看:https://www.paypal.com/au/cgi-bin/webscr?cmd=_pdn_xclick_prepopulate_outside 他们在这个问题上也没有提供任何帮助,所有的例子都是针对美国各州的:“状态(必须是2个字符的官方缩写)”,对3个字符的缩写没有帮助。还在等待他们的回复
答案 0 :(得分:1)
您似乎可以使用其全名传递澳大利亚州(Paypal买方详情选择表格中的值,而不是可见内容)
这感觉有点像一个狡猾的修复,但它对我有用。希望Paypal不会改变任何东西......
$states['ACT'] = "Australian Capital Territory";
$states['NSW'] = "New South Wales";
$states['NT'] = "Northern Territory";
$states['QLD'] = "Queensland";
$states['SA'] = "South Australia";
$states['TAS'] = "Tasmania";
$states['VIC'] = "Victoria";
$states['WA'] = "Western Australia";
然后通过'billing_region'而不是状态作为表单的一部分......
'billing_region' => $state[$fdata['u_state']]
答案 1 :(得分:0)
使用具体国家/地区的iso_code_2
属性怎么样? country
表定义如下:
CREATE TABLE `oc_country` (
`country_id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(128) NOT NULL,
`iso_code_2` varchar(2) NOT NULL,
`iso_code_3` varchar(3) NOT NULL,
`address_format` text NOT NULL,
`postcode_required` tinyint(1) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`country_id`)
)
列iso_code_2
包含所需的2个字符的ISO国家/地区代码。
在您处理PayPal请求的情况下您应该能够使用此唯一值检索付款地址及其国家/地区代码(3个字符的ISO代码)或ID(它是{{{ 1}}或iso_code_3
)您应该能够找到具体的国家/地区条目并获得您希望传递给PayPal的所需country_id
值。
修改强>
如果是州代码,您可以使用已知付款地址 iso_code_2
来获取该代码。但有一个问题 - 澳大利亚各州的代码不仅仅是2个字符:
zone_id
根据Wikipedia,状态的缩写和ISO代码也只有2个字符长,因此也许您可以尝试发送3个字符的代码,其余的在PayPal上(可能描述不正确并且您可以使用3个字符代码。