|
|
' . TEXT_INFO_SEARCH_DETAIL_FILTER . $products_filter;
}
if (isset($products_filter) && zen_not_null($products_filter)) {
echo ' ' . '' . zen_image_button('button_reset.gif', IMAGE_RESET) . ' ';
} else {
echo '';
}
// show reset search
echo zen_draw_form('search', FILENAME_STATS_PRODUCTS_PURCHASED, '', 'get', '', true);
echo ' ' . HEADING_TITLE_SEARCH_DETAIL_REPORTS_NAME_MODEL . ' ' . zen_draw_input_field('products_filter_name_model') . zen_hide_session_id();
if (isset($products_filter_name_model) && zen_not_null($products_filter_name_model)) {
$products_filter_name_model = zen_db_input(zen_db_prepare_input($products_filter_name_model));
echo ' ' . TEXT_INFO_SEARCH_DETAIL_FILTER . zen_db_prepare_input($products_filter_name_model);
}
if (isset($products_filter_name_model) && zen_not_null($products_filter_name_model)) {
echo ' ' . '' . zen_image_button('button_reset.gif', IMAGE_RESET) . ' ';
} else {
echo '';
}
?>
|
|
0 or $products_filter_name_model != '') {
if ($products_filter > 0) {
// by products_id
$chk_orders_products_query = "SELECT o.customers_id, op.orders_id, op.products_id, op.products_quantity, op.products_name, op.products_model,
o.customers_name, o.customers_company, o.customers_email_address, o.date_purchased
FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op
WHERE op.products_id in (" . $products_filter . ")
and op.orders_id = o.orders_id
ORDER by op.products_id, o.date_purchased DESC";
} else {
// by products name or model
$chk_orders_products_query = "SELECT o.customers_id, op.orders_id, op.products_id, op.products_quantity, op.products_name, op.products_model,
o.customers_name, o.customers_company, o.customers_email_address, o.date_purchased
FROM " . TABLE_ORDERS . " o, " . TABLE_ORDERS_PRODUCTS . " op
WHERE ((op.products_model LIKE '%" . $products_filter_name_model . "%')
or (op.products_name LIKE '%" . $products_filter_name_model . "%'))
and op.orders_id = o.orders_id
ORDER by op.products_id, o.date_purchased DESC";
}
$chk_orders_products_query_numrows='';
$chk_orders_products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $chk_orders_products_query, $chk_orders_products_query_numrows);
$rows = 0;
$chk_orders_products = $db->Execute($chk_orders_products_query);
?>
|
|
|
|
|
|
|
EOF) {
?>
|
EOF) {
$rows++;
if (strlen($rows) < 2) {
$rows = '0' . $rows;
}
if ($products_filter != '') {
// products_id
$cPath = zen_get_product_path($products_filter);
} else {
// products_name or products_model
$cPath = zen_get_product_path($chk_orders_products->fields['products_id']);
}
?>
fields['customers_id'] . '&action=edit', 'NONSSL') . '">' . $chk_orders_products->fields['customers_id'] . ''; ?> |
fields['orders_id'] . '&action=edit', 'NONSSL') . '">' . $chk_orders_products->fields['orders_id'] . ''; ?> |
fields['date_purchased']); ?> |
fields['customers_name'] . ($chk_orders_products->fields['customers_company'] !='' ? ' ' . $chk_orders_products->fields['customers_company'] : '') . ' ' . $chk_orders_products->fields['customers_email_address']; ?> |
fields['products_quantity']; ?> |
' . $chk_orders_products->fields['products_name'] . ''; ?> |
fields['products_model']; ?> |
MoveNext();
}
?>
|
display_count($chk_orders_products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> |
display_links($chk_orders_products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page'], zen_get_all_get_params(array('page', 'x', 'y'))); ?> |
|
|
|
|
1)) $rows = $_GET['page'] * MAX_DISPLAY_SEARCH_RESULTS_REPORTS - MAX_DISPLAY_SEARCH_RESULTS_REPORTS;
// The following OLD query only considers the "products_ordered" value from the products table.
// Thus this older query is somewhat deprecated
$products_query_raw = "select p.products_id, p.products_ordered, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = p.products_id and pd.language_id = '" . $_SESSION['languages_id']. "' and p.products_ordered > 0 group by pd.products_id order by p.products_ordered DESC, pd.products_name";
// The new query uses real order info from the orders_products table, and is theoretically more accurate.
// To use this newer query, remove the "1" from the following line ($products_query_raw1 becomes $products_query_raw )
$products_query_raw1 =
"select sum(op.products_quantity) as products_ordered, pd.products_name, op.products_id
from ".TABLE_ORDERS_PRODUCTS." op
left join " . TABLE_PRODUCTS_DESCRIPTION . " pd
on (pd.products_id = op.products_id )
where pd.language_id = '" . $_SESSION['languages_id']. "'
group by pd.products_id
order by products_ordered DESC, products_name";
$products_query_numrows='';
$products_split = new splitPageResults($_GET['page'], MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $products_query_raw, $products_query_numrows);
$rows = 0;
$products = $db->Execute($products_query_raw);
while (!$products->EOF) {
$rows++;
if (strlen($rows) < 2) {
$rows = '0' . $rows;
}
$cPath = zen_get_product_path($products->fields['products_id']);
?>
fields['products_id']) . '">' . $products->fields['products_id'] . ''; ?> |
fields['products_id'] . '&page=') . '">' . $products->fields['products_name'] . ''; ?> |
fields['products_ordered']; ?> |
MoveNext();
}
?>
|
display_count($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, $_GET['page'], TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?> |
display_links($products_query_numrows, MAX_DISPLAY_SEARCH_RESULTS_REPORTS, MAX_DISPLAY_PAGE_LINKS, $_GET['page']); ?> |
|
0
?>
|
|
|