Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Order Tracker New Contrib....


jello1

Recommended Posts

How do you install it. can not work out the instructions

i.e

---------------------------------------------

Installation instructions

 

<snip>

-----------------------------------

 

I Think the instructions need to be simpler. not sure what files to edit ie what is this?

 

3) Save the followig as /admin/includes/language/english/orders_tracking.php:

<?php

define('HEADING_TITLE', 'Daily Sales Summary');

define('HEADING_SELECT_YEAR', 'Enter Year');

?>

---------------

Sorry, I should have simply created that file, and included it in the contrib release. What I am trying to say is this:

1) open a text editor

2) type in :

<?php

define('HEADING_TITLE', 'Daily Sales Summary');

define('HEADING_SELECT_YEAR', 'Enter Year');

?>

3) save the file as orders_tracking.php

4) copy your new file to /catalog/admin/includes/languages/english

 

I didn't translate it into any other languages, but you can translate it if needed, and put the file into your own language diretory.

 

Does that help?

 

-jared

Link to comment
Share on other sites

  • Replies 260
  • Created
  • Last Reply

Top Posters In This Topic

If I remember correctly, the sales figured do not decrement for gift vouchers. They query the orders_total table directly, and sum based on that. If you have edited the DB directly, changed order dates, deleted orders, and not done it 100% correctly, then some figures can be off.

 

If you delete orders via the osC Admin, though, that should nice and clean, and your order total info should be fine.

 

-jared

Link to comment
Share on other sites

Great contribution! Really simple and the numbers are just what is expected (what is shown in the orders list. It is the only sales report I have found that is compatible with the Edit Orders contribution.

 

On that subject do you know whether there has there been a fix to make it possible to edit orders and still get Monthly Sales and Tax Report and Sales Report 2 to give the right numbers?

Link to comment
Share on other sites

my guess is that the problem is actually with the order editor, with not correctly updating the orders_total table. Orders Tracking just reads those tables - - we don't change them.

 

Therefore, if after Order Editor changes, the totals are no longer accurate, then the Order Editor didn't change all that it should (IMO).

 

-jared

Link to comment
Share on other sites

I finally figured out what was wrong with "yesterday" stats when today is the first day of the month. They were always reported as 0 sales, $0 total. Tomorrow it'd always be correct.

 

I'm sorry, I know I ought to provide better instructions, but it's late, and I know that my 2 year old is going to wake up in just a few hours.

 

Here's how you fix it:

 

1) find this:

 

$last_month = $mo-1;

if ( $last_month == 0) $last_month = 12; //if jan, then last month is dec (12th mo, not 0th month)

$day = date('d') - 1;

if ($day == "0") //today is the first day of the month, now "Thirty days hath November . . ." for the prev month

{ if ( ($last_month == 1) OR ($last_month == 3) OR ($last_month == 5) OR ($last_month == 7) OR ($last_month == 8) OR ($last_month == 10) OR ($last_month == 12) )

$day = "31";

elseif ( ($last_month == 4) OR ($last_month == 6) OR ($last_month == 9) OR ($last_month == 11) )

$day = "30";

//calculate Feb end day, including leap year calculation from http://www.mitre.org/tech/cots/LEAPCALC.html

else {

if ( ($year % 4) != 0) $day = "28";

elseif ( ($year % 400) == 0) $day = "29";

elseif ( ($year % 100) == 0) $day = "28";

else $day = "29";

}

}

 

// next line to normalize $day format to 2 digits

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

$date = date('Y-m');

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$date-$day%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$l=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$l++;

}

mysql_free_result($result);

$yesterday=$l;

// $yesterday = $day;

 

and change it to this:

 

$last_month = $mo-1;

if ( $last_month == 0) $last_month = 12; //if jan, then last month is dec (12th mo, not 0th month)

$day = date('d') - 1;

if ($day == "0") //today is the first day of the month, now "Thirty days hath November . . ." for the prev month

