改变运输地址 和 改变账单地址
1
2
|
main_page=checkout_shipping_address
main_page=checkout_payment_address
|
这种情况都会加载地址薄表单 和 地址簿列表:
这个流程展示文件是如何包含的。
tpl_modules_checkout_address_book.php模板中,对应默认地址的选中:
1
|
<?php echo zen_draw_radio_field('address', $addresses->fields['address_book_id'], ($addresses->fields['address_book_id'] == $_SESSION['sendto']), 'id="name-' . $addresses->fields['address_book_id'] . '"'); ?>
|
单选框是否被选中,完全依赖当前的$_SESSION['sendto'],从上面的示例图可以看到tpl_modules_checkout_address_book.php模板会被两个控制器(checkout_shipping_address 和 checkout_payment_address)包含,地址是否选中不应该只依赖当前的$_SESSION['sendto'],我发现在Zen-cart151的默认模板中都是如此设置的,这明显是一个Bug,不过问题不大。
首先在tpl_modules_checkout_address_book.php开头添加
1
2
3
4
5
|
if($addressType == 'billto'){
$checked = $_SESSION['billto'];
}else{
$checked = $_SESSION['sendto'];
}
|
然后把
1
|
<?php echo zen_draw_radio_field('address', $addresses->fields['address_book_id'], ($addresses->fields['address_book_id'] == $_SESSION['sendto']), 'id="name-' . $addresses->fields['address_book_id'] . '"'); ?>
|
替换成:
1
|
<?php echo zen_draw_radio_field('address', $addresses->fields['address_book_id'], ($addresses->fields['address_book_id'] == $checked), 'id="name-' . $addresses->fields['address_book_id'] . '"'); ?>
|
这样的小Bug在Zen-cart目前所有版本都是如此,那意思是说只要点修改账单地址,点一下继续,那的账单地址就可以被改变了,而你的本意可能是希望不做任何修改。
(责任编辑:好模板) |