Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Low Stock Report v2.0


homewetbar

Recommended Posts

Wrong calculation!

 

This is just the thing I need. Greatful for this contribution. I have installed it on my store and at first look it seem like its working, but it calculates the remaining days left on a product - totally wrong!

 

For example:

 

Name: Rollerblades

Qty avaiable: 6

Model: xxxx

60 days sales: 17

Est. Stock: 116 days

 

Ive installed the latest version of low stock report (v2.01)

 

Could it be something wrong in stats_low_stock.php?

 

Please help me out. I really need this one to work

 

/Zuncan

I have exactly the same problem. My low stock report shows:

 

No. Product Name Qty Available Model 60 Day Sales Est. Stock

01. Product 5 Model 5 +60 Days

02. Product 3 Model 8 124 Days

03. Product 4 Model 5 264 Days

14. Product 1 Model 2 165 Days

17. Product 2 Model 1 660 Days

19. Product 3 Model 2 495 Days

24. Product 3 Model 21 990 Days

25. Product 5 Model 3 110 Days

 

Why is this calculating wrong? Any help would be appreciated.

Thanks,

Irin.

Link to comment
Share on other sites

  • Replies 80
  • Created
  • Last Reply

Top Posters In This Topic

Hi!

 

I've installed version v2.0a because the latest version was screwed up (v2.01). The thing is that v.2.0a is calculating on the last 30 days of sales and lets me know 15 days before a product runs out of stock.

 

I want it to be just like v2.01 - It calculates on the last 60 days and alarms if there is 20 days left before a product runs out of stock.

 

Could someone help me out? What code to replace with what code?

 

Greatful for help / Zuncan

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

Quick fix on the year logic so the dates will calculate properly, this was not noticable until now because 2 months prior was not a different year as it currently is (january)

 

CHANGE:

$timestamp = mktime($hours,$minutes,$seconds,$month-$pastMonths,$day,$year-$pastYears);

 

TO:

$timestamp = mktime($hours,$minutes,$seconds,$pastMonths,$day,$year-$pastYears);

 

 

This will fix the sales for the last 60 days, this does not completely fix the est 60 days sales I'll try to figure that out a post a solution later.

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

New Version Posted 2.02:

 

- Reapplied 0 division error fix, apparently some people were still having a problem with this in 2.01

- Fixed the incorrect stock and 60 days estimate caused by the change of the year.

- Added a new feature that filters out items that have more than 60 days stock and have inventory > 0.

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

One thing on my wishlist now would be to be able to sort the products by how many days are left and NA meaning 0. That way you can get a better overview of what product is most critical and so on.

 

Im not a php guru, but here is some improvments that could be done to this contribution:

 

- Ability to set own period (30 days, 47 days, 60 days or whatever)

 

- Ability to filter out all products that do no show up in red text.

 

- Ability to set own minimum days left before shown in red

 

- When one has updated the stocklevel of a product its sends you automaticly back to the same place in low stock report.

 

- Ability to set how many products to show per page (like 6, 9, 12, 40, 100 and so on). As it is now, I have to go thru 31 pages to look at my stocklevels. Thats because I have like 500 different products and only display 12 per page. Would be neat with only one or two pages.

 

 

Well this is just the updates that I can think of right away. Would be great if they where done someday.

 

Thx for a great contribution!

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

One thing on my wishlist now would be to be able to sort the products by how many days are left and NA meaning 0. That way you can get a better overview of what product is most critical and so on.

 

Im not a php guru, but here is some improvments that could be done to this contribution:

 

- Ability to set own period (30 days, 47 days, 60 days or whatever)

 

- Ability to filter out all products that do no show up in red text.

 

- Ability to set own minimum days left before shown in red

 

- When one has updated the stocklevel of a product its sends you automaticly back to the same place in low stock report.

 

- Ability to set how many products to show per page (like 6, 9, 12, 40, 100 and so on). As it is now, I have to go thru 31 pages to look at my stocklevels. Thats because I have like 500 different products and only display 12 per page. Would be neat with only one or two pages.

Well this is just the updates that I can think of right away. Would be great if they where done someday.

 

Thx for a great contribution!

 

 

You can set your own period just change the default months in the code near the top. Maybe you should add these on if you want them, I see you have over 300 posts and no contributions, osCommerce is supposed to be a give and take not just take...

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Dont get mad now. Of course i dont just take. I help wherever I can help. The thing is that I dont have any php-skills at all. The list with thing that could be done to improve this contribution was only meant as help in giving ideas. I would have done it myself if I could...

So what?! Who care in a hundred years anyway?

Link to comment
Share on other sites

  • 2 weeks later...

Hi

 

Ive installed version 2.2 of this contribution and im getting an error in the /admin/stats_low_stock.php file

 

Parse error: parse error, unexpected T_REQUIRE in /****/****/*****/*****/catalog/admin/stats_low_stock.php on line 1

 