{ $yesterday_mo=$last_month;

if ( ($last_month == 1) OR ($last_month == 3) OR ($last_month == 5) OR ($last_month == 7) OR ($last_month == 8) OR ($last_month == 10) OR ($last_month == 12) )

$day = "31";

elseif ( ($last_month == 4) OR ($last_month == 6) OR ($last_month == 9) OR ($last_month == 11) )

$day = "30";

//calculate Feb end day, including leap year calculation from http://www.mitre.org/tech/cots/LEAPCALC.html

else {

if ( ($year % 4) != 0) $day = "28";

elseif ( ($year % 400) == 0) $day = "29";

elseif ( ($year % 100) == 0) $day = "28";

else $day = "29";

}

}

 

// next line to normalize $day format to 2 digits

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

$date = date('Y-m');

$year = date('Y');

$month = date('m') - 1;

// next line to normalize $day format to 2 digits

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

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$year-$month-$day%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$l=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$l++;

}

mysql_free_result($result);

$yesterday=$l;

 

 

 

3) find this:

 

<TR class="dataTableRow">

<td class="dataTableContent">Yesterday <?php echo "$mo-$day"; ?></TD>

<td class="dataTableContent"><?php echo $yesterday ?></TD>

<td class="dataTableContent" align=right>$<?php echo $orders_yesterday ?></TD>

<td class="dataTableContent" align=right>$<?php echo $yesterday_avg ?></TD>

</TR>

 

and change it to this:

 

<TR class="dataTableRow">

<td class="dataTableContent">Yesterday <?php echo "$yesterday_mo-$day"; ?></TD>

<td class="dataTableContent"><?php echo $yesterday ?></TD>

<td class="dataTableContent" align=right>$<?php echo $orders_yesterday ?></TD>

<td class="dataTableContent" align=right>$<?php echo $yesterday_avg ?></TD>

</TR>

 

 

That should do it!

 

-jared

Link to comment
Share on other sites

Thanks, Chris!

 

If you can send me the details on how you made this work with MS1, I'll make sure it gets included with the next release of this contrib.

 

Jello - - thank you so much for coming up with this contrib. I know that I've put a lot of time into it, but I'd have never come up with it on my own. Many thanks (and you can see that many others are also thankful!)

 

 

-jared

Link to comment
Share on other sites

okay - - so apparently that code wasn't as good as I thought. Now I notice that "yesterday" is reported to be the -1th day (yup, negative one-th) day of no month at all.

 

Apparently that modified code I posted still needs some work.

 

-jared

Link to comment
Share on other sites

ok - - I think I fixed it. Here's that code section again:

 

$last_month = $mo-1;

if ( $last_month == 0) $last_month = 12; //if jan, then last month is dec (12th mo, not 0th month)

{ $day = date('d') - 1;

$yesterday_mo = $mo;

}

if ($day == "0") //today is the first day of the month, now "Thirty days hath November . . ." for the prev month

{ $yesterday_mo=$last_month;

if ( ($last_month == 1) OR ($last_month == 3) OR ($last_month == 5) OR ($last_month == 7) OR ($last_month == 8) OR ($last_month == 10) OR ($last_month == 12) )

$day = "31";

elseif ( ($last_month == 4) OR ($last_month == 6) OR ($last_month == 9) OR ($last_month == 11) )

$day = "30";

//calculate Feb end day, including leap year calculation from http://www.mitre.org/tech/cots/LEAPCALC.html

else {

if ( ($year % 4) != 0) $day = "28";

elseif ( ($year % 400) == 0) $day = "29";

elseif ( ($year % 100) == 0) $day = "28";

else $day = "29";

}

}

 

// next line to normalize $day format to 2 digits

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

$date = date('Y-m');

$year = date('Y');

if ($yesterday_mo == $last_month) //if today is the first day of the month

$month = date('m');

else

$month = date('m') - 1;

// next line to normalize $day format to 2 digits

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

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$year-$month-$day%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$l=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$l++;

}

mysql_free_result($result);

$yesterday=$l;

 

 

seems to have fixed it for me.

 

-jared

Link to comment
Share on other sites

grrrrr. another day, I think I have it fixed and it still shows "yesterday" stats for last month. I'm still getting the month wrong. Probably something easy.

 

-jared

Link to comment
Share on other sites

ok - - should now be fixed, plus the logic looks much better to me.

 

if someone else can confirm that this works, then I'll release this as an update to the contrib. I'll take a look at the currency thing first, but since my shop is in $USD, I'm not sure I'll see the same issue.

 

Any takers for $currenty verification once I take a crack at it?

 

-jared

Link to comment
Share on other sites

new code section, as per my previous post:

 

$last_month = $mo-1;

$yesterday_mo = date('m');

if ( $last_month == 0) $last_month = 12; //if jan, then last month is dec (12th mo, not 0th month)

{ $day = date('d') - 1;

}

if ($day == "0") //today is the first day of the month, now "Thirty days hath November . . ." for the prev month

{ $yesterday_mo=$last_month;

if ( ($last_month == 1) OR ($last_month == 3) OR ($last_month == 5) OR ($last_month == 7) OR ($last_month == 8) OR ($last_month == 10) OR ($last_month == 12) )

$day = "31";

elseif ( ($last_month == 4) OR ($last_month == 6) OR ($last_month == 9) OR ($last_month == 11) )

$day = "30";

//calculate Feb end day, including leap year calculation from http://www.mitre.org/tech/cots/LEAPCALC.html

else {

if ( ($year % 4) != 0) $day = "28";

elseif ( ($year % 400) == 0) $day = "29";

elseif ( ($year % 100) == 0) $day = "28";

else $day = "29";

}

}

 

// next line to normalize $day format to 2 digits

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

$year = date('Y');

$query = "SELECT * FROM orders WHERE date_purchased LIKE \"$year-$yesterday_mo-$day%\"";

$result = mysql_query($query) or die("Query failed : " . mysql_error());

$l=0;

while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {

$l++;

}

mysql_free_result($result);

$yesterday=$l;

Link to comment
Share on other sites

I use both. This contrib does daily, plus sales projections based on current data. There are stats and links to current orders and who's online.

 

The Monthly report does monthly reports.

 

-jared

Link to comment
Share on other sites

hi jared,

 

I have added this great contrib into osC 2.2 MS2 and followed the thread with some of the necessary modification. I have just installed this contrib and I noticed one problem. During testing this contrib, I added one order on Mar 2004 with order amount $190. It did not show this order. The order count showed 1, but the dollar column is $0.00. As for the orders on April 2004, it shows correctly.

 

Kindly tell me what went wrong? Thank you for your time. :D :D

Link to comment
Share on other sites

thank you for this contrib it is great!!!

 

Is there a way to subtract refunded orders from the daily, monthly and yearly totals, or to add the refunded orders totals $ amounts. I added the stauts (4 in my case) to the report so it shows the number of orders refunded but not the $ amount, It also throws my totals off since I have given the money back except for shipping.

 

Thank you

Jeff

Link to comment
Share on other sites

  • 3 weeks later...

Jeff: How are you refunding the orders? If I delete an order, that operation properly adjusts the orders and orders_total table. Since orders_tracking just reads from those tables, that is all it has to go on.

 

If you leave the refunded orders in the system, and don't somehow change the order total to zero, then there is no way that I am aware of to disinclude those figures from the sales totals.

 

Paul: If you look in the bottom of the code, you can see that the dollar signs ($) are hardcoded. If you replace them with a ? symbol that should work. It's not localized, and I'm not sure how to do it. I am sure that I could figure it out, but I'm in th middle of trying to open a retail store and that's taking up most of my available time.

 

Sorry.

 

-jared

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...