Location: PHPKode > projects > MyEasyShop > myEasySHOP/adm_user_showorders.php
<?PHP

/***************************************************/
/*		I N C L U D E S 		   */
/***************************************************/
require("etc/myShop.cfg");
require(LIBRARIES. "db_mySQL.inc");
require(LIBRARIES. "bll_user.inc");
require(LIBRARIES. "bll_order.inc");
require(LIBRARIES. "bll_product.inc");
require(LIBRARIES. "template.inc");
require(LIBRARIES. "format.inc");
/***************************************************/	

	// Creazione lista utenti.
	$ul = new bll_user;
	$user_list = $ul->Get_user_info($id_user);

	// Creazione lista file template.
	$myArray = array("user_order" =>		"adm_user_orders.ihtml",
					 "user_order_row" =>	"adm_user_orderrow.ihtml",
					 "user_product_row" =>	"adm_user_productrow.ihtml");
	
	reset ($myArray);	
	$t 	= new Template(TEMPLATES . "user");
	$t->set_file($myArray);

	$orders = new bll_order;
	$orderList = $orders->get_orders($id_user);
	if (is_array($orderList)) {
		$t->set_var("NAME", 		$user_list["name"]);
		$t->set_var("SURNAME", 		$user_list["surname"]);
		$t->set_var("TOTNUMORDERS", count($orderList));
		$t->set_var("TOTNUMORDERSI","calcolo...");
		$t->set_var("CDATE"				, format_datetime($user_list["cdate"]));
		
		$t->set_var("USERORDERS", "");
		foreach($orderList as $key => $value){
			$t->set_var("IDORDER",	$value['id_order']);
			$t->set_var("CDATE"			, format_datetime($value['cdate']));
			$t->set_var("STATUS"		, $value['id_status']);


			$orderdetail = $orders->get_order($value['id_order']);
			
			$iCnt = 0;
			$totalprice = 0;
			$t->set_var("USERORDERSPRODUCTS", "");
			foreach($orderdetail as $keydetails => $valuedetails){

					$product = new bll_product;
					$details = $product->get_product_detail($valuedetails['id_product']);


				$iCnt ++;
				if ($iCnt % 2)
					$t->set_var("PRODUCT_TBLFLDCLASSNAME",	"rigaDispari");
				else
					$t->set_var("PRODUCT_TBLFLDCLASSNAME",	"rigaPari");
				
				$t->set_var("PRODUCTID"			, $valuedetails['id_product']);
				$t->set_var("PRODUCTNAME"		, $details["name"]);
				$t->set_var("PRODUCTDESCR"		, $details["description"]);
				$t->set_var("PRODUCTPRICE"		, format_price($valuedetails['price']));
				$t->set_var("PRODUCTQTY"		, $valuedetails['quantity']);
				$t->set_var("OTHER"				, $iCnt);
				
				$totalprice += $valuedetails['price'] * $valuedetails['quantity'];
				
				$t->parse("USERORDERSPRODUCTS","user_product_row",true);
			}
			$t->set_var("TOTALPRICE"			, format_price($totalprice));
			$t->parse("USERORDERS","user_order_row",true);
		}
		
		$t->aparse("ORDER","user_order");
		
	} else {
		echo "Non ci sono ordini";
	}
?>
Return current item: MyEasyShop