专注于zen cart的二次开发 >> Zen Cart >> Zen Cart 支付和运费页面合并,减少购物流程
weber发表于2012-06-01  1312314,777 views  

templates里

tpl_checkout_confirmation_default.php

<div class=”buttonRow forward”><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_CHECKOUT_PAYMENT, ”, ‘SSL’) . ‘”>’ . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . ‘</a>’; ?>

改为

<div class=”buttonRow forward”><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_CHECKOUT_PAYMENT_ADDRESS, ”, ‘SSL’) . ‘”>’ . zen_image_button(BUTTON_IMAGE_EDIT_SMALL, BUTTON_EDIT_SMALL_ALT) . ‘</a>’; ?></div>

tpl_checkout_payment_default.php  这个改动比较大

 

tpl_shopping_cart_default.php

<div class=”buttonRow forward”><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’) . ‘”>’ . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . ‘</a>’; ?></div>

改成

<div class=”buttonRow forward”><?php echo ‘<a href=”‘ . zen_href_link(FILENAME_CHECKOUT_PAYMENT, ”, ‘SSL’) . ‘”>’ . zen_image_button(BUTTON_IMAGE_CHECKOUT, BUTTON_CHECKOUT_ALT) . ‘</a>’; ?></div>

 

modules 里

checkout_new_address.php

zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’));

改成

zen_redirect(zen_href_link(FILENAME_CHECKOUT_PAYMENT, ”, ‘SSL’));

\pages\checkout_confirmation\header_php.php

if (isset($_SESSION['cart']->cartID) && $_SESSION['cartID']) {
if ($_SESSION['cart']->cartID != $_SESSION['cartID']) {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’));
}
}

后,增加

if(!empty($_SESSION['shipping_list']) && !empty($_POST['shipping']) && $_POST['shipping']!=’freeshipper_freeshipper’){
$shipping_ids=explode(‘_’,$_POST['shipping']);
for($i=0;$i<sizeof($_SESSION['shipping_list']);$i++){
if($shipping_ids[0]===$_SESSION['shipping_list'][$i]['id']){

$_SESSION['shipping'] = array(‘id’ => $_SESSION['shipping_list'][$i],
‘title’ => $_SESSION['shipping_list'][$i]['methods'][0]['title'],
‘cost’ => $_SESSION['shipping_list'][$i]['methods'][0]['cost']);
}
}

}

 

$editShippingButtonLink = zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’); 改为

$editShippingButtonLink = zen_href_link(FILENAME_CHECKOUT_SHIPPING_ADDRESS, ”, ‘SSL’);

 

\modules\pages\checkout_payment\header_php.php

// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!$_SESSION['shipping']) {
zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’));
}

改成

$select_customer_address=$db->Execute(“select address_book_id from “.TABLE_ADDRESS_BOOK.” where customers_id=’”.$_SESSION['customer_id'].”‘”);
$current_customer_address=$select_customer_address->fields['address_book_id'];
if(is_null($_SESSION['billto'])){$_SESSION['billto']=$current_customer_address;}
if(is_null($_SESSION['sendto'])){$_SESSION['sendto']=$current_customer_address;}
// if no shipping method has been selected, redirect the customer to the shipping method selection page
if (!$_SESSION['shipping']) {
//zen_redirect(zen_href_link(FILENAME_CHECKOUT_SHIPPING, ”, ‘SSL’));
}

 

require(DIR_WS_CLASSES . ‘order.php’);

前面加

$total_weight = $_SESSION['cart']->show_weight();
$total_count = $_SESSION['cart']->count_contents();

——————————————————–

$shipping_modules = new shipping($_SESSION['shipping']);

改成

$shipping_modules = new shipping();

——————————————————

$order_total_modules->pre_confirmation_check();

后面加

// get all available shipping quotes
$quotes = $shipping_modules->quote();

—————————————–

$total_weight = $_SESSION['cart']->show_weight();
$total_count = $_SESSION['cart']->count_contents();

改成

if(!empty($quotes)){
$_SESSION['shipping_list']=$quotes;
}
if(empty($_SESSION['sendto']) && !empty($_SESSION['billto'])){
$_SESSION['sendto']=$_SESSION['billto'];
}

————————————-

\modules\pages\checkout_shipping\header_php.php

if (isset($_SESSION['cart']->cartID)) {
if (!isset($_SESSION['cartID']) || $_SESSION['cart']->cartID != $_SESSION['cartID']) {
$_SESSION['cartID'] = $_SESSION['cart']->cartID;
}
} else {
zen_redirect(zen_href_link(FILENAME_TIME_OUT));
}

改成

$_SESSION['cartID'] = $_SESSION['cart']->cartID;

————————————————————-

includes\classes\payment.php

‘ payment_value = document.checkout_payment.payment.value;’ . “\n” .
‘ }’ . “\n” .
‘ }’ . “\n\n”;

 

后面继续加

‘ payment_value = document.checkout_payment.payment.value;’ . “\n” .
‘ }’ . “\n” .
‘ }’ . “\n\n”.
‘ var shipping_value=null;’.
‘ if (document.checkout_payment.shipping) {
if (document.checkout_payment.shipping.length) {
for (var i=0; i<document.checkout_payment.shipping.length; i++) {
if (document.checkout_payment.shipping[i].checked) {
shipping_value = document.checkout_payment.shipping[i].value;
}
}
} else if (document.checkout_payment.shipping.checked) {
shipping_value = document.checkout_payment.shipping.value;
} else if (document.checkout_payment.shipping.value) {
shipping_value = document.checkout_payment.shipping.value;
}
}

if (shipping_value == null && submitter != 1) {
error_message_shipping = “\nShipping can not be empty!”;
error = 1;
}

‘;

==============================================

includes\functions\functions_general.php

function charsetConvertWinToUtf8 函数完后,加一个函数,虽然似乎没啥用

function zen_class_exists($class_name) {
if (function_exists(‘class_exists’)) {
return class_exists($class_name);
} else {
return true;
}
}

你可以发表评论引用到你的网站或博客,或通过RSS 2.0订阅这个日志的所有评论。
上一篇:
下一篇:
没有评论
我来说两句

  Ctrl+Enter