Jump to content
jello1

Order Tracker New Contrib....

Recommended Posts

correct fix:

 

uncomment the following line in admin/orders_tracking.php:

    if ($yesterday_month <10) {$yesterday_month = "0$yesterday_month";}

 

I don't remember why I commented it out in the first place . . .

 

-jared

Share this post


Link to post
Share on other sites
Ok - - I'm sleepier than I thought. That won't work on days other than the first day of the month.

 

Better fix forthcoming.

 

-jared

been there too. no worries, buddy.


Most likely your question has been answered, please do a search first.

Share this post


Link to post
Share on other sites

Now I know why I commented it out. It made today's "yesterday" date 009-01 instead of 09-01.

 

I'll put some better login in there than just that line.

 

-jared

Share this post


Link to post
Share on other sites

Can anyone help me out with upgrading to the latest version of this and please tell me how i can list the product that was bought in orders.php in admin?

 

Thanks

Danny

Edited by computerwiz5

Share this post


Link to post
Share on other sites
Can anyone help me out with upgrading to the latest version of this and please tell me how i can list the product that was bought in orders.php in admin?

 

Are you wanting to see the actual products that were purchased that day? I've been thinking of coding that up (my wife actually suggested it to me today) but haven't yet thought of how would be the best way to display it. A separate page would be appropriate, I suppose.

 

What specific problems are you having while trying to upgrade to this latest version?

 

-jared

Share this post


Link to post
Share on other sites

Why is this commented out:

 

//    if ($first_day_of_month == 1)  // if today is the first day of the month, then run yesterday stats for last_month,day instead of this_month,day

Is this needed by anything or can it be deleted? Or does it need to be uncommented?

Share this post


Link to post
Share on other sites

It's commented out because it doesn't work correctly. :)

 

I can't seem to get "yesterday" stats to work consistently on the 1st day of the month. Uncommenting that line made mine work on the 1st of the month, but then messed up the yesterday stats once time rolled over to the 2nd of the month.

 

I have some ideas to fix it, but it's really only possible to test them one day a month. :(

 

As it is, it's not that bad of a bug, as it only happens 1/30th of the time, on average.

 

-jared

Share this post


Link to post
Share on other sites

Just realized that I've never put in the currency fix from http://forums.oscommerce.com/index.php?sho...ndpost&p=330236 . Can a non-US shop verify that the code in that post works for them?

 

Hi

 

Thanks for this contribution, beats the hell out of cut and paste to excell :thumbsup:

 

I have a non US shop and the currency is still in $. I tried the Fix you mentioned for the earlier version but it does not seem to work.

 

Any suggestions

 

Thanks

Kobus

Share this post


Link to post
Share on other sites

Jared,

Thanks for this contribution. I'm fairly new to using OSCommerce. OK, really new. I am getting redirected to the forbiden.php web page when I try to access either of the pages. Can you help me track down this problem? Just point in the right direction and I'll let you know what I find out. I am logged in as admin.

 

Thanks

Share this post


Link to post
Share on other sites

cilliers: I am not sure how to make this work in alternate currencies. I've never tried. I'll have a look at the code and see if I can figure it out.

 

ecockrell: I'm sorry, I'm not aware of any forbiden.php page. Is it from some other contribution you installed?

Share this post


Link to post
Share on other sites
I'm sorry, I'm not aware of any forbiden.php page.  Is it from some other contribution you installed?

I have CRELoaded installed. The forbiden.php page is called from the admin\inlcudes\functions\general.php file when the page is not listed in the Admin_Files table. I added the page names to the table and now it's working correctly.

Share this post


Link to post
Share on other sites

i just noticed a problem with orders_tracking.php. In my case it affected the "yesterday" totals, but it could affect the other summations as well.

 

For some reason, there was an orders_id missing in the sequence (e.g. 1,2,3,5,6). i think it happened because a transaction was declined, the order was deleted, and the mysql sequencer moved to the next ID for the next order. but regardless of why the ID was missing, it screwed everything up, because of the way $yesterday_last_order_id and $twodaysago_last_order_id rely on sequential order ids.

 

All of that could be updated to not care about order IDs, if you just use some more direct date calculations. For example, to get yesterdays date, use something like this:

$time = strtotime( $currDate );

$yesterTime = $time - 24*3600;

$yesterday = date( 'Y-m-d', $yesterTime );

 

Then you can just query for orders based on date rather than based on order ids.

 

