由 wangbing726 » 2011-05-25 15:44
出现问题 有2个 第一在支持的最后一步 卡的不得了 或者直接白屏 第二 在后台订单管理那里 你点那些订单号然后点编辑看看 会提示订单不存在。SO··· 请大神给出完美的解决方案 另外本人提供一个lightinthebox的 比较麻烦
生成的订单是日期加8位随机号,他的实现原理是在数据库order中增一个order_no的字段,varchar(255),
/includes/functions/functions_lookups.php
function zen_get_order_no($orders_id){
global $db;
$query = "SELECT o.`order_no` FROM ".TABLE_ORDERS ." o
WHERE o.`orders_id` =".$orders_id;
$orders=$db->Execute($query);
if ($orders->RecordCount()>0) {
return $orders->fields['order_no'];
}else{
return FALSE;
}
}
function zen_get_order_id($order_no){
global $db;
$query = "SELECT * FROM ".TABLE_ORDERS ." o
WHERE o.`order_no` = ".$order_no;
$orders = $db->Execute($query);
if ($orders->RecordCount()>0) {
return $orders->fields['orders_id'];
}else{
return FALSE;
}
}
/includes/classes/order.php
------------------------
$sql_data_array = array('customers_id' => $_SESSION['customer_id'],
'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
换成
$sql_data_array = array('order_no'=>date('YmdHis').rand(10,20),
'customers_id' => $_SESSION['customer_id'],
'customers_name' => $this->customer['firstname'] . ' ' . $this->customer['lastname'],
----------------------------
zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id, $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
换成
zen_mail($this->customer['firstname'] . ' ' . $this->customer['lastname'], $this->customer['email_address'], EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . zen_get_order_no($zf_insert_id), $email_order, STORE_NAME, EMAIL_FROM, $html_msg, 'checkout', $this->attachArray);
-----------------------------
zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . $zf_insert_id,
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
换成
zen_mail('', SEND_EXTRA_ORDER_EMAILS_TO, SEND_EXTRA_NEW_ORDERS_EMAILS_TO_SUBJECT . ' ' . EMAIL_TEXT_SUBJECT . EMAIL_ORDER_NUMBER_SUBJECT . zen_get_order_no($zf_insert_id),
$email_order . $extra_info['TEXT'], STORE_NAME, EMAIL_FROM, $html_msg, 'checkout_extra', $this->attachArray);
/includes/lanuages/english.php
增加
define('NO_FOUND_ORDER_NO','Sorry,No Found This Order No. # : ');
define('NO_FOUND_ORDER','Sorry,No Found This Order');
/includes/modules/pages/account/header_php.php
$orders_query = "SELECT o.orders_id, o.date_purchased, o.delivery_name,
o.delivery_country, o.billing_name, o.billing_country,
ot.text as order_total, s.orders_status_name
FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s
WHERE o.customers_id = :customersID
AND o.orders_id = ot.orders_id
AND ot.class = 'ot_total'
AND o.orders_status = s.orders_status_id
AND s.language_id = :languagesID
ORDER BY orders_id DESC LIMIT 3";
换成
$orders_query = "SELECT o.orders_id, o.order_no, o.date_purchased, o.delivery_name,
o.delivery_country, o.billing_name, o.billing_country,
ot.text as order_total, s.orders_status_name
FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_TOTAL . " ot, " . TABLE_ORDERS_STATUS . " s
WHERE o.customers_id = :customersID
AND o.orders_id = ot.orders_id
AND ot.class = 'ot_total'
AND o.orders_status = s.orders_status_id
AND s.language_id = :languagesID
ORDER BY orders_id ";
-----------------------
$ordersArray[] = array('orders_id'=>$orders->fields['orders_id'],
换成
$ordersArray[] = array('orders_id'=>$orders->fields['orders_id'],'order_no'=>$orders->fields['order_no'],
includes/modules/pages/account_history_info/header_php.php
if (!isset($_GET['order_id']) || (isset($_GET['order_id']) && !is_numeric($_GET['order_id']))) {
zen_redirect(zen_href_link(FILENAME_ACCOUNT_HISTORY, '', 'SSL'));
}
换成
if (isset($_POST['action']) && $_POST['action'] == 'search'){
$order_id = zen_get_order_id($_POST['keyword']);
if ($order_id==''){
$messageStack->add_session('account',NO_FOUND_ORDER_NO.$_POST['keyword'],'error');
zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
}
}else{
if (!isset($_GET['order_id']) || (isset($_GET['order_id']) && !is_numeric($_GET['order_id']))) {
$messageStack->add_session('account',NO_FOUND_ORDER,'error');
zen_redirect(zen_href_link(FILENAME_ACCOUNT, '', 'SSL'));
}
$order_id = $_GET['order_id'];
}
---------------------
自上述语句以下的
$_GET['order_id']
换成
$order_id
-------------------
$breadcrumb->add(sprintf(NAVBAR_TITLE_3, $_GET['order_id']));
换成
$breadcrumb->add(sprintf(NAVBAR_TITLE_3, zen_get_order_no($order_id)));
/includes/templates/lightinthebox/templates/tpl_account_default.php
<?php
foreach($ordersArray as $orders) {
?>
<tr>
<td width="70px"><?php echo zen_date_short($orders['date_purchased']); ?></td>
<td width="30px"><?php echo TEXT_NUMBER_SYMBOL . $orders['orders_id']; ?></td>
<td><address><?php echo zen_output_string_protected($orders['order_name']) . '<br />' . $orders['order_country']; ?></address></td>
<td width="70px"><?php echo $orders['orders_status_name']; ?></td>
<td width="70px" align="right"><?php echo $orders['order_total']; ?></td>
<td align="right"><?php echo '<a href="' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders['orders_id'], 'SSL') . '"> ' . zen_image_button(BUTTON_IMAGE_VIEW_SMALL, BUTTON_VIEW_SMALL_ALT) . '</a>'; ?></td>
</tr>
<?php
}
?>
</table>
换成
<?php
$orders_split = new splitPageResults($orders_query, MAX_DISPLAY_PRODUCTS_LISTING, 'o.order_no', 'page');
$zco_notifier->notify('NOTIFY_MODULE_PRODUCT_LISTING_RESULTCOUNT', $listing_split->number_of_rows);
$orders = $db->Execute($orders_split->sql_query);
if ($orders->RecordCount() > 0) {
while(!$orders->EOF){
if (zen_not_null($orders->fields['delivery_name'])) {
$order_name = $orders->fields['delivery_name'];
$order_country = $orders->fields['delivery_country'];
} else {
$order_name = $orders->fields['billing_name'];
$order_country = $orders->fields['billing_country'];
}
?>
<tr>
<td><?php echo '<a href="' . zen_href_link(FILENAME_ACCOUNT_HISTORY_INFO, 'order_id=' . $orders->fields['orders_id'], 'SSL') . '"> ' . TEXT_NUMBER_SYMBOL . zen_get_order_no($orders->fields['orders_id']). '</a>'; ?></td>
<td><?php echo zen_date_short($orders->fields['date_purchased']); ?></td>
<td><?php echo zen_output_string_protected($order_name) . '<br />' . $order_country; ?></td>
<td><?php echo $orders->fields['orders_status_name']; ?></td>
<td><?php echo $orders->fields['order_total']; ?></td>
</tr>
<?php
$orders->MoveNext();
}
}
?>
</table>
-----------------------
<th scope="col"><?php echo TABLE_HEADING_DATE; ?></th>
<th scope="col"><?php echo TABLE_HEADING_ORDER_NUMBER; ?></th>
<th scope="col"><?php echo TABLE_HEADING_SHIPPED_TO; ?></th>
<th scope="col"><?php echo TABLE_HEADING_STATUS; ?></th>
<th scope="col"><?php echo TABLE_HEADING_TOTAL; ?></th>
<th scope="col"><?php echo TABLE_HEADING_VIEW; ?></th>
换成
includes/templates/lightinthebox/templates/tpl_account_history_default.php
<legend><?php echo TEXT_ORDER_NUMBER . $history['orders_id']; ?></legend>
换成
<legend><?php echo TEXT_ORDER_NUMBER . zen_get_order_no($history['orders_id']); ?></legend>
includes/templates/lightinthebox/templates/tpl_account_history_info_default.php
sprintf(HEADING_ORDER_NUMBER, $_GET['order_id']); ?>
换成
sprintf(HEADING_ORDER_NUMBER, zen_get_order_no($order_id)); ?>
includes/templates/lightinthebox/templates/tpl_checkout_success_default.php
<?php echo TEXT_YOUR_ORDER_NUMBER . $zv_orders_id; ?>
换成
<?php echo TEXT_YOUR_ORDER_NUMBER . '<strong class="red">'.zen_get_order_no($zv_orders_id).'</strong>'; ?>
另外求 ajax 在商品详细页上显示的 显示全部同类全部产品的那个
- 附件
-
新建 文本文档 (6).txt
- (8.3 KiB) 被下载 39 次