Guest Posted January 6, 2005 Share Posted January 6, 2005 Below is the modification if you want to see Countires rather then Counties/states etc. from line 93 to 100 $location_query = tep_db_query("select countries_name from " . TABLE_COUNTRIES . " "); while ($customers_location = tep_db_fetch_array($location_query)) { $location_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where customers_country = '". $customers_location['countries_name'] ." ' and date_purchased >= '$year-$startmonth-01 00:00:00' and date_purchased <= '$year-$endmonth-31 11:59:59'"); $location_pending = tep_db_fetch_array($location_pending_query); if ( $location_pending['count'] != 0 ) //if there are orders in this zone, print the zone and the count { $location_contents .= '<tr class="dataTableRow"><td class="dataTableContent">' . $customers_location['countries_name'] . '</font></td><td class="dataTableContent">' . $location_pending['count'] . '</td></tr>'; } Enjoy Zebrabanana Quote Link to comment Share on other sites More sharing options...
AWWWW.WAHWAH Posted January 6, 2005 Share Posted January 6, 2005 I'm kinda curious. I installed this late last year in 2004. There seems to be one discrepency and maybe I missed it in a previous post. For September 2003, it shows one sale which is correct but for the dollar amount it shows $0.00 as if there was no sale. This is the only month it is doing it for. So the year total dollar amount is wrong but the sale count is correct. Quote Link to comment Share on other sites More sharing options...
Guest Posted January 6, 2005 Share Posted January 6, 2005 I'm kinda curious. I installed this late last year in 2004. There seems to be one discrepency and maybe I missed it in a previous post. For September 2003, it shows one sale which is correct but for the dollar amount it shows $0.00 as if there was no sale. This is the only month it is doing it for. So the year total dollar amount is wrong but the sale count is correct. <{POST_SNAPBACK}> I'm sorry, I haven't had time to work on this in quite a while. I do remember that there was an issue where you only had one sale in a month that the numbers were not right. I'll look into it if I get the time, but I'm mired down in several other things at the moment. -jared Quote Link to comment Share on other sites More sharing options...
radders Posted January 6, 2005 Share Posted January 6, 2005 David (Radders): I've made some basic changes in the code to use the currency symbol for the store's preferred currency. I want to know specifically if this takes care of your currency issue. -jared <{POST_SNAPBACK}> Thanks Jared, I only just spotted your reply. As easy as that eh? And there I was trying to change them all by hand :blush: That worked (but it gave all the results in US$ which is currency 1). I just made a small change so that it would take the default currency code instead. require('includes/application_top.php'); // get main currency symbol for this store $currency_query = tep_db_query("select symbol_left from " . TABLE_CURRENCIES . " where code = '".DEFAULT_CURRENCY."' "); $currency_symbol_results = tep_db_fetch_array($currency_query); $store_currency_symbol = tep_db_output($currency_symbol_results['symbol_left']); Quote Link to comment Share on other sites More sharing options...
Guest Posted January 8, 2005 Share Posted January 8, 2005 That looks better. Thanks, David! Now I have 3 contrib updates to release from comments/improvements in the support forums. >_< It's good to know that I'm helping, though! Odd to think that just over a year ago, I'd never heard of osC. Now I can't seem to stop thinking about it, feel like I need to change something, get asked about it . . . It never ends. :D -jared Quote Link to comment Share on other sites More sharing options...
Guest Posted January 30, 2005 Share Posted January 30, 2005 Hi I think this is a great contribution, thanks. I did notice a small problem, not sure if it has already been mentioned. After the new year the total orders for 2005 kept last years repeat orders, so the total order for 2005 looked something like 0 / 50* ie I had more repeat orders than total orders for the year. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 1, 2005 Share Posted February 1, 2005 Hi I think this is a great contribution, thanks. I did notice a small problem, not sure if it has already been mentioned. After the new year the total orders for 2005 kept last years repeat orders, so the total order for 2005 looked something like 0 / 50* ie I had more repeat orders than total orders for the year. <{POST_SNAPBACK}> 1) Find this: # Find all repeat orders $date = date('Y-m-d'); $query = "SELECT customers_id FROM orders ORDER by customers_id"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $repeats=0; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $col_value) { $cust_id=$col_value; if ( $cust_id == $cust_id_last ) { $repeats++; } $cust_id_last=$cust_id; } } mysql_free_result($result); and add this just above it: # Find all repeat orders this year $query = "SELECT customers_id FROM orders WHERE date_purchased LIKE \"$year%\" ORDER by customers_id"; $result = mysql_query($query) or die("Query failed : " . mysql_error()); $repeat_orders_this_year=0; while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) { foreach ($line as $col_value) { $cust_id=$col_value; if ( $cust_id == $cust_id_last ) { $repeat_orders_this_year++; } $cust_id_last=$cust_id; } } mysql_free_result($result); 2) Find this: <TR class="dataTableRow" > <td class="dataTableContent" NOWRAP><B>Total <?php echo $year ?> </TD><td class="dataTableContent"><B><?php echo "$total_orders / $repeats"; ?> *</TD><td class="dataTableContent" align=right><B><?php echo $store_currency_symbol . $order ?></TD><td class="dataTableContent" align=right><B><?php echo $store_currency_symbol . $total ?></TD></TR> and change it to this: <TR class="dataTableRow" > <td class="dataTableContent" NOWRAP><B>Total <?php echo $year ?> </TD><td class="dataTableContent"><B><?php echo "$total_orders / $repeat_orders_this_year"; ?> *</TD><td class="dataTableContent" align=right><B><?php echo $store_currency_symbol . $order ?></TD><td class="dataTableContent" align=right><B><?php echo $store_currency_symbol . $total ?></TD></TR> That should do the trick. Did it for me. Thanks for pinging me about this - - I'd had the problem in my own store as well, just never took the time to go look into it. -jared Quote Link to comment Share on other sites More sharing options...
Ernst_Steininger Posted February 7, 2005 Share Posted February 7, 2005 I have installed this contribution and it is just working partly. orders_tracking_zones.php works fine but orders_tracking.php produces this error Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/www/geizpreis_at/catalog/admin/includes/functions/database.php:13) in /home/www/geizpreis_at/catalog/admin/includes/functions/database.php on line 13 any idea what I could do to make it running ? Thanks in advance, Ernst Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2005 Share Posted February 8, 2005 Ernst, which version did you download? Are you sure that you did not make any installation errors? Neither the current nor original code contains the string "tep_db_connect". Did you install any other contribs at the same time, perhaps changing application_top.php? -jared Quote Link to comment Share on other sites More sharing options...
Ernst_Steininger Posted February 8, 2005 Share Posted February 8, 2005 Hello Jared, no I did just install the order Tracker Contribution. And what did confuse me also was that the zones routine did work and the tracker not. I did the same installation on my second shop and it was pretty straight without any problems. As I understand it is a double declaration problem. Does any of the called subroutines call this function declaration? Beste regards, Ernst Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2005 Share Posted February 8, 2005 One key point would be that it worked on your other shop without any problems. Sure, there are functions that connect to the database, but not any differently on one of your servers vs. the other server. ??? -jared Quote Link to comment Share on other sites More sharing options...
Ernst_Steininger Posted February 8, 2005 Share Posted February 8, 2005 Its really strange, I?ll try to look in more deeper. :( I have just thought that you or someone else may be did come into a similar problem and could tell me where to start to look ;) Thanks, Ernst Quote Link to comment Share on other sites More sharing options...
Guest Posted February 8, 2005 Share Posted February 8, 2005 Sorry, I'm useless. :( -jared Quote Link to comment Share on other sites More sharing options...
k1w1guy Posted February 18, 2005 Share Posted February 18, 2005 v2.4 now available at http://www.oscommerce.com/community/contributions,1522 . Let me know what you think! -jared <{POST_SNAPBACK}> Do you have this module where it does NOT calculate in the shipping??? Compared to to modules "month_sales_1.3a" and "stats_products_puchased-2c" (these run consistantly identical) your orders_tracking_v2.5 module runs several hundres dollars higher each month. I'm assuming it's calculating in the shippin on all orders. Can that be seperated?? Thanks, Pete Quote Link to comment Share on other sites More sharing options...
bjraybould Posted February 24, 2005 Share Posted February 24, 2005 I'm getting some strange results in the daily sales summary for today. For example I get the following output, when in fact there have been no sales today. (fyi The yesterday totals are accurate.) Today 02-24 6 (0) * $154.60 $25.77 I am running version 2.5 thanks for any input on this Barry Quote Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2005 Share Posted February 25, 2005 Do you have this module where it does NOT calculate in the shipping??? Compared to to modules "month_sales_1.3a" and "stats_products_puchased-2c" (these run consistantly identical) your orders_tracking_v2.5 module runs several hundres dollars higher each month. I'm assuming it's calculating in the shippin on all orders. Can that be seperated?? Thanks, Pete <{POST_SNAPBACK}> The module currently does not have this functionality. This is but one of several things that I have planned for this module, but have had other things taking up my time recently. I'm getting some strange results in the daily sales summary for today. For example I get the following output, when in fact there have been no sales today. (fyi The yesterday totals are accurate.) Today 02-24 6 (0) * $154.60 $25.77 I am running version 2.5 thanks for any input on this Barry Have you deleted any orders recently, perhaps through phpMyAdmin instead of through the osC admin tool? -jared Quote Link to comment Share on other sites More sharing options...
k1w1guy Posted February 25, 2005 Share Posted February 25, 2005 The module currently does not have this functionality. This is but one of several things that I have planned for this module, but have had other things taking up my time recently. <{POST_SNAPBACK}> That OK. It's nice to know that it is at least working the way it is supposed to. :) Pete Quote Link to comment Share on other sites More sharing options...
esquat Posted May 13, 2005 Share Posted May 13, 2005 The problem seems to be that M'Sila (which I'm guessing is one of the zones listed in your Zones table) has an apostrophe in it, and my code does not yet account for apostrophes. I, too, had this problem that could easily be resolved by using addslashes() around the zone. Line 95 of file orders_tracking_zone.php should read like this: $location_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where customers_state = '". addslashes($customers_location['zone_name']) ."' and date_purchased >= '$year-$startmonth-01 00:00:00' and date_purchased <= '$year-$endmonth-31 11:59:59'"); Great contrib ! Quote Link to comment Share on other sites More sharing options...
esquat Posted May 13, 2005 Share Posted May 13, 2005 Just another hack to this excellent contrib. I found it disturbing that I had to enter a year each time I wanted to play with the Gross Profit Rate in order_tracking.php. Extending line 357 a little makes this more comfortable: // if a year has been entered as part of the URL, use that year instead if (isset($HTTP_GET_VARS['year']) && $HTTP_GET_VARS['year'] != '') $year=$HTTP_GET_VARS['year']; else $year = date('Y'); #current year Best, Ted Quote Link to comment Share on other sites More sharing options...
Guest Posted May 14, 2005 Share Posted May 14, 2005 I, too, had this problem that could easily be resolved by using addslashes() around the zone. Line 95 of file orders_tracking_zone.php should read like this: $location_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where customers_state = '". addslashes($customers_location['zone_name']) ."' and date_purchased >= '$year-$startmonth-01 00:00:00' and date_purchased <= '$year-$endmonth-31 11:59:59'"); Great contrib ! <{POST_SNAPBACK}> Thanks, Ted. That does resolve the parse error, but unfortunately it also fails to display that particular zone at all - - even if you have made sales to that zone. To see what I'm talking about, let's say you've made a sale to California. Edit the state name to be Ca'lifornia. Go back to orders_tracking_zones.php, refresh, and your California stats disappear. I'll fix this, I just have procrastinated due to other projects. Just another hack to this excellent contrib. I found it disturbing that I had to enter a year each time I wanted to play with the Gross Profit Rate in order_tracking.php. Extending line 357 a little makes this more comfortable: // if a year has been entered as part of the URL, use that year instead if (isset($HTTP_GET_VARS['year']) && $HTTP_GET_VARS['year'] != '') $year=$HTTP_GET_VARS['year']; else $year = date('Y'); #current year Best, Ted <{POST_SNAPBACK}> Ted, thanks for that! It took me a few minutes to reproduce the problem, but now that I see it, your fix works wonderfully. -jared Quote Link to comment Share on other sites More sharing options...
Guest Posted May 14, 2005 Share Posted May 14, 2005 Thanks, Ted. That does resolve the parse error, but unfortunately it also fails to display that particular zone at all - - even if you have made sales to that zone. To see what I'm talking about, let's say you've made a sale to California. Edit the state name to be Ca'lifornia. Go back to orders_tracking_zones.php, refresh, and your California stats disappear. My mistake - - The test case I mention is flawed. Ted, your fix works just fine. Thanks! -jared Quote Link to comment Share on other sites More sharing options...
bjraybould Posted May 14, 2005 Share Posted May 14, 2005 Could you help clarify this fix please. It looks very useful. I've added the fix after line 357 of orders_tracking.php and now have the following code. Each time I click the orders_tracking in the admin panel though it forgets the year and gross profit rate. Am I missing something? Also I'm not sure I understand the context of "if a year has been entered as part of the URL" What URL are we talking about here? thank you for working on this excellent contribution Barry $jan = get_month("01", $year); $current_month = get_month($mo, $year); // if a year has been entered as part of the URL, use that year instead if (isset($HTTP_GET_VARS['year']) && $HTTP_GET_VARS['year'] != '') $year=$HTTP_GET_VARS['year']; else $year = date('Y'); #current year Just another hack to this excellent contrib. I found it disturbing that I had to enter a year each time I wanted to play with the Gross Profit Rate in order_tracking.php. Extending line 357 a little makes this more comfortable: // if a year has been entered as part of the URL, use that year instead if (isset($HTTP_GET_VARS['year']) && $HTTP_GET_VARS['year'] != '') $year=$HTTP_GET_VARS['year']; else $year = date('Y'); #current year Best, Ted <{POST_SNAPBACK}> Quote Link to comment Share on other sites More sharing options...
Guest Posted May 17, 2005 Share Posted May 17, 2005 If you enter in 2004, then click "recalculate", then enter in a different profit margin, then "recalculate", it should remember that you're looking at 2004, not 2005 or 2003 or any other year. -jared Quote Link to comment Share on other sites More sharing options...
bjraybould Posted May 17, 2005 Share Posted May 17, 2005 If you enter in 2004, then click "recalculate", then enter in a different profit margin, then "recalculate", it should remember that you're looking at 2004, not 2005 or 2003 or any other year. -jared <{POST_SNAPBACK}> Thanks Jared for your reply. As I understand it, if you leave the order tracking section and then return, you have to re-enter your new profit margin as it does not remember the last profit margin you entered? Is that how it is supposed to work? Barry Quote Link to comment Share on other sites More sharing options...
Guest Posted May 17, 2005 Share Posted May 17, 2005 Correct. I suppose it wouldn't be that difficult to have the profit margin saved to the database - - that just never entered my mind before. If you'd like to change it yourself, search for this in the admin/orders_tracking.php: // if a profit rate has been entered as part of the URL, use that profit rate, else 30% if (isset($HTTP_GET_VARS['profit_rate'])) { $year=$HTTP_GET_VARS['profit_rate']; } else { $profit_rate="30"; } if ($profit_rate=="") { $profit_rate="30"; } and replace "30" with whatever you want. -jared Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.