michael_s
03-08-2007, 11:50 AM
Hi,
I had a problem where I was always having zeros in all the results, whichever products was chosen.
Added at the beginning of the file stats_products_per_month.php (this will get the product chosen variable when you click on Submit):
if ($HTTP_GET_VARS['prod_num']) $prod_num_chosen = tep_db_prepare_input($HTTP_GET_VARS['prod_num']);
just after:
if ($jahr_end == 0) { $jahr_end = date("Y"); }
Also changed the variable:$prod_num to be $prod_num_chosen in the line:
$products_query_raw = "select op.products_id, op.products_model, op.products_name, sum(op.products_quantity) as quantitysum , sum(op.products_price*op.products_quantity)as gross FROM " . TABLE_ORDERS . " as o, " . TABLE_ORDERS_PRODUCTS . " AS op WHERE op.products_id='$prod_num_chosen' AND o.date_purchased BETWEEN '" . $start_date . "' AND '" . $end_date . " 23:59:59' AND o.orders_id = op.orders_id GROUP BY op.products_id";
Then when I choose a product and click Submit, it shows the results.
Hope this helps,
Pierre Forget
More... (http://www.oscommerce.com/community/contributions,4040)
I had a problem where I was always having zeros in all the results, whichever products was chosen.
Added at the beginning of the file stats_products_per_month.php (this will get the product chosen variable when you click on Submit):
if ($HTTP_GET_VARS['prod_num']) $prod_num_chosen = tep_db_prepare_input($HTTP_GET_VARS['prod_num']);
just after:
if ($jahr_end == 0) { $jahr_end = date("Y"); }
Also changed the variable:$prod_num to be $prod_num_chosen in the line:
$products_query_raw = "select op.products_id, op.products_model, op.products_name, sum(op.products_quantity) as quantitysum , sum(op.products_price*op.products_quantity)as gross FROM " . TABLE_ORDERS . " as o, " . TABLE_ORDERS_PRODUCTS . " AS op WHERE op.products_id='$prod_num_chosen' AND o.date_purchased BETWEEN '" . $start_date . "' AND '" . $end_date . " 23:59:59' AND o.orders_id = op.orders_id GROUP BY op.products_id";
Then when I choose a product and click Submit, it shows the results.
Hope this helps,
Pierre Forget
More... (http://www.oscommerce.com/community/contributions,4040)