I think someone posted this before and mentioned trying version 2.0a, which i did but i still get the same error, anyone any ideas on this?

 

Thanks in advance :)

Edited by skwish
Link to comment
Share on other sites

  • 3 weeks later...

Quick fix, if the month is the same as the look back days, by default this is 2 = february, no 60 day sales will show. To fix replace the code under :

 

// Check if looking back past this year if so minus months and year

 

WITH:

 

// Check if looking back past this year if so minus months and year
$pastYears = 0;
if ($pastMonths > $month) {
$lookbackMonth = 12 - ($pastMonths - $month);
$pastYears = 1;
} else {
$lookbackMonth = $pastMonths;
}

 if (isset($HTTP_GET_VARS['start_date'])) {
$start_date = $HTTP_GET_VARS['start_date'];
 } else {
 $timestamp = mktime($hours,$minutes,$seconds,$lookbackMonth,$day,$year-$pastYears);
 $start_date = strftime('20%y-%m-%d',$timestamp);

 }

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

Hi

 

Ive installed version 2.2 of this contribution and im getting an error in the /admin/stats_low_stock.php file

 

Parse error: parse error, unexpected T_REQUIRE in /****/****/*****/*****/catalog/admin/stats_low_stock.php on line 1

 

I think someone posted this before and mentioned trying version 2.0a, which i did but i still get the same error, anyone any ideas on this?

 

Thanks in advance :)

 

I got the same error.

Link to comment
Share on other sites

If we click Low Stock Report after installing this contribution, what are we supposed to see exactly? After installing a copy of this, it appears to be telling me that I have 11 products in low stock, but I don't see any products listed at all; it's just blank. On the other hand, my store hasn't been opened (in OS Commerce, at least) for 60 days yet. Does it need to be active for 60 days before the modification works? Or could something else be making my product list of low-stock items invisible?

Link to comment
Share on other sites

  • 2 weeks later...

Parse error: parse error, unexpected T_REQUIRE in /home/eznails/public_html/ezshop/admin/stats_low_stock.php on line 1

 

I don't get this.. 2.01 works but does not show the disabled products, so I am working now with 2.02

 

I read here where it says:

New Version Posted 2.02:

- Reapplied 0 division error fix, apparently some people were still having a problem with this in 2.01

 

so apparently whatever this fix is, because no where can I find where it states what this fix is or where it is applied or how to apply it.. it still does not work.. my client is SCREAMING for this report.. can someone please lend a quick hand??

 

thanks

Edited by wkdwich

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

I got the same error.

 

 

I recently encountered this with my new server as well. I tried installs all the way back to the first one under the contrib but it does not fix it. I'll try to post a fix later this week or next if I can debug it.

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

I recently encountered this with my new server as well. I tried installs all the way back to the first one under the contrib but it does not fix it. I'll try to post a fix later this week or next if I can debug it.

 

Please My cleint is making me nuts here.. I havent the 1st clue were to start looking to fix this one.. when you figure it out, don;t forget to post any fix..

 

thanks

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

OK.. I made some progress here.. I was REALLY looking at the 2.2 version and the older version.. I noted in my notetab pro, inthe status bar it said the file was MAC formatted.. while the older version was unix formatted.. I copied the file to a new doc and resaved it.. and now I have a report.. it's not 100% on the mark yet.. but it is there and no more T_REQUIRE error

 

I'm going to poke it it some more and see where I get..

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

My client wants a report to show all inactive items, not just low stock.. we're not using the stock feature, so marking an item inactive can occur on an item with 999 stock quantity -- then it won't show in the report

 

I've modified it to show the green/red status lights in the report

I have managed to figure out how to create a query in phpMyAdmin to select only the inactive items

 

I can not figure out how to get this report to give me all items marked inactive, regardless of the stock level

 

Here is the changes I made to the files to get as far as I did:

catalog\admin\stats_low_stock.php
[ find ]
			<td class="dataTableHeadingContent" align="right"><?php echo '<font color=000000>' . TABLE_HEADING_DAYS . '</font>'; ?>?</td>

[ add below ]
			<td class="dataTableHeadingContent" align="right"><?php echo '<font color=000000>' . TABLE_HEADING_STATUS . '</font>'; ?>?</td>


[ find ]
		<td align="right" class="dataTableContent"><?php echo $productSold['quantitysum']; ?></td>
		<td align="right" class="dataTableContent"><?php echo $daysSupply; ?></td>


[ add below ]
			<td class="dataTableContent" align="center">
