Jump to content
joenmass

Inventory Management

Recommended Posts

***UPDATE: 8/16/2012***

Visit here for the latest files:

http://www.prestashop.com/forums/topic/181684-inventory-stats-and-profit-margins/

 

I made three simple files that tweaked my admin section so I can have an easier view of all my products in my inventory. I have about 500 products in my website (http://www.justdoodads.com) and the way Prestashop is now it is a little difficult to track what I need to track in my inventory. It is just three simple links that executes three simple database queries that allows me to instantly see all of my products in order by the item number, view all my products that are out of stock and view all of my products that are currently on sale.

 

I don't know if any other person might find it useful. If you are send me an email and I will send you the files.

 

I am fairly new to actually manipulating databases but I a thought someone else might find it useful.

9386_WUK3182LYlk8Owgjxz1M_t

9389_xuUOgndtQtZ76xBjQkpm_t

9390_jEasw684Ylf9h6IaZkrj_t

Edited by joenmass (see edit history)

Share this post


Link to post
Share on other sites

Hi there, I think this would be a popular thing to have so could you post your files in your first post so everyone could use them?.

Regards,

Mark.

Share this post


Link to post
Share on other sites

Here are the files. Still a little bit of work have to be done to clean them up but it works as it is now. You have to enter your database information on all three files where it says:

#connect to MySql
$conn = @mysql_connect ("YOUR_DATA_BASE.COM", "USER_NAME", "PASSWORD")
or die ("Err:Conn");

#select the specific database
$rs = @mysql_select_db ("DATABASE_NAME", $conn )
or die ("Err:Db");

If anyone knows how to automatically grab this information without having to write it in would be great.

THIS DOWNLOADABLE FILE WAS UPDATE OCTOBER 1, 2009

* SEE POST #41 *

AdminInvent.php

Share this post


Link to post
Share on other sites

WOW! this is great!

Anyone feeling like making a module out of it?

Pretty please.... :-)

Share this post


Link to post
Share on other sites

This is super. Thanks, thanks, and thanks.....

Share this post


Link to post
Share on other sites
Here are the files. Still a little bit of work have to be done to clean them up but it works as it is now. You have to enter your database information on all three files where it says:

#connect to MySql
$conn = @mysql_connect ("YOUR_DATA_BASE.COM", "USER_NAME", "PASSWORD")
or die ("Err:Conn");

#select the specific database
$rs = @mysql_select_db ("DATABASE_NAME", $conn )
or die ("Err:Db");

If anyone knows how to automatically grab this information without having to write it in would be great.


Thanks for your share

Share this post


Link to post
Share on other sites

If anyone knows how to automatically grab this information without having to write it in would be great.


check this piece of code, it might help?

http://www.prestashop.com/forums/viewthread/19764/P15/solvedautomatic_update_product_quantities

this might help also to set all in seperate TAB in admin BO

http://www.prestashop.com/forums/viewthread/21684/general_discussion/solved__adding_custom_report_tab

Share this post


Link to post
Share on other sites

Thanks for the information DJ-Terror.
I have updated this so it will be integrated into the tabs, it does look cleaner. You still have to put in the server information in all three files. I havent figured out yet how to make these files automatically connect to the server without entering this information manually. If anyone knows how to do it please let me know how its done.

Again just fill in the section in each file with your server information on all three files where it says

 <!--###################################PUT IN YOUR SERVER INFORMATION BELOW (SHOWN IN CAPS)#############################################-->         
#connect to MySql
$conn = @mysql_connect ("MY_DATABASE_ADDRESS.com", "DATABASE_USER_NAME", "DATABASE_PASSWORD")
 or die ("Err:Conn");

 #select the specific database
 $rs = @mysql_select_db ("DATABASE_NAME", $conn )
   or die ("Err:Db");
<!--#####################################################################################################################################-->



Also you have to do the following:

1. Install all three files in the admin/tabs folder.

2. Go to Tools/Tabs click on "Add new" In the Name type in "Inventory" (without quotes) Class type "AdminInventory" (without quotes) Icon type "img/t/60.gif" (without quotes) Parent dropdown list choose "Catalog".

3. Go to Tools/Tabs click on "Add new" In the Name type in "On Sale" (without quotes) Class type "AdminOnSale" (without quotes) Icon type "img/t/61.gif" (without quotes) Parent dropdown list choose "Catalog".

4. Go to Tools/Tabs click on "Add new" In the Name type in "Out of Stock" (without quotes) Class type "AdminOutOfStock" (without quotes) Icon type "img/t/62.gif" (without quotes) Parent dropdown list choose "Catalog".

THESE FILES HAVE BEEN UPDATED ON 07/25/09

9842_rwDxZ3ADkAkjp3msxvaU_t

AdminInventory.php

AdminOnSale.php

AdminOutOfStock.php

Share this post


Link to post
Share on other sites

Hi Joenmass

Thank you for sharing this, not sure if I am doing something wrong but everything set up ok but seem to get a blank page when any of the three new tabs are clicked, I have double checked and all database info is correct and file permission are ok.

