Jump to content
sm3004

Module to calculate profit margins

Recommended Posts

I am looking for a module that calculates my profit margins. I want to enter the price I paid for the item in the wholesale price field and be able to use the stats section to calculate the profit I make by selecting relevant dates.

Profit = Retail Price - Wholesale Price

I know this would be extremely easy to do, is there something like this or is someone willing to make it? I will pay and I am sure plenty of other people would to.

At the moment I have to enter everything twice, once in PrestaShop and once again in an Accounting Software package (MYOB) which is just ridiculously inefficient...

Share this post


Link to post
Share on other sites

Thanks for the effort, but that's not even close to what I need. I already had that installed, all it does is tell you the amount of items you sold, that does not take in to account any of the prices or sales figures...

Share this post


Link to post
Share on other sites

I like the idea of a module that would evaluate profit margins would do wonders for the book keeping and help alot more with cashflow as well.

I too already have that catalogue evaluation and its good for its purpose but doesn't sort out profit margins.

Be good to see if anyone has ago at this.

Share this post


Link to post
Share on other sites

PrestaShop has sooooo much potential, but the lack of moderators/developers in the forums is what is keeping it from taking the CMS to the next level.

I guess we will be waiting on this for eternity.

  • Like 1

Share this post


Link to post
Share on other sites

Your not far wrong there I have seen numerous posts of the forum where people have asked for something and are waiting for something to be developed.

But i suppose it is open source so we cannot grumble too much, and it is still quite new in comparison to os commerce and zen cart, but in my opinion miles ahead in terms of looks feel and functionality.

Share this post


Link to post
Share on other sites

Do you mean a module that calulate what is left for you when taxes, wholesaleprice and all is payed?

Share this post


Link to post
Share on other sites

That would be good but i think its more along the lines of you put in wholesale price and retail price and it gives you your profit margins. Also some sort of integration into the stats for when you sell items it could give you for instance a months profit margins based on sales that you have had.

Thats what i was thinking of but i'm not the one that requested this module so the forum post owner might be able to give more information on it.

Share this post


Link to post
Share on other sites
That would be good but i think its more along the lines of you put in wholesale price and retail price and it gives you your profit margins. Also some sort of integration into the stats for when you sell items it could give you for instance a months profit margins based on sales that you have had.

Thats what i was thinking of but i'm not the one that requested this module so the forum post owner might be able to give more information on it.


What he said...

Share this post


Link to post
Share on other sites

Would it be so difficult to take the code in the catalog evaluation module and add code to show profit margins for each product?

Share this post


Link to post
Share on other sites

Very nice work ! There isnt much newcomer to you ;) I would be nice to be able to add additional fees such ass transactions fees and perhaps a shipping fee (our costs). But very nice work, I made a small calulator that wee use to calcualte profits, before putting it up for sale. (not a module)

Share this post


Link to post
Share on other sites

Great!
Thank you very very much!!

I was very usefull that discount paypal fees of profit too..

Share this post


Link to post
Share on other sites

I mite be working on some myob integration of sales very soon if this is still of interest.

Share this post


Link to post
Share on other sites

So am i to understand that if the customer adds an option to a product, this module does not take into account the extra wholesale cost of the product for the upgrade? Also does anyone know how inaccurate the module is. Plus does it include shipping as a wholesale cost.

This module is a much needed addition to Prestashop. Thanks.

Share this post


Link to post
Share on other sites
So am i to understand that if the customer adds an option to a product, this module does not take into account the extra wholesale cost of the product for the upgrade? Also does anyone know how inaccurate the module is. Plus does it include shipping as a wholesale cost.

This module is a much needed addition to Prestashop. Thanks.


It's difficult to explain. I can provide an example, for v.1.3.2.3 only, you have two jeans: jeans1 wholesale price is $10 and retail price is $20 (this info in the main page) and jeans2 - wholesale price is $11 and retail price is $22(this info in the customization page impact is +$2). You have sold both of them, so your profit is (20+22)-2*10 = $22 (but should be $21).
shipping is not including.


I was very usefull that discount paypal fees of profit too..

I do not work with paypal and not familiar with it, sor

I mite be working on some myob integration of sales very soon if this is still of interest.

Didn't understand.

Share this post


Link to post
Share on other sites

I remade the module to calculate including combination. Now it 100% accurately (I hope).

Share this post


Link to post
Share on other sites

Total products not calculating correctly.The total is extremely high. That's the report at the bottom of the table.