If I had some spare time I would crank it out but I don't right now, so HTH...

Share this post


Link to post
Share on other sites

I'll look into the date simplification. You're right, it's a mess. It never occured to me to convert it to Unix time and then convert it back. If that works the way I think it will, it'll make the code _much_ simpler. What's in there now wasn't fun when I was writing it, it doesn't work right a few % of the time, and it's not particularly entertaining now. :)

 

I thought I'd fixed it so that it didn't rely on sequential order numbers - - been a while. You're right though, I just tested it and when I delete orders, it only grabs the most recent sequential ones.

 

Looks like it's time for me to work on it some more. :)

 

-jared

Share this post


Link to post
Share on other sites

one other thing that might help simplify is to use sprintf().

for example, this:

if ($yesterday <10) {$yesterday = "0$yesterday";}

can be switched to this:

$yesterday = sprintf( "%02d", $yesterday );

Share this post


Link to post
Share on other sites

There have been several questions about using this in other currencies.

 

I think one of the most useful things would be to get this working for other currencies. It should be so simple but I tried and the code is littered with hundreds of $ signs. Knowing which ones represent US$ and which ones are just $ is quite beyond me and I gave up after a couple of hours. The currency fix given last year didn't really explain how to fix the problem.

Share this post


Link to post
Share on other sites

I agree. I hope to be able to spend some time on this soon.

 

-jared

Share this post


Link to post
Share on other sites

David (Radders): I've made some basic changes in the code to use the currency symbol for the store's preferred currency.

 

Here's what I did:

 

The top now reads:

  require('includes/application_top.php');

// get main currency symbol for this store
 $currency_query = tep_db_query("select symbol_left from " . TABLE_CURRENCIES . " where currencies_id = '1' ");
 $currency_symbol_results = tep_db_fetch_array($currency_query);
 $store_currency_symbol = tep_db_output($currency_symbol_results['symbol_left']);

 

I just added those 4 lines.

 

Then, I did a search and replace, changing all of these:

$<?php echo

to these:

<?php echo $store_currency_symbol .

 

Do it one by one, just to be careful, but that should take care of all of the monetary displays in the bottom 1/2 of the file.

 

It worked in my testing, but please let me know if it suits your needs, or what changes it may need. Yes, the whole thing needs some code clean-up, but I want to know specifically if this takes care of your currency issue.

 

-jared

Share this post


Link to post
Share on other sites

Hi!

 

I have just installed the contriubution which is exactly what the accountants have asked for. It's great!

 

However i have run into a small problem, I am getting an error on the orders_tracking_zones.php page, when it loads I get this.

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Sila ' and date_purchased >= '2004-1-01 00:00:00' and date_purc

 

select count(*) as count from orders where customers_state = 'M'Sila ' and date_purchased >= '2004-1-01 00:00:00' and date_purchased <= '2004-12-31 11:59:59'

 

and I am guessing it comes from line 95

    $location_pending_query = tep_db_query("select count(*) as count from " . TABLE_ORDERS . " where customers_state = '". $customers_location['zone_name'] ." ' and date_purchased >= '$year-$startmonth-01 00:00:00' and date_purchased <= '$year-$endmonth-31 11:59:59'");

 

or something is wrong with the database. I am not sure what 'Sila' is.

 

Any help would be greatly apperciated.

 

Kind Regards

 

Peter


Thanking God for a beautiful day??

Share this post


Link to post
Share on other sites

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.

 

You could delete all the zones that have apostrophes, but, depending on which zones you have installed, that could be a while.

 

I'll try and find the code (several others have already written this type of code) that parses and fixes apostrophes.

 

-jared

Share this post


Link to post
Share on other sites

Hi Jared,

 

thanks for your advice I have been through the table and removed all the ( ' ), but saved a copy orginalfor the fix.

It works great now!

 

Just wondering though is there anyway the table organise in terms of domestic and export. I have been asked if we could list our stats by UK and Export?

 

Many thanks

 

Peter


Thanking God for a beautiful day??

Share this post


Link to post
Share on other sites

Not at present. All we have to do is throw zone_country_id into the query (from the zones table) and sort by it. Perhaps I can do that later tonight - - right now my 1 yo is starting to wake up. :)

 

-jared

Share this post


Link to post
Share on other sites

I was wondering if any one has added SALE TAX tracking to this report? I would like see tax numbers on these reports.

 

Thanks,

jeff

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×