<?php
  if ($products['products_status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '??<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>??' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?></td>

 

catalog\admin\includes\languages\english\stats_low_stock.php
[ find ]
define('TABLE_HEADING_DAYS', 'Est. Stock');
[ add below ]
define('TABLE_HEADING_STATUS', 'Status');

 

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

 

then I got this piece of code somewhere :

//show all inactive regardless of stock level
if ($products['products_status'] == 0) {
$display = y;
}

but thats as far as I can get :) I tried dropping that in, but no changes..

 

The query I made to grab all the inactives in phpMyAdmin:

SELECT * FROM `products` WHERE `products_status` = 0

Can someone help me change the query to ALL INACTIVE REGARDLESS OF STOCK LEVEL ?

 

thanks

Debbie D
Franklin County, VA "Moonshine Capitol of the World"
osCmax Mobile Template oscmaxtemplates.com

Link to comment
Share on other sites

  • 1 month later...

has anyone made this compatiable with QTPro?

Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back!

 

Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you?

 

There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere.

 

CHOOCH

Link to comment
Share on other sites

My client wants a report to show all inactive items, not just low stock.. we're not using the stock feature, so marking an item inactive can occur on an item with 999 stock quantity -- then it won't show in the report

 

I've modified it to show the green/red status lights in the report

I have managed to figure out how to create a query in phpMyAdmin to select only the inactive items

 

I can not figure out how to get this report to give me all items marked inactive, regardless of the stock level

 

Here is the changes I made to the files to get as far as I did:

catalog\admin\stats_low_stock.php
[ find ]
			<td class="dataTableHeadingContent" align="right"><?php echo '<font color=000000>' . TABLE_HEADING_DAYS . '</font>'; ?>?</td>

[ add below ]
			<td class="dataTableHeadingContent" align="right"><?php echo '<font color=000000>' . TABLE_HEADING_STATUS . '</font>'; ?>?</td>
[ find ]
		<td align="right" class="dataTableContent"><?php echo $productSold['quantitysum']; ?></td>
		<td align="right" class="dataTableContent"><?php echo $daysSupply; ?></td>
[ add below ]
			<td class="dataTableContent" align="center">
<?php
  if ($products['products_status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '??<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>??' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?></td>

 

catalog\admin\includes\languages\english\stats_low_stock.php
[ find ]
define('TABLE_HEADING_DAYS', 'Est. Stock');
[ add below ]
define('TABLE_HEADING_STATUS', 'Status');

 

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

 

then I got this piece of code somewhere :

//show all inactive regardless of stock level
if ($products['products_status'] == 0) {
$display = y;
}

but thats as far as I can get :) I tried dropping that in, but no changes..

 

The query I made to grab all the inactives in phpMyAdmin:

SELECT * FROM `products` WHERE `products_status` = 0

Can someone help me change the query to ALL INACTIVE REGARDLESS OF STOCK LEVEL ?

 

thanks

 

 

Just search for the query in to the db for the admin low stock string and remove it with its closing bracket to remove the stock check.

Most Valuable OsCommerce Contributions:

Also Purchased (AP) Preselection (cuts this resource hogging query down to nothing) -- Contribution 3294

FedEx Automated Labels -- Contribution 2244

RMA Returns system -- Contribution 1136

Sort Products By Dropdown -- Contribution 4312

Ultimate SEO URLs -- Contribution 2823

Credit Class & Gift Voucher -- Contribution 282

Cross-Sell -- Contribution 5347

Link to comment
Share on other sites

  • 1 month later...

I was also getting the unexpected T_REQUIRE error, until I changed the file from MAC format to UNIX format. Now I get the following error instead:

 

Parse error: syntax error, unexpected T_STRING in store/admin/includes/languages/english/stats_low_stock.php on line 1

 

Any ideas?

Link to comment
Share on other sites

Hi! I just downloaded and installed osCommerce 2.2-MS2. Works very nice. Than I added contributions separate_price_413.zip and also hide_products_for_cg_sppc_v103a.zip - still working very nice.

And now finally I installed Low Stock Report v2.0 wich also seems to work until I in the admin panel try to choose Low Stock report. Choosing that gives me this:

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/ordning/public_html/catalog/admin/includes/functions/database.php:13) in /home/ordning/public_html/catalog/admin/includes/functions/database.php on line 13

 

What do you think I have missed?

 

/regards David, sweden.

Link to comment
Share on other sites

  • 1 month later...
I was also getting the unexpected T_REQUIRE error, until I changed the file from MAC format to UNIX format. Now I get the following error instead:

 

Parse error: syntax error, unexpected T_STRING in store/admin/includes/languages/english/stats_low_stock.php on line 1

 

Any ideas?

 

Yea, now it's the file in your Language directory. Switch that file to UNIX as well, and your good. Worked for me.

Link to comment
Share on other sites

  • 4 weeks later...

I was just customizing this contrib so that I could sort by all of the fields (I have it working), and I found a problem that some of you might run into if you change the variable on the following line:

$pastMonths = 2; //edit: if this is zero, the script throws warnings

The column "60 Day Sales" will show sales for as many months that you set $pastMonths to.

 

I set $pastMonths to 4 so that I could get a better average. I usually order stock monthly, I almost broke the bank ordering two months of products.

 

Just thought you might want to take caution.

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...