It is also calculating tax as profit.

Share this post


Link to post
Share on other sites
Total products not calculating correctly.The total is extremely high. That's the report at the bottom of the table.

It is also calculating tax as profit.

Total products it's total wholesale cost of all goods in the store. Or that's you mean and it's not calculated correctly??
I calculate tax without "prestashop's tax", so I will check this feature
Thank a lot

Share this post


Link to post
Share on other sites

What I have noticed is that it to calculate profit for a product, it subtracts the Pre-tax wholesale price from the Retail price with tax.
The correct calculation should be that it subtracts the Pre-tax wholesale price from the Pre-tax retail price.
If that is done then the profit calculation per product would be correct.

For total products calculated at the bottom of the table I thought it was the value of total products sold. That would be a good addition to your module.

Thanks for your quick reply and thank you for this module.

Share this post


Link to post
Share on other sites

Any chance you can modify it so it doesn't take into account canceled orders please.

Eddie

Also I have modified it so that it takes into account Nochex Fees, so if anyone requires a copy let me know.

Share this post


Link to post
Share on other sites

hey,

what a great module!!!
That's what I was looking for for a long time!

But I've a question about that:

At the profti-calculation, I think, there is no tax considered.
E.g.:

Total: 28,82€
Profit: 10,40€
Total without shipping: 23,83€

The wholesale_price for all products in this example is 13,43€.
23,83€ - 13,43€ -> 10,40€

That's the profit without tax.
If I've more than one tax category, I can't calculate profit - tax to get the "real profit".

So for every single product the TotalProfit should be calculated with:

TotalProfit=(price-(wholesale_price*(tax/100)+wholesale_price))*product_quantity)

I hope, I'm right with that :-)

regards,

lutz

Share this post


Link to post
Share on other sites

This module should become a standard Stats module of Prestashop. It is very strange that PS has wholesale pricing, but cannot generate reports for it. Probably the PS team is creating a paid module for that.
That said, this module is nice but there are some 'mistakes' in the calculations. It is already mentioned by Dalu2k, but he also misses a part in the calculation. First of, profit means the total minus all the costs and taxes. In PS you have :

Order total = includes price + tax + shipping (+tax) + packaging (+tax)
Cost total = wholesale price + shipping (-tax) + eco tax + packaging (-tax)

Total costs
Tot calculate it correctly you need to separate each product and calculate first the cost price:
Product costs = Nr of products * wholesale price
Shipping costs (- tax)
Eco tax
packaging (- tax)
------------------
Total costs

Subtotal order
As said before the order total is a combination of profits, taxes and costs.
We need to subtract the taxes to calculate the subtotal:

Subtotal = Order Total - product taxes - shipping tax - packaging tax

Profit
Now you can calculate the correct profit:

Profit = Subtotal order - Total Costs


I wish this module would also display the costs in the report and not just the profit.

Good luck lehander

  • Like 2

Share this post


Link to post
Share on other sites

To give you an example :
I have an order total of 43.45 (3x product X)
Product netto price : 13.50 (12.74 ex tax)
The wholesale price is 2.00
Tax rate = 6%
Shippping = 2.95 (no taxes)
Packaging = 0

Total costs : (3 x 2.00) + 2.95 = 8.95
Subtotal Order : 43.45 - 2.28 (product taxes) = 41.16
Profit : 41.16 - 8.95 = 32.21.

Your module calculates the profit as 34,50 at the moment. That means you forgot the substract the shipping AND the tax calculation..

Share this post


Link to post
Share on other sites

Hello,

I have PS 1.04.17, i've dowloaded statsprofitmargin. I've installed it and it work.
I have an error for my profit, i've price - shipping.
I want to have the real profit. What can i change for have it ?

I've another question.
If price of wholesale change, calculate profit take the cost of product, or in order or, in stock (first in first out) ?

Share this post


Link to post
Share on other sites

Thank you very much for this module.

Do you know if its compatible with the lastest stable versions of prestashop?

 

 

Thanks

Share this post


Link to post
Share on other sites

Please update this module to work with 1.4.9.0. It's all blank now, unfortunately...

Share this post


Link to post
Share on other sites

Hi

 

Have had this module for a while and it seems to calculate margin in a variable way some times correctly sometimes just by deducting shipping. Anyone else got this problem?

Share this post


Link to post
Share on other sites

Improved and updated Lehander's profit margin module to work with Prestashop 1.4-1.5:

statsprofitmargin-2.0.zip

 

NOTE: this version doesn't support multi-currency or product attributes. See my post below for newer version.

Edited by Matti (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

This module is for PS 1.4-1.5 versions only.

Share this post


Link to post
Share on other sites

there are bug in statsprofitmargin-2.0.zip

 

edit statsprofitmargin.php line 200

 

from

 

SELECT SUM((p.price + IFNULL(pa.price,0)) - (IFNULL(pa.wholesale_price,0) * od.product_quantity) + (p.wholesale_price * od.product_quantity)) as totalprofit

 

to

 

SELECT SUM((p.price + IFNULL(pa.price,0)) - ((IFNULL(pa.wholesale_price,0) * od.product_quantity) + (p.wholesale_price * od.product_quantity))) as totalprofit

 

it will calculate correct total profit.

Share this post


Link to post
Share on other sites

I tried on my 1.5.4 but... never

the module seems installed but I don't see it

Share this post


Link to post
Share on other sites

Hi

Version 2.0 not visible in PS1.3.2

Tried version 1.5 works but does not calculate correct profit with mod suggested by totoro818

 

Any further suggestions for this potentially excellent Module.

 

Thanks

Share this post


Link to post
Share on other sites

Hello,

Could you pls explain, where can see profit margins in backoffice?

I installed in PS 1.5.4.1 and don't see anywhere such additional information.

Or this module not compatible with 1.5.4.1 ?

Share this post


Link to post
Share on other sites

plaza... I have a problem after install this module, I can't edit or add a new product..

the same to you?

Share this post


Link to post
Share on other sites

plaza... I have a problem after install this module, I can't edit or add a new product..

the same to you?

nope i dont have this problem ...

what you mean - can't edit or add a new product?

Edited by plaza24 (see edit history)

Share this post


Link to post
Share on other sites

Does someone got this working on 1.5.X?

It counts wrong at first (doesnt count the cost of the orders) but with the edited code pasted by totoro818 it counts the cost in some strange way so the months profit is negative (wich its not).

Share this post


Link to post
Share on other sites

Someone can confirm if it works properly?

Thanks

Share this post


Link to post
Share on other sites

Hey,

 

statsprofitmargin-2.0 version deosn't support multi-currency or product attributes.

Try this one:

 

statsprofitmargin-2.2.zip

 

 

NOTE: Module is located at BO-->STATS-->Profit Margins

 

Prestashop 1.4+ module location

post-355311-0-13761900-1391554844_thumb.png

Prestashop 1.5+ module location

post-355311-0-88221000-1391554850_thumb.png

 

Changelog:

 

* now supporting multi-currency and product attributes

 

Known bugs:

 

* Download CSV doesn't work

statsprofitmargin-2.1.zip

Edited by Matti (see edit history)

Share this post


Link to post
Share on other sites

Thanks it works a lot better now, Is it possible to set a fixed cost for shipping? For example if each order has a shipping cost of 10USD?

Share this post


Link to post
Share on other sites

Thanks it works a lot better now, Is it possible to set a fixed cost for shipping? For example if each order has a shipping cost of 10USD?

So if youn set fixed shipping cost in BO, the module doesn't pick it up?

Share this post


Link to post
Share on other sites

Where in BO do you mean? On each product? I need fixed cost (for me, not the customer) for each order only but perhaps thats easy done also?

Share this post


Link to post
Share on other sites

Hi guys i've tried the module and it works nice but i have a problem with the calculation.

 

Total Price is the final price with discount applied, so why do you exclude the discount once again in the calculation ?

Edited by Joe Michael (see edit history)

Share this post


Link to post
Share on other sites

Hi guys i've tried the module and it works nice but i have a problem with the calculation.

 

Total Price is the final price with discount applied, so why do you exclude the discount once again in the calculation ?

Your talking about 2.1 version. Calculations for total and for spreadsheet are separate. This version total calculations don't take discounts into an account, that is why it needs to be calculated separately and then deducted.

If you use 2.2, Total calculations take discounts into account.

Share this post


Link to post
Share on other sites

Your talking about 2.1 version. Calculations for total and for spreadsheet are separate. This version total calculations don't take discounts into an account, that is why it needs to be calculated separately and then deducted.

If you use 2.2, Total calculations take discounts into account.

 

I am using 2.2 and i have the following problem  ...

 

 

1.jpg

 

 

I spent some time in the code and i removed the discount from the formula for "Total"

 

In the table the values are correct, Total: 16.10 is the price with discount applied. The price client paid is 19.10. Anyway the original code was showing price 13.10 that's why i had to change it.

 

I don't mind if the  "total" value in the table is not correct, if it is showing the profit correctly.

 

My concern is that in "Total Product Sales:" i have wrong calculation and i think its in the formula something that i have to change.

 

What should i do to correct it ?

Edited by Joe Michael (see edit history)

Share this post


Link to post
Share on other sites

Here is another scenario:

Fresh install of the module (ver.2.2) ... 

 

2.jpg

And again none of these are correct. I am enclosing orders details:

 

48.jpg

 

49.jpg

 

Can you please help me fix that ?

Share this post


Link to post
Share on other sites

I tested the 2.2 module on 1.4.. It is crearly not working on 1.5, as you shown. Try 2.1 module for 1.5 and see if it works. In the meantime I'll try to debug it.

Share this post


Link to post
Share on other sites

Oh, by the way. Sometimes there may be some discrepancies between table and total, as total may take additional order at later date. It happens because total takes the date as inclusive and table doesn't. This also has to be fixed. See if there is order 50. And all is accurate if you take that into an account.

 

Total product sales is calculated with discount and shipping deducted. It is on purpose, to allow you to see income on products only. It is different to Total Sales, which includes discounts and shipping. I should probably add Total Sales as well.

Edited by Matti (see edit history)

Share this post


Link to post
Share on other sites

I am using 1.5.6.1 and have uploaded v2.2, but it does not appear to show in BO.  Any thoughts welcome please.

Share this post


Link to post
Share on other sites

Module Works fine in localhost, but in my hosting gives me errors "null" in column profit and margin.

 

Any idea?

 

Thanks and congratulations for the module

Share this post


Link to post
Share on other sites

Great module thanks.

 

I have a feature request.

 

Could you add a link to the table row by what we could just step into the order itself?

Share this post


Link to post
Share on other sites

Has this been abandoned by it's author?  I've not seen any updates.

 

Anyway, I have attached a modified version of this module.

 

"Cost" price now gets the product cost from the last supply-order that the item was purchased on prior to the customer order - if one doesn't exist, it falls back to the wholesale price from the product details as currently.  (This was my main motivation for the edit - I always fill in costs on supply orders, but many products didn't have a standard cost price defined!)  It adds tax into the supply-order cost price at the rate defined on the relevant line, but otherwise taxes are ignored..  It doesn't include supplier discounts (as we seldom need to record those separately.) This may or may not be what you want.  

 

The added database queries introduced significant delays for me, so I've added some optimisation by using saved-variables within the query so as not to have to repeat the sub-queries multiple times; this is technically "undefined behaviour" in mysql but it works, at least for me.  

 

Totals all seem to add up with the caveat that "total product sales" is total of product prices, not the total of the "Total" column, as those figures include the shipping that was charged! 

 

Obviously this still expects that shipping was charged at cost.  Without any (current) way of recording actual shipping costs, or indeed any other cost-of-sale figures (e.g. ebay, amazon, paypal or credit card fees, etc.) then this will always remain an approximation.  I'll be thinking about this...

statsprofitmargin.php

Share this post


Link to post
Share on other sites

This module is exactly what I need, I was thinking about implementing it within the admin/themes/default/template/controllers/orders/helpers/view/view.tpl so I can have the Profit Margin as reference next to the Total amount of the order.

But why such a complicated module? this function is already in the AdminStatsController.php, can't someone take it and print the Profit Margin of each order next to the Total?? actually it would be great to have it by default on PS, I think is really useful.

Edited by omar2886 (see edit history)

Share this post


Link to post
Share on other sites

It would be very fine to have this function! But this module doesn't work in PS 1.5.6.1. :(

Share this post


Link to post
Share on other sites

hi,

the module is very interesting but there are some things that do not work well.

I install the 1.6.0.9 vesrsion PS 2.2 and some things only work two load errors.

- Total profit (checksum error)
- Total products sales (checksum error)

hopefully a volunteer to understand some programming in PHP and solve that little problem, because the module is very interesting and we all profit in the display.

who encourages the challenge of repairing the module to a new version 2.3?

 

 

IMAGEN ERROR http://subefotos.com/ver/?e85a25828386c7b103ff3baf514de825o.jpg

Edited by chucurulo (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

I still don't know how the PS team haven't worked on this yet. It's nothing really new and out of the ordinary to implement, they already have it working in the statistics panel, so why not include this very important information directly inside the orders sum up in the admin panel?? it's so useful to understand how profitable is a sale so you then know if it's affordable to give a gift or apply an additional discount.

  • Like 1

Share this post


Link to post
Share on other sites

hi,

I have made ​​some changes in the module and I managed to fix some bug I had:

Fixed issues:

1) sum of total earnings.
2) sum of the total product sales.
3) update the look a bit.
4) Add the Spanish language.

Problem to correct:

1) Download CSV (not working)

modification was based on version 2.2 and the new version with the changes is 2.3.

I hope someone is encouraged to resolve what the CSV, as I could not solve it.

Tested on Prestashop version 1.6.0.9, statsprofitmargin-2.3 works perfect !!!!!

statsprofitmargin-2.3.zip

post-623097-0-71748300-1413323162_thumb.jpg

  • Like 1

Share this post


Link to post
Share on other sites

hi,

 

I have made ​​some changes in the module and I managed to fix some bug I had:

 

Fixed issues:

 

1) sum of total earnings.

2) sum of the total product sales.

3) update the look a bit.

4) Add the Spanish language.

 

Problem to correct:

 

1) Download CSV (not working)

 

modification was based on version 2.2 and the new version with the changes is 2.3.

 

I hope someone is encouraged to resolve what the CSV, as I could not solve it.

 

Tested on Prestashop version 1.6.0.9, statsprofitmargin-2.3 works perfect !!!!!

 

try a free Here

Edited by phungphi25 (see edit history)

Share this post


Link to post
Share on other sites

Just purchased this module and the zip is password protected. THe password sent did not opened the file. Fraud warning!

Share this post


Link to post
Share on other sites

hi,

 

I have made ​​some changes in the module and I managed to fix some bug I had:

 

Fixed issues:

 

1) sum of total earnings.

2) sum of the total product sales.

3) update the look a bit.

4) Add the Spanish language.

 

Problem to correct:

 

1) Download CSV (not working)

 

modification was based on version 2.2 and the new version with the changes is 2.3.

 

I hope someone is encouraged to resolve what the CSV, as I could not solve it.

 

Tested on Prestashop version 1.6.0.9, statsprofitmargin-2.3 works perfect !!!!!

 

Hi Chucurulo,

 

Thank you for the good work.

I tried the module however I don't get the full data as per your post... see attached (presta 1.6.0.9)

 

Any idea how I can fix that?

 

margins.PNG

Edited by Aqueiroz (see edit history)

Share this post


Link to post
Share on other sites

Hi,

 

Always loading in 1.5.6.0

 

post-795091-0-18490100-1416799930_thumb.jpg

 

hi,

I have made ​​some changes in the module and I managed to fix some bug I had:

Fixed issues:

1) sum of total earnings.
2) sum of the total product sales.
3) update the look a bit.
4) Add the Spanish language.

Problem to correct:

1) Download CSV (not working)

modification was based on version 2.2 and the new version with the changes is 2.3.

I hope someone is encouraged to resolve what the CSV, as I could not solve it.

Tested on Prestashop version 1.6.0.9, statsprofitmargin-2.3 works perfect !!!!!

Edited by easynow (see edit history)

Share this post


Link to post
Share on other sites

hi,

 

I have made ​​some changes in the module and I managed to fix some bug I had:

 

Fixed issues:

 

1) sum of total earnings.

2) sum of the total product sales.

3) update the look a bit.

4) Add the Spanish language.

 

Problem to correct:

 

1) Download CSV (not working)

 

modification was based on version 2.2 and the new version with the changes is 2.3.

 

I hope someone is encouraged to resolve what the CSV, as I could not solve it.

 

Tested on Prestashop version 1.6.0.9, statsprofitmargin-2.3 works perfect !!!!!

 

I don't think so.

Edited by phungphi25 (see edit history)

Share this post


Link to post
Share on other sites

Hello everyone,

This module seems very interesting!!! I hope someone can check it and update it!!!!

 

Best regards!!!

Share this post


Link to post
Share on other sites

Hello everyone,

This module seems very interesting!!! I hope someone can check it and update it!!!!

 

Best regards!!!

 

hey

 

I have modified it here

 

hope the above helps you

  • Like 1

Share this post


Link to post
Share on other sites

hey

 

I have modified it here

 

hope the above helps you

 

GREAT!!!!!  Thank you very much for your work!!!!! I am going to put upload them right now!!!!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More