I'm sure most of you are pretty aware of the "previous" and "next" options when viewing orders. My task, to implement the same feature for product.php so the customer can shuffle through products without having to go back to products.tpl.
Example:
Customer views product b, and on product b's detailed page, there is a link to view product a and product c.
history_order.tpl:
history_order.php
Code:
} else {
$order_data = func_order_data($orderid);
$smarty->assign("order", $order_data["order"]);
$smarty->assign("customer", $order_data["userinfo"]);
$smarty->assign("products", $order_data["products"]);
$smarty->assign("giftcerts", $order_data["giftcerts"]);
if ($order_data) {
$owner_condition = "";
if ($current_area == "C")
$owner_condition = " AND $sql_tbl[orders].login='".$login."'";
elseif ($current_area == "P" && !$single_mode ) {
$owner_condition = " AND $sql_tbl[order_details].provider='".$login."'";
}
# find next
$tmp = func_query_first("SELECT $sql_tbl[orders].orderid FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid>'".$orderid."' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid $owner_condition ORDER BY $sql_tbl[orders].orderid ASC LIMIT 1");
if (!empty($tmp["orderid"]))
$smarty->assign("orderid_next", $tmp["orderid"]);
# find prev
$tmp = func_query_first("SELECT $sql_tbl[orders].orderid FROM $sql_tbl[orders], $sql_tbl[order_details] WHERE $sql_tbl[orders].orderid<'".$orderid."' AND $sql_tbl[order_details].orderid=$sql_tbl[orders].orderid $owner_condition ORDER BY $sql_tbl[orders].orderid DESC LIMIT 1");
if (!empty($tmp["orderid"]))
$smarty->assign("orderid_prev", $tmp["orderid"]);
}
}
Anyone know where to start? Thanks