Maybe you might know why i'm getting blank pages

Thanks

Share this post


Link to post
Share on other sites

Did you upload it to the correct folder admin/tabs ? It seems like you may have misspelled or forgotten some information in the database information section.
Make sure there is no space between the " " marks where you enter your information server information.

Share this post


Link to post
Share on other sites

I am sure it is possible but I am very new to this programming thing. I just don't know how to do it at the moment. Hopefully someone with more programming experience could help out.

Share this post


Link to post
Share on other sites
Hi Joenmass

Thank you for sharing this, not sure if I am doing something wrong but everything set up ok but seem to get a blank page when any of the three new tabs are clicked, I have double checked and all database info is correct and file permission are ok.

Maybe you might know why i'm getting blank pages

Thanks


Same problem here :-S

I would really like to have this!

Can anyone please make a module out of it?

Share this post


Link to post
Share on other sites

I was able to dublicate your problems with the files I downloaded from the Prestashop forum. I am sorry that there was an issue with these files. It seems my comments inside the code was causing the files not to work.
I have tweaked the code a bit. Download the new files, I have updated all the files on this post so it should be alright. I moved the server login information section between lines 95 and 100. Edit your server information on line 95 and line 99 on all three files (where the cap letters are located).

If you still have a problem you can email me and I will set it up for you but I think this will do it for you.


THIS DOWNLOADABLE FILE WAS UPDATE OCTOBER 1, 2009

•SEE POST #41 *

AdminInvent.php

Share this post


Link to post
Share on other sites

It is working now... partially :-/

Two problems:

I'm using a db prefix and it's using the wrong db.

The 'Out of Stock' still has the same old problem, displaying nothing, not even the wrong data.

But we are getting there!!

Share this post


Link to post
Share on other sites

Yes same here got it to work now but the problem that I seem to be having is that the out of stock is diplaying wrong data it showing items that are currently in stock. :-S

Nearly there though!

Share this post


Link to post
Share on other sites

Weasel, I am not familiar using a db prefix on these files. I would think it wouldn't matter. All I can say is experiment with your database information, double check what you are typing into the fields hopefully it will work.
The section for the database information is a cut and paste (they are the same from one file to the other), so if it worked for one file it should work for the others. Thats why I am saying double check what you entered in the AdminOutOfStock,php file.
Try cutting and pasting from one of the files that connects to the database. The reason it is not showing any information, even wrong information is because the script is not connecting to the database.

OnlineBeautyLtd I dont know why its showing the wrong information it seems to be the correct script. Either way I have attached my AdminOutOfStock.php file that I use to this post. I just took out my database information. Give it a try and let me know if it is okay.

AdminOutOfStock.php

Share this post


Link to post
Share on other sites

Make sure you go to Tools and Tabs from the admin section. Under the Tabs click on "Out of Stock" tab to edit. Where is says Class make sure to type in AdminOutOfStock. If this is incorrect the script wont work.

Instructions from post#7

1. Install all three files in the admin/tabs folder.

2. Go to Tools/Tabs click on “Add new” In the Name type in “Inventory” (without quotes) Class type “AdminInventory” (without quotes) Icon type “img/t/60.gif” (without quotes) Parent dropdown list choose “Catalog”.

3. Go to Tools/Tabs click on “Add new” In the Name type in “On Sale” (without quotes) Class type “AdminOnSale” (without quotes) Icon type “img/t/61.gif” (without quotes) Parent dropdown list choose “Catalog”.

4. Go to Tools/Tabs click on “Add new” In the Name type in “Out of Stock” (without quotes) Class type “AdminOutOfStock” (without quotes) Icon type “img/t/62.gif” (without quotes) Parent dropdown list choose “Catalog”.

Share this post


Link to post
Share on other sites

Can you send me a copy of the "AdminOutOfStock.php" file without your private information in it. I want to take it and run it on my website. If its okay then we know to look elsewhere for the answer.

Share this post


Link to post
Share on other sites

The problem with 'Out of Stock' is

$sql = "SELECT * FROM ps_product, ps_product_lang WHERE ps_product.id_product = ps_product_lang.id_product AND ps_product.out_of_stock = '0'   ORDER BY reference ASC";


needs to be

$sql = "SELECT * FROM ps_product, ps_product_lang WHERE ps_product.id_product = ps_product_lang.id_product AND ps_product.out_of_stock = '1'   ORDER BY reference ASC";



And the thing about the prefix:

the ps_ in the query is the table prefix, if you use another prefix, you need to change it in every instance in the files or the query will produce nothing (when the prefix doesn't exist) or a wrong result (if you are using the prefix but for another install).

I still have a few issues (e.g. the item ID doesn't display) but we'll figure that out too!

Share this post


Link to post
Share on other sites

Hi - great Idea - but having triedd it my out of stock does not work either - brings up blank page. Also, other two tabs bring up duplicates of stock on sale and in inventory.

I get a list of everything in the right category - but quadrupled - there are 4 of everything!

Any ideas???

Thanks

Barry
---------------------

Share this post


Link to post
Share on other sites

The multiples seem to come from attributes.

I'm not using the pages for the moment as I'm in the middle of transitioning to 1.2 but I'll sure look at them asap.

K

Share this post


Link to post
Share on other sites

Sorry it has taken so long to respond to this tread, went on vacation to Germany and Austria. Soon I will post an updated version to this inventory management tread (have to clean up the files).
I have made it so it will be very easy to add it to your shop. You no longer have to enter your database information at all on any of the files.
There has been a lot of issues with people trying to add this to their shops, hopefully these issues will be 100% gone.
Please note I am using version 1.1 of Prestashop so I am unsure if it will work with the latest version.

Share this post


Link to post
Share on other sites

THESE FILES WERE UPDATED OCTOBER 1, 2009.
FILES UPLOADED TO THIS POST WAS DELETED
PLEASE SEE POST #41, #42 and #43

USE THESE FILES & FOLLOW THESE INSTRUCTIONS. DISREGARD THE PREVIOUS FILES AND INSTRUCTIONS!

Please make a copy of your original files that you will be changing just incase you have any issues.

1. Install all of these three files in the admin/tabs folder; AdminInventory.php, AdminOnSale.php, AdminOutOfStock.php

2. Install the file named: mysql_connect.php in the config folder.

2. Go to Tools/Tabs click on “Add new” In the Name type in “Inventory” (without quotes) Class type “AdminInventory” (without quotes) Icon type “img/t/62.gif” (without quotes) Parent dropdown list choose “Catalog”.

3. Go to Tools/Tabs click on “Add new” In the Name type in “On Sale” (without quotes) Class type “AdminOnSale” (without quotes) Icon type “img/t/20.gif” (without quotes) Parent dropdown list choose “Catalog”.

4. Go to Tools/Tabs click on “Add new” In the Name type in “Out of Stock” (without quotes) Class type “AdminOutOfStock” (without quotes) Icon type “img/t/60.gif” (without quotes) Parent dropdown list choose “Catalog”.


Thats it. To query your database just click on the "Catalog" tab and you will see the three available queries tabs that were just make (Inventory, On Sale, Out of Stock).

Share this post


Link to post
Share on other sites

I'm having fun playing around with the database. I have updated the AdminInventory.php file. It now returns more usefull information (see pic) such as the wholesale price, selling price, your profit and the percentage return on each item.
Also added updated AdminOnSale.php and AdminOutOfStock.php files. These files were just cleaned up and placed in a neat table.

Just upload these three files to the admin/tabs folder.

I've also included the mysql_connect.php file to this post just to keep all of the files in one place. Place this file in the config folder.

Enjoy.

11073_o6SYk72EVaZrMr5TGRDk_t

AdminInventory.php

AdminOnSale.php

AdminOutOfStock.php

mysql_connect.php

Share this post


Link to post
Share on other sites

I don's seem to get this working. I have uploaded all files, and changes the db info in mysql_connect.php. Not sure why it's not working...

All I get is a blank page when I click on any of the three new tabs in admin.

I'm pretty sure the db settings are correct.

Edit: I'm using 1.2 - and I guess that's problem :)

Share this post


Link to post
Share on other sites

You don't have to change anything in the mysql_connect.php file. Just place it in the config folder. It will automatically get your database information.

Delete your mysql_connect.php file that you have and download it again.

I use v 1.1 but I don't think using v 1.2 would be an issue.

Share this post


Link to post
Share on other sites

Thank you for the fast reply.

Now all the files are newly downloaded and uploaded without any altering. Still a blank page only (with the admin buttons on top).

Might it still be a 1.2 version issue?

Edit: I'm running the admin in Norwegian.

11100_RcZ9oRtbWgcHiJVNMbM7_t

Share this post


Link to post
Share on other sites

Is the file called config in the english version different in the Norwegian version? Did you place the mysql_connect.php in the config folder?

I have to leave for work now. I will check back after work to see how you made out.

Anyone else have an issue using this?

Oh...make sure you followed the instructions on setting this up especially...

2. Go to Tools/Tabs click on “Add new” In the Name type in “Inventory” (without quotes) Class type “AdminInventory” (without quotes) Icon type “img/t/62.gif” (without quotes) Parent dropdown list choose “Catalog”.

3. Go to Tools/Tabs click on “Add new” In the Name type in “On Sale” (without quotes) Class type “AdminOnSale” (without quotes) Icon type “img/t/20.gif” (without quotes) Parent dropdown list choose “Catalog”.

4. Go to Tools/Tabs click on “Add new” In the Name type in “Out of Stock” (without quotes) Class type “AdminOutOfStock” (without quotes) Icon type “img/t/60.gif” (without quotes) Parent dropdown list choose “Catalog”.

Share this post


Link to post
Share on other sites
Is the file called config in the english version different in the Norwegian version? Did you place the mysql_connect.php in the config folder?


The folder names are the same, and mysql_connect.php is inside /config/

Strange - because all other modules and functions work in my shop.

11104_XA6nleujOdKoicsIaua8_t

Share this post


Link to post
Share on other sites

Did you configure the "tools/tabs" from the admin side? You will get a blank screen if it is not configured correctly. Check these settings and follow it to the letter.
Check out how I set up my tools/tabs section.

11123_DlvnhF9CWMgulYLWYfVO_t

Share this post


Link to post
Share on other sites
Did you configure the "tools/tabs" from the admin side? You will get a blank screen if it is not configured correctly. Check these settings and follow it to the letter.
Check out how I set up my tools/tabs section.


Thank you for trying to solve this!

I have followed the instructions to the letter several times.

Are you sure this works in 1.2?

Does the scripts install or change anything that I may have to change back due to the fact that I entered some info in the mysql_connect.php before replacing it with a fresh file?

Share this post


Link to post
Share on other sites

Would something like array_unique function help get rid of the duplicates on some entries?

Like...

#Subroutine Begins
sub remove_duplicates {
my($array, $new_array)=@_; #Step 1. Read initial array
my %entries=(); #Step 1. Declare the hash
foreach (@$array) {
next if exists $entries{$_};
$entries{$_}=1} #Step 2
foreach (@$array) { #Step 3. Loop through all array elements
if($entries{$_}){ #Step 5. The element is skipped If hash value is 0.
push @$new_array,$_; #Step 4. Add an element to the new array only if the hash value is 1.
$entries{$_}=0; #Step 4. The element is marked i.e. change the hash value to 0.
[spam-filter]}
#Subroutine Ends

my $array=[qw(1 2 6 17 6 2 95 1 2 6)]; #An example array
my $new_array=[];
remove_duplicates($array, $new_array);
print "@$array \n"; #Print initial array
print "@$new_array \n"; # print final array
exit;

Baz

Share this post


Link to post
Share on other sites

kyrre, I haven't tried it out on v1.2. only v 1.1.
There must be something differant in v 1.2 for it not to be working. This week I will try to upgrade to version 1.2 and that way I could see what is causing the issue that you are having.

No, the script does not install anything. It just calls out database queries and also calls for your database settings via the settings.inc.php.

there must be an issue with version 1.2. On my v 1.1 it works flawlessly and fast. As soon as I upgrade to v 1.2 I will get to the bottom of this issue you are having.

Share this post


Link to post
Share on other sites

hi - am using version 1.2.1 final, and followed your instructions - worked fine for me - so any problems on that version must be down to the way it's being installed - but still has duplicate entries for products with attributes :-(

Baz

Share this post


Link to post
Share on other sites

ukbaz... it's nice to know yours worked fine except for double entries for the products that have differant attributes.
I don't have any items in my inventory that have differant attributes so I didn't see that problem when I tested the script. I will have to add a few attributes to some of my products to see if I get the same double entries issues.
I am very new to working with databases so it might take a little while to solve this problem. If anyone else has a solution that would be great if you can share it with all of us.

Share this post


Link to post
Share on other sites

Ukbaz...I added attributes to some of my products and I didn't get any double entries on the inventory list like you did.
It must be an issue with version 1.2

Have you tried deleting the files and reinstalling them?

Share this post


Link to post
Share on other sites

Finally installed Prestashop Version 1.2.4.0

Simple database query to list all items that are in your Inventory List.

I know there was a few issues trying to get this to work with it. I have adjusted the code to work with the latest version of Prestashop. Now you just need to upload a single file. Again it's just a simple query that retrieves information about your products in inventory. It also calculates your profit margin for each product.

Instructions (see image AdminInvent_tab_setup.png for reference): Go to Tools/Tabs then click on "Add new". In the name section type "Inventory" in the class section type "AdminInvent" leave "Module" blank. In the "Icon" section choose any small icon. I chose one from the img/t/8.gif
In the "Parent" section choose "Catalog" from the dropdown list. This will place the link to run the query under your catalog tab.

Go to your admin folder. Open up your "tabs" folder and upload the AdminInvent.php file into this folder .

Thats it, I will be adding more useful queries at other times.
I hope people find this useful.

12471_rO9iJowYovfHRGKmSCnx_t

12493_oBtAP70ozvM4PnhM9X8q_t

AdminInvent.php

Share this post


Link to post
Share on other sites

Simple database query to list all items that are Out of Stock.


Instructions (see image AdminOutOsStock_tab_setup.png for reference): Go to Tools/Tabs then click on “Add new”. In the name section type “Out of Stock” in the class section type “AdminOutOfStock” leave “Module” blank. In the “Icon” section choose any small icon. I chose one from the img/t/6.gif
In the “Parent” section choose “Catalog” from the dropdown list. This will place the link to run the query under your catalog tab.

Go to your admin folder. Open up your “tabs” folder and upload the AdminOutOfStock.php file into this folder .

Thats it, I will be adding more useful queries at other times.
I hope people find this useful

AdminOutOfStock.php

12496_I9VzfOPfY7nJzITXYVI1_t

12497_uhClerMjqHvjQ1UmKK7h_t

Share this post


Link to post
Share on other sites

Simple database query to list all items that are On Sale.

Instructions (see image AdminOnSale_tab_setup.png for reference): Go to Tools/Tabs then click on “Add new”. In the name section type “Item's On Sale” in the class section type “AdminOnSale” leave “Module” blank. In the “Icon” section choose any small icon. I chose one from the img/t/14.gif
In the “Parent” section choose “Catalog” from the dropdown list. This will place the link to run the query under your catalog tab.

Go to your admin folder. Open up your “tabs” folder and upload the AdminOnSale.php file into this folder .

Thats it, I will be adding more useful queries at other times.
I hope people find this useful.

12498_SFqosOcAYCmLCnzxLtPf_t

12499_ySF1e3Z7SrEyRhUZYFAa_t

AdminOnSale.php

Share this post


Link to post
Share on other sites

Prestshop Version this was used on V 1.2.4.0

I made a seperate tab to show all my database queries. The following instructions will repeat most of the instructions I made on the previous posts (#41, #42, #43). What I have changed from the previous three posts is added instructions on how to place a new tab called "Invent." in the admin section and how to put the queries under this new tab.

[1] Upload the AdminInventoryReports.php file to your admin/tabs folder.
[2] Go to the admin section then click on "Tools" then click "Tabs". Click on "Add new"
[3] In the Name type "Invent."(without quotes) *NOTE Do not write "Inventory" because the word is too long and it will run below to second level and look horrible, just type "Invent.".
[4] In the "Class" section type "AdminInventoryReports" (without quotes)
[5] In the Icon section browse to get any small icon picture to use. I used img/t/47.gif but you can use any you want.
[6] In the "Parent" section keep it at "Home".
Click "Save".

What follows is basically what I wrote in posts #41, #42 and #43 except where it says the "Parent" section instead of grabing "Catalog" from the dropdown list you will instead now grab "Invent." from the drop down list.

Inventory List query:

[6] Go to Tools/Tabs then click on “Add new”. In the Name section type “Inventory” (without quotes) in the Class section type “AdminInvent” (without quotes) leave “Module” blank. In the “Icon” section choose any small icon. I chose one from the img/t/8.gif
In the “Parent” section choose “Invent.” from the dropdown list. This will place the link to run the query under your "Invent." tab.
[7] Go to your admin folder. Open up your “tabs” folder and upload the AdminInvent.php file into this folder .

Out of Stock query:

[8] Go to Tools/Tabs then click on “Add new”. In the Name section type “Out of Stock” (without quotes) in the Class section type “AdminOutOfStock” (without quotes) leave “Module” blank. In the “Icon” section choose any small icon. I chose one from the img/t/6.gif
In the “Parent” section choose “Invent.” from the dropdown list. This will place the link to run the query under your "Invent." tab.
[9] Go to your admin folder. Open up your “tabs” folder and upload the AdminOutOfStock.php file into this folder .


On Sale query:


[10] Go to Tools/Tabs then click on “Add new”. In the Name section type “Item’s On Sale”(without quotes) in the Class section type “AdminOnSale” (without quotes) leave “Module” blank. In the “Icon” section choose any small icon. I chose one from the img/t/14.gif
In the “Parent” section choose “Invent.” from the dropdown list. This will place the link to run the query under your "Invent." tab.

Go to your admin folder. Open up your “tabs” folder and upload the AdminOnSale.php file into this folder .

Hooray it's done! Hope you like it as much as I do. Any issues please let me know.

12503_0wnOB8bc0zQiNFCK1wpw_t

12505_cjY3St7GDEaLBkkUXRm9_t

AdminInvent.php

AdminOutOfStock.php

AdminOnSale.php

AdminInventoryReports.php

Share this post


Link to post
Share on other sites

I updated the AdminInvent.php file to show every other line with a light blue color for easier viewing of the table.
Also corrected the "Profit" column to show last two digits of prices that ended in .oo.

Updated this file on Oct.12 to add a column that shows the quantity of each product and also the product ID, thanks to ZENITH's contribution.

AdminInvent.php

12936_6XdB8sn3WVftxeFhpI2J_t

Share this post


Link to post
Share on other sites

Had a few problems with the last AdminInvent file you posted joenmass. Filename for config include was incorrect.

I've done a complete re-write of the file to comply with PrestaShop 1.2.4 standards and all seems to work as your original. The class is now AdminInventory for the tab setup. :)


UPDATE
Also noticed that the "Out of Stock" list already exists on the Catalog -> Tracking page, so I added a new table on that page to show "On Sale" items. Just overwrite your existing admin/tabs/AdminTracking.php file.

AdminTracking.php

AdminInventory.php

Share this post


Link to post
Share on other sites

Hey thanks MJ great job!
Thanks for your help. I only changed line#43 of your code so I can display the list by the reference number instead of the product name like you have it.
For those who want to display your product inventory by the reference number they can download the file I am including in this post. For those who want to list their inventory by name use Zenith's file. They both work great.

MJ, I find this simple database query very useful to me and I use it very often, do you find it useful also?
Does anybody else find it useful?

AdminInventory.php

Share this post


Link to post
Share on other sites

Yes, I find it very useful to have an inventory list, a great idea!

I updated my file to add the Product ID and now the default sort uses that, like the Tracking tab list does.

One thing I have noticed is a click-thru on the table rows of the Inventory List, as if to edit, not sure if that can be changed....I'm only learning PrestaShop functions still... :-)

Share this post


Link to post
Share on other sites

I noticed that about the click through's but that is a minor issue. I am sure you, I or someone else will come up with a solution. It would be nice if it could go to the edit page of the product that is clicked.
I too am very new to this. I just started learning how to manipulate database information basically this past summer. As you can tell by my code it's strictly basic PHP, you know much more then I do when it comes to database manipulation.

Share this post


Link to post
Share on other sites

I've updated my file to fix the click-thru issue, it now leads to the edit product page, may not be the best way to do it, but it works for now. I've also added the edit button to the listing and an "Add new" link so new products can be added from this page.

Share this post


Link to post
Share on other sites
I’ve updated my file to fix the click-thru issue, it now leads to the edit product page, may not be the best way to do it, but it works for now. I’ve also added the edit button to the listing and an “Add new” link so new products can be added from this page.


Wrong page is loaded on filter. When I search on a productname the page is redirected to startpage of catalog. When I click on the link Inventory again the correct (filtered) page is loaded.

Share this post


Link to post
Share on other sites

I didn't notice that, look like the filtering will have to be dropped, I don't know enough to have the links and filtering to run on different tab files.

Have updated my post with a new file, back to a simple table for now :)

Share this post


Link to post
Share on other sites

Nice work, and good communication! thank you all.

Just a little note, since you have started the good work, would anyone be able to get the add and remove stock to keep records (i.e. when you have new stock comes in to your warehouse, someone would need to update the quantities of the product, but you want that tracked with added quantity, date-time, employee.. that would make it a good inventory tab/

Share this post


Link to post
Share on other sites

Hi Guys, wondering if you could help, followed instructions and have negative result as per attached. The Inventory tab works perfectly but Out of Stock and Items on Sale dont! :( Please help. I'm using PS 1.2.2

13247_KXmNrJaHp9O1fy6ONzJu_t

13248_VlAPy358DLahOYvD5CoP_t

Share this post


Link to post
Share on other sites

Check your setting on the tools/tabs for the "Out of Stock" and "item's On Sale" files.
View the pictures below and make sure your info matches the pictures. Of course you can choose any icon you like.

13249_8XIi6vBPWJk8CT5VQFgR_t

13250_KhZ8p1UAwqcmfKshvXZC_t

Share this post


Link to post
Share on other sites

Thanks for the reply, my tabs are setup exactly as you have shown, still no luck.

Share this post


Link to post
Share on other sites

Hi Guys,

Thanks for your efforts in this Inventory Table. I installed it and see that it is giving me duplicate lines for each product. It seems that it may be due the fact that my ps_product_lang table has entries for two different languages for each item. I haven't figured out yet what I need to do to the MySQL commands to get it to report only one of the languages. Could anyone help?

BTW, I am currently using Joe version which inherits from the AdminTab class. But it would be nice if that version could have the last 3 columns of Zenith's version showing enable/disable and the two actions.

Thanks again,
Dave G.

Share this post


Link to post
Share on other sites

opal_froot that is really great. Thank you, it makes it a whole lot easier to edit a product from the inventory list.

Share this post


Link to post
Share on other sites

Thanks you. I think the stock management and viewing options in PS are a serious let-down.

Im looking to build an add-in that helps manage stock from a dashboard view.

Any ideas for features are welcome.

Share this post


Link to post
Share on other sites

opal_froot it would be nice to be able have a search feature for the inventory product list. The "reference" numbers are not in order so its kind of hard to find a certain product. In my shop I have some 600+ products.

Share this post


Link to post
Share on other sites
These projector screens are highly sophisticated and you can view each and every color in the movie with the use of a good projector screen. If you are ready to spend for the home theatre system, you must be ready to install the screen as well.
Needsee(www.needsee.com) is totally different from the traditional e-commerce website. Needsee, not only has a online shop which is similar with the traditional e-commerce website, but also have a personal social space which can show the foreign trade salesmen.

I thinks this is OFF TOPIC!

Share this post


Link to post
Share on other sites
Thanks you. I think the stock management and viewing options in PS are a serious let-down.

Im looking to build an add-in that helps manage stock from a dashboard view.

Any ideas for features are welcome.


I am working on improving a CVS import function used here for import stock quantity from CVS. I am not sure if it could be incorporated somehow but I see there is a d/l CVS function, it would be nice to add an Upload CVS to it as well. Also I'd really like to see the columns be sortable so you could sort the list on Reference, Price, Quantity, etc. That would make it really nice.

Share this post


Link to post
Share on other sites

I initially did a version with sortable columns but could not get the coding exactly right to function correctly.

Share this post


Link to post
Share on other sites

Thanks for this! It really helps.

However, in my prestashop install, in the ps_product table, almost every single item in the shop has out of stock = 2. One item has out of stock =1. Why do you test that field instead of checking quantity? This is maybe the reason many people have blank pages on the Out Of Stock tab. I changed the query at line 113 to :
$query = "SELECT * FROM ps_product, ps_product_lang WHERE ps_product.id_product = ps_product_lang.id_product AND ps_product.quantity = '0' ORDER BY reference ASC";


Also, In the inventory list, it doesn't seem to differentiate between product combinations. We use lots of combinations to define unique parts to keep the inventory well organized, but this script seems to have no way to show that we are out of a particular combination...

Share this post


Link to post
Share on other sites

Hi.
I have dowloaded the 2 files and have installed them on admin/tabs directory but they do nothing.
Can you explain clearly the procedure to implement your work?

Tanks

Share this post


Link to post
Share on other sites

You have to add the tabs like described in post #44 (I edited the instructions some):


[1] Upload the AdminInventoryReports.php and AdminInventory.php files to your admin/tabs folder.
[2] Go to the admin section then click on “Tools” then click “Tabs”. Click on “Add new”
[3] In the Name type “Invent.”(without quotes) *NOTE Do not write “Inventory” because the word is too long and it will run below to second level and look horrible, just type “Invent.”.
[4] In the “Class” section type “AdminInventoryReports” (without quotes)
[5] In the Icon section browse to get any small icon picture to use. I used img/t/47.gif but you can use any you want.
[6] In the “Parent” section keep it at “Home”.
[7] Click “Save”.
[8] Go to Tools/Tabs then click on “Add new”. In the Name section type “Inventory” (without quotes) in the Class section type “AdminInventory” (without quotes) leave “Module” blank. In the “Icon” section choose any small icon. I chose one from the img/t/8.gif In the “Parent” section choose “Invent.” from the dropdown list. This will place the link to run the query under your “Invent.” tab.
[9] Click "Save".
[10] Click Invent Tab. Now click Inventory sub-tab. Select which filter you want from the filter menu.

Edit: Updated #8 to fix error.

Share this post


Link to post
Share on other sites

First of all, Happy New Year. :-)

Thanks for your clear replay.
I followed your instructions and all seems work fine but ... when I click on "Inventory" i have an error message.

See images for a clear view.
Can you help me?

Thanks a lot.

Luigi

16507_Hp8gHXddeHRyvbMw4WhS_t

16508_PvYV9TmcRV3wAdgPxUcT_t

Share this post


Link to post
Share on other sites

@psico: In point 8 (#73) it says that the classname is "AdminInvent" but the class name must be "AdminInventory"

Share this post


Link to post
Share on other sites

Perfect.
Now all seems work fine.

Thanks a lot for your contribution and for your help.

Luigi

Share this post


Link to post
Share on other sites

Yep, that was my fault. I forgot to alter that in #8 of the instructions. I've fixed them now. ;)

Share this post


Link to post
Share on other sites

UPDATED. See post #73 for install instructions if installing for the first time.

This new version now check all combinations as well. There is a small bug in the filtering where combinations aren't considered, but that's minor and I wanted to share what I now had ;)

Note, you may find that the quantities in your combinations don't match the total quantity listed for the product. This isn't a script bug, it's a prestashop one. If you edit a combination's qty but don't go the the Item tab and click Save, then the total qty doesn't get updated in Prestashop's db.

Just upload these files over the old ones if upgrading.

KyferEz

AdminInventory.php

AdminInventoryReports.php

Share this post


Link to post
Share on other sites

Are there update screen shots for this? Can anyone tell em if it lists colours separatly on each row and if it includes a image against each product?

Share this post


Link to post
Share on other sites

Ive downloaded and its great it give me what Im after for now. However can anyone tell me how I can add images next to each product or point me in the right direction

Share this post


Link to post
Share on other sites

Hello.
Can I suggest to include in the module a paging system that allows not having to load all the products in the same screen?

Luigi

Share this post


Link to post
Share on other sites

KyferEz I have a few issues... My store is based on Prestashop Version 1.2.5.0

Apache version 2.2.15
PHP version 5.2.13
MySQL version 5.0.90-community-log

------

Warning: Division by zero in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 208

Warning: Division by zero in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 220

Warning: Division by zero in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 208

Warning: Division by zero in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 220

------

All my inventory/products are here in the middle of these two sets of warnings...

------

Warning: fopen(inventory.csv) [function.fopen]: failed to open stream: Permission denied in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 250

Warning: fwrite(): supplied argument is not a valid stream resource in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 251

Warning: fclose(): supplied argument is not a valid stream resource in /home/xxx/public_html/admin/tabs/AdminInventory.php on line 252
Download CSV

------

Any ideas on what im doing wrong? I did not configure any database info with your two files. Your instructions do not mention this. Do I need to set database info with your files?

Thanks for your time.

Share this post


Link to post
Share on other sites

I solved the bottom warnings with fopen, fwrite & fclose with the correct chmod on the folders. Now if I can figure out the Division by zero warnings I will be golden.

Any ideas people?

Share this post


Link to post
Share on other sites

I am doing a stock inventory system using prestashop,
basically is to see the movement of the goods.

So I wanted to generate a monthly report that can extract:
"Customer", "Shipping Address", "Product", "Status", "Date"

I think this code is something I can edit on, but does anyone know which line to edit?

Share this post


Link to post
Share on other sites
I solved the bottom warnings with fopen, fwrite & fclose with the correct chmod on the folders. Now if I can figure out the Division by zero warnings I will be golden.

Any ideas people?

i have the same problem with 1.3.1

Share this post


Link to post
Share on other sites

Has anyone noticed the fact that the Profit % calculations in the modules attached to this thread are completely wrong?

Looking at the code it uses the following formula to derive the profit:

Profit % = ((Product Price - Wholesale Price) / Product Price) * 100



So for example, a Product being sold for $10 that was purchased at a wholesale price of $5 would yield a result of:

Profit % = ((10 - 5) / 10) * 100 = (5/10) * 100 = 0.5 * 100 = 50%



Now in reality, a profit of $5 on a product purchased for $5 should be 100%. So the formula being used should actually be a calculated as a percentage of the wholesale price (i.e. what you paid for the product originally). For example:

Profit % = ((Product Price - Wholesale Price) / Wholesale Price) * 100



Using the above example this would yield:

Profit % = ((10 - 5) / 5) * 100 = (5/5) * 100 = 100%



Right?

Share this post


Link to post
Share on other sites

Your calculation is correct marksull. Cheers!

Share this post


Link to post
Share on other sites
Has anyone noticed the fact that the Profit % calculations in the modules attached to this thread are completely wrong?

Looking at the code it uses the following formula to derive the profit:

Profit % = ((Product Price - Wholesale Price) / Product Price) * 100



So for example, a Product being sold for $10 that was purchased at a wholesale price of $5 would yield a result of:

Profit % = ((10 - 5) / 10) * 100 = (5/10) * 100 = 0.5 * 100 = 50%



Now in reality, a profit of $5 on a product purchased for $5 should be 100%. So the formula being used should actually be a calculated as a percentage of the wholesale price (i.e. what you paid for the product originally). For example:

Profit % = ((Product Price - Wholesale Price) / Wholesale Price) * 100



Using the above example this would yield:



Profit % = ((10 - 5) / 5) * 100 = (5/5) * 100 = 100%



Right?





Hi There,
I'm little new to prestashop and installed this for my online shop. would you please let me know what exactly lines I need to edit in which file?

Thanks a million

Share this post


Link to post
Share on other sites

This module works great.

The one thing I did not like was setting write permissions to the admin directory so that the php could write the inventory.csv file. I made a subfolder /admin/inventory and assigned it write permissions instead and then tweaked the path to the csv at the bottom of AdminInventory.php.

Changed

        $inv = fopen("inventory.csv", "w+");
       fwrite($inv, $csv);
       fclose($inv);
       //write the CSV
       echo 'Download CSV ';
       echo 'Download';



to

        $inv = fopen("inventory/inventory.csv", "w+");
       fwrite($inv, $csv);
       fclose($inv);
       //write the CSV
       echo 'Download CSV ';
       echo 'Download';

Share this post


Link to post
Share on other sites

Is there any way to export the combination stock levels in the inventory.csv also? I'd essentially like to have the same data that the inventory tab displays, but rather in CSV format.

Share this post


Link to post
Share on other sites

Has anybody tryed with "Attributegrid" from http://www.presto-changeo.com ?
I told Tomeg (the developer) it would be a good idea to enter items from the back office in a grid format for items with sizes and colours, like for example t-shirts, or any kind of clothes, shoes, etc. As you may know, you don´t always order again the same quantity of all colours or sizes, but "Attributegrid" only works in the front office.

Share this post


Link to post
Share on other sites

Hi !
Great tab !
Is there any chance that anyone with some PHP skills could ad a total at bottom, like total stock value both in value of buying and selling, it would be nice to see the value of the stock aswell..
Also some kind of print function feels like it is missing...

But a great job all !

Share this post


Link to post
Share on other sites

Hi All,

can confirm that this works on PShop version 1.3.2
Shop and Admin are in two languages (German and English)
We use euro & 19% tax rate.

Downloaded the files from Post #77
Followed Instructions from Post #72
Made minor fix regarding where CSV file downloads to, from Post #89

Worked right away. No tweaking necessary.

Minor irritation is that the attribute pricing shows with the dollar "$" symbol instead of the euro "€" symbol. Sure there is a simple code fix for this display.

Profit margin displays correctly for me. See first product on list of attached Screen capture as an example.
Stock levels display correctly.

Great tool. Thanks to the developers. Kudos!!

Kind regards,
Lisa

38435_jCjNqgXbkrj03WXP8wVf_t

Share this post


Link to post
Share on other sites

What are the current files for this post?

Have the files on the 1st post been updated with all the changes?

Share this post


Link to post
Share on other sites

Downloaded the files from Post #77
Followed Instructions from Post #72
Made minor fix regarding where CSV file downloads to, from Post #89

Share this post


Link to post
Share on other sites