<?php
/******************************************************************
* PHPMass Shopping Cart
* The contents of this file are subject to the PHPMass License.
* If you do not agree with PHPMass License Terms and Conditions
* than you should not use this software.
* A copy of the license file is available on www.phpmass.com/license.htm page.
*
* PHPMass.com.
* All Rights Reserved.
******************************************************************/
$SiteSection = 'user';
require('../includes/config.php');
// Cart and top products
$LastProducts = $Carts->getLastProducts();
if (is_array($LastProducts)) {
$LastProduct = array_shift($LastProducts);
}
$smarty->assign('LastProduct', $LastProduct);
$smarty->assign('LastProducts', $LastProducts);
$TopProducts = $Categories->getTopProducts(0,false,true);
$smarty->assign('TopProducts', $TopProducts);
// END Cart and top products
if (isset($_GET['viewOrder'])) {
$PaymentMethods = $Payment->getAllPayments();
if (isset($_POST['UpdatePayment']) && array_key_exists($_POST['PaymentMethod'],$PaymentMethods)){
$Orders->updateOrderPaymentMethod($userid,$_GET['viewOrder'],$PaymentMethods[$_POST['PaymentMethod']]['name'],true);
$InfoMessage['Payment_Updated'] = $Lang['Payment_Updated'];
}
if (isset($_GET['action']) && $_GET['action']=='finished') {
$Orders->updateOrderPaymentMade($userid,$_GET['viewOrder']);
$Orders->updateOrderPaymentStatus($userid,$_GET['viewOrder'],'pending');
$InfoMessage['Pay_Made_pending'] = $Lang['Pay_Made_pending'];
}
$UserOrder = $Orders->getOrder($userid,$_GET['viewOrder']);
$OrderProducts = $Orders->getOrderProducts($UserOrder['orderid']);
$smarty->assign('Order', $UserOrder);
$smarty->assign('Products', $OrderProducts);
$smarty->assign('GET', $_GET);
$smarty->assign('PaymentMethods',$PaymentMethods);
$smarty->assign('PageTitle', $Lang['Orders']);;
$smarty->assign('Error', $Error);
$smarty->assign('InfoMessage', $InfoMessage);
$smarty->display(DOC_ROOT.'/skin/templates/user/'.'orders.tpl');
}
else {
$UserOrders = $Orders->getOrders($userid,$_GET['type']);
$smarty->assign('Orders', $UserOrders);
if (count($UserOrders) == 0) $InfoMessage['No_Order_In_Section'] = $Lang['No_Order_In_Section'];
$smarty->assign('PageTitle', $Lang['Orders']);
$smarty->assign('Error', $Error);
$smarty->assign('InfoMessage', $InfoMessage);
$smarty->display(DOC_ROOT.'/skin/templates/user/'.'orders.tpl');
}
?>