Forums / All Other Contributions/Addons / Products Profit/Margin Calculator and Report for 1.3.5!

Products Profit/Margin Calculator and Report for 1.3.5!

Started by samad64 on 6 Sep 2006, 10:29 PM · Views: 17,919

Results 1 to 20 of 58
6 Sep 2006, 10:29 PM
#1
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Products Profit/Margin Calculator and Report for 1.3.5!

Hi guys,

I combined both of these contributions by Farrukh and updated it to work with zc1.3.5. All files that are included in this package are up to date to my knowledge. If you find any problems please let me know and I will try to fix it ASAP.

While its in process of being accepted in the ZC downloads section, you can download it here:
http://nds.dfwhyundais.com/products_profit_margin_calculator_reportv1.zip

Original support threads:
http://www.zen-cart.com/forum/showthread.php?t=36336 (Profit Markup/Margin Calc)
http://www.zen-cart.com/forum/showthread.php?t=37567 (Individual Products Profit/Cost Report)

Please note that this updated version is basically the original two contribs combined, with the small fix (op.products_cost -> p.products_cost) for the report. The only other things that have changed is that its updated for 1.3.5

25 Sep 2006, 3:22 PM
#2
woodymon avatar

woodymon

Totally Zenned

Join Date:
Sep 2004
Posts:
2,309
Plugin Contributions:
1

Re: Products Profit/Margin Calculator and Report for 1.3.5!

GYGH-

Did this mod customization ever get uploaded or approved? I don't see in either Admin Tools or Other Modules downloads area. Farrukh's two mods also do not appear.

25 Sep 2006, 4:19 PM
#3
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Products Profit/Margin Calculator and Report for 1.3.5!

It hasn't been approved yet.. haven't received the e-mail regarding it. Not sure when it will be accepted :(.. but its still available on the mirror i provided. I haven't had time to update it any though

4 Oct 2006, 1:48 AM
#4
lextechs avatar

lextechs

Zen Follower

Join Date:
Mar 2005
Location:
Tempe, AZ
Posts:
316
Plugin Contributions:
0

Re: Products Profit/Margin Calculator and Report for 1.3.5!

Does this mod work with ez-pop and if so how do i use ezpop to add the Markup Percent?

Lextechs.com Powered By ZenCart

4 Oct 2006, 3:47 AM
#5
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Products Profit/Margin Calculator and Report for 1.3.5!

lextechs:

Does this mod work with ez-pop and if so how do i use ezpop to add the Markup Percent?

I'm honestly not sure about that, never used EZpopulate. Has anyone else tried it? I may give it a shot later on when I have some time on my test site

10 Oct 2006, 9:45 AM
#6
sanji avatar

sanji

Zen Follower

Join Date:
Jan 2005
Posts:
138
Plugin Contributions:
0

Re: Products Profit/Margin Calculator and Report for 1.3.5!

ezpopulate was not designed to handle the extra fields required by those contribution, which means that you still need to enter the margin on buying price separately.

Or it probably would require to change the ezpopulate contribution to add the extra fields. Haven't tried yet.

sanji

10 Oct 2006, 9:43 PM
#7
cpot avatar

cpot

New Zenner

Join Date:
Oct 2006
Posts:
3
Plugin Contributions:
0

Re: Products Profit/Margin Calculator and Report for 1.3.5!

getyourgameshere.com:

Hi guys,

I combined both of these contributions by Farrukh and updated it to work with zc1.3.5. All files that are included in this package are up to date to my knowledge. If you find any problems please let me know and I will try to fix it ASAP.

Thank you for this very good initiative (how is it possible to sell products without knowing the margin !! This should be included in the full zencart distrib.

His it possible to make one suggestion : It will be perfect to be able to enter the Gross product prive (incl.vat) and the product cost. Margin will be then calculated

I think it is more natural (you set the selling price and you know the product cost, this give you the margin) rather than the way it works currently

cheers,
cp

11 Oct 2006, 3:14 AM
#8
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Products Profit/Margin Calculator and Report for 1.3.5!

cpot:

Thank you for this very good initiative (how is it possible to sell products without knowing the margin !! This should be included in the full zencart distrib.

His it possible to make one suggestion : It will be perfect to be able to enter the Gross product prive (incl.vat) and the product cost. Margin will be then calculated

I think it is more natural (you set the selling price and you know the product cost, this give you the margin) rather than the way it works currently

cheers,
cp

Hi there,

I agree that this would be a better way to set this up. Right now I don't have time to actually modify it, I just combined it for the 1.3.5 release (since I needed it on one of my sites as well :)) but whenever I have some free time I will definitely look into doing something like that. I'd like to take this mod and make it so that it doesn't have to overwrite any files, but I'm not that knowledgable about the ZC structure just yet.. so I'm not sure if the original author tried the same thing and couldn't do it because of structural issues. I know a few files would still have to be overwritten, but I would hope not as many would have to be :)

16 Oct 2006, 3:39 PM
#9
gwaitsi avatar

gwaitsi

New Zenner

Join Date:
Oct 2006
Posts:
48
Plugin Contributions:
0

Re: Products Profit/Margin Calculator and Report for 1.3.5!

Hi, i downloaded it and i am now having problems creating a product.

I create a dummy product under as "taxable goods" and put in product cost and margin only. I get the message below.

1366 Incorrect decimal value: '' for column 'products_margin_gross_dollar' at row 1
in:
[insert into products (products_quantity, products_type, products_model, products_price, products_cost, products_markup, products_margin_gross_dollar, products_margin_gross_percent, products_date_available, products_weight, products_status, products_virtual, products_tax_class_id, manufacturers_id, products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute, product_is_free, product_is_call, products_quantity_mixed, product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order, products_discount_type, products_discount_type_from, products_price_sorter, products_image, products_date_added, master_categories_id) values ('0', '1', '', '301.35', '245', '23', '', '', null, '0', '1', '0', '1', '0', '2', '4', '0', '0', '0', '1', '0', '1', '0', '0', '0', '0', '0', '', now(), '0')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Do you have an answer for this please

16 Oct 2006, 5:33 PM
#10
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Products Profit/Margin Calculator and Report for 1.3.5!

GwaiTsi:

Hi, i downloaded it and i am now having problems creating a product.

I create a dummy product under as "taxable goods" and put in product cost and margin only. I get the message below.

1366 Incorrect decimal value: '' for column 'products_margin_gross_dollar' at row 1
in:
[insert into products (products_quantity, products_type, products_model, products_price, products_cost, products_markup, products_margin_gross_dollar, products_margin_gross_percent, products_date_available, products_weight, products_status, products_virtual, products_tax_class_id, manufacturers_id, products_quantity_order_min, products_quantity_order_units, products_priced_by_attribute, product_is_free, product_is_call, products_quantity_mixed, product_is_always_free_shipping, products_qty_box_status, products_quantity_order_max, products_sort_order, products_discount_type, products_discount_type_from, products_price_sorter, products_image, products_date_added, master_categories_id) values ('0', '1', '', '301.35', '245', '23', '', '', null, '0', '1', '0', '1', '0', '2', '4', '0', '0', '0', '1', '0', '1', '0', '0', '0', '0', '0', '', now(), '0')]
If you were entering information, press the BACK button in your browser and re-check the information you had entered to be sure you left no blank fields.

Do you have an answer for this please

Try tabbing through the fields, starting from "Products Price (Net):" down to the field right above "Product is Virtual:"

The way the mod currently works, is that it calculates everything once your cursor is in that box. If its not in the box, its as if you never filled it :P. This is one thing I will be working on and improving from the original author's version if I can

LMK if that doesn't fix the problem and I'll look into it a little bit more

16 Oct 2006, 5:52 PM
#11
gwaitsi avatar

gwaitsi

New Zenner

Join Date:
Oct 2006
Posts:
48
Plugin Contributions:
0

Re: Products Profit/Margin Calculator and Report for 1.3.5!

did the job, thanks

17 Oct 2006, 1:16 AM
#12
lextechs avatar

lextechs

Zen Follower

Join Date:
Mar 2005
Location:
Tempe, AZ
Posts:
316
Plugin Contributions:
0

Re: Products Profit/Margin Calculator and Report for 1.3.5!

getyourgameshere.com & sanji

Thanks for the info, can i still upload my products with ezpop without adding the margin information?

for example say i do the markup in excel like i have been doing then just uplaod my mark up as normal and use the mark up contrib for individual products i add.

sanji:

ezpopulate was not designed to handle the extra fields required by those contribution, which means that you still need to enter the margin on buying price separately.

Or it probably would require to change the ezpopulate contribution to add the extra fields. Haven't tried yet.

sanji

Lextechs.com Powered By ZenCart

1 Dec 2006, 7:24 AM
#13
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Products Profit/Margin Calculator and Report for 1.3.5!

Anything still happening with this? Is it still being supported, or dead?

1 Dec 2006, 8:01 AM
#14
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Products Profit/Margin Calculator and Report for 1.3.5!

im slowly working on this.. just took finals this week so i have more free time. currently changing it around so that it doesn't overwrite any files.. then ill work on a couple of the other things planned for it (like just inputting cost and sale price, and it auto calc's margin)

1 Dec 2006, 8:09 AM
#15
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Products Profit/Margin Calculator and Report for 1.3.5!

I just wanted to note that it should be very easy to make this work in conjunction with quick_updates. Recently I added a purchase price and margin column to quick_updates, I only really did not want to use products_margin_gross_dollar as column name, that is why I decided to stick with the column names I was already using (since long before I started using Zen Cart).

The currently latest version of quick_updates can be found here:
http://www.zen-cart.com/forum/showthread.php?p=296321#post296321

like just inputting cost and sale price, and it auto calc's marginThat is what quick_updates currently does BTW, maybe a look at the js might help?

Even nicer would be to have the option to enter purchase price and margin (and calc the sale price) or enter purchase and sale (and calculate margin). (not likely that I will get to that myself soon BTW, a.o. because my js skills are very limited)

1 Dec 2006, 8:13 AM
#16
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Products Profit/Margin Calculator and Report for 1.3.5!

Stupid question maybe... but does this contribution allow you to edit prices for multiple products in one go, or does it work on one product at the time?

1 Dec 2006, 8:13 AM
#17
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Products Profit/Margin Calculator and Report for 1.3.5!

im slowly working on this.. just took finals this week so i have more free time. currently changing it around so that it doesn't overwrite any files.. then ill work on a couple of the other things planned for it (like just inputting cost and sale price, and it auto calc's margin)Right on... I just installed it and that was going to be my first suggestion... there are FAR too many core over-writes that are completely unnecessary. There are a few that I'm not sure how you'll get around though... so I'm interested to find out.

I'm going to remove it and I'll try again when there's another release. The main thing I'm looking for isn't so much the margin calculations as simply a second place to put cost. Its easier to glance at the product then it is to dig up a receipt when a good customer asks for a discount over the phone. I just want to know how much I paid for something. In my biz, I don't have the luxury of being able to mark things up by any given percentage... the market dictates the price - I just need to know if its a product I want to sell or drop if its not worth it.

So the fancy auto-calcs just got in the way for me... the reports are nice, but I don't really need it in the edit screen

While you are cleaning up the code... consider re-doing the SQL too. There's really no need to alter the products table. Instead, there should be a new table for this contrib that keys with the products_id of the products table. That way, a zen upgrade won't (potentially) get screwed because this very important table has been messed with. Of course, that means chaning all the SQL references in the code, but that shouldn't be too hard with a good search-and-replace tool.

Cheers! let me know if you need a hand with anything in particular..

  • Steven
1 Dec 2006, 8:55 AM
#18
samad64 avatar

samad64

Totally Zenned

Join Date:
May 2006
Location:
Texas
Posts:
554
Plugin Contributions:
2

Re: Products Profit/Margin Calculator and Report for 1.3.5!

:P i actually might need a hand.. this is kind of my crash course into php/mysql. i've got a lot of the files down so that they don't overwrite core files, but i think about 3-5 files are still going to overwrite because they add a small bit to the original function instead of having a function of its own.

what i actually plan to do is ditch a few of the options it has already.. such as the percentage - i don't think anyone really cares per product what the percentage is.. and even if they did it belongs in a report instead of the edit screen. so that will be one of the first things to go. there was also another option in there that just slipped my mind and that will probably be ditched to - im only planning on keeping product cost and product selling price in there to simplify things.. the report (when i work on it) can show the percentage per product and everything else regarding it

i'm hoping that within a few weeks i can release a 2nd version of this but no promises :P

1 Dec 2006, 11:21 AM
#19
paulm avatar

paulm

Totally Zenned

Join Date:
Nov 2003
Posts:
1,878
Plugin Contributions:
5

Re: Products Profit/Margin Calculator and Report for 1.3.5!

While you are cleaning up the code... consider re-doing the SQL too. There's really no need to alter the products table. Instead, there should be a new table for this contrib that keys with the products_id of the products table. That way, a zen upgrade won't (potentially) get screwed because this very important table has been messed with.Could you elaborate on this Steven? I am certainly not a database expert, but I often add columns to existing tables and never had any problems with updates because of it.

1 Dec 2006, 5:28 PM
#20
s_mack avatar

s_mack

Totally Zenned

Join Date:
Jun 2005
Location:
Kelowna, BC Canada
Posts:
1,033
Plugin Contributions:
4

Re: Products Profit/Margin Calculator and Report for 1.3.5!

Its not that you WILL have problems, its that you CAN have problems. When the Zen Team upgrades, they (rightfully) assume they can do what they want to core files, including the database tables. What if one of their updates did a tear-through of the products table? At best, you lose your mods... at worst, you screw with their core.

But a bigger issue is user-removal. I really believe all mods should come with a simple "uninstall" scheme and that includes the ability to simply delete the related database tables.

Finally - it is cleaner. And it is easy. Database tables are relational for a reason... they relate :) So rather than adding one column to the products table, at two columns to a new table (one column being the key index - products_id in this case) and learn to use your SQL queries in a relational way. Yes, it means learning a little more (SQL Joins become very handy) but you'll be thankful you did in the longer run. Cleaner code AND a better understanding! And it really isn't hard. I'm just like you guys... picking this stuff up as I go along.

Some tips for avoiding core-overwrites:

Functions - if you need to change a function for the purposes of your mod only, consider instead copying the original function... giving it a new name and putting it in the extra-functions folder, then edit that to suit your needs and call that from your code rather than the original. This won't work in sweeping mods where changing the function IS your mod (and the function is called from throughout zen)... but if your mod just needs to use an existing function that needs to be a little different, then do it this way. This is the case for this contrib... there is a function file that I came across that introduces two new functions. Why screw with a core file over that? Put them into their own function file - that is what extra-functions is for.

Language files - Same thing. This contrib introduces new language defines and they've been thrown in with the "English.php" file... just make your own file and put it into the extra_definitions folder (under language/english). Same with filenames and database names... that is what extra_configures and extra_datafiles is for.

Unfortunately, the /admin folder is not nearly as flexible as the public /includes folder is. You don't have the luxury of overrides and (since 1.3) the wonderful init_includes and observer functionalities. So I'm sure you can't avoid them all when dealing with a mostly-admin contrib.

But try to think about how a user will remove your contrib easily. Don't rely on the "just go to a backup" thing... that's the main reason why I deleted this right away. Because immediately after installing the contrib is about the only time you can go to a backup... after that, you have changed other files and it becomes very difficult to keep what you want and ditch the contrib (after you find a major bug, or realize it is incompatible with another contrib, etc). Never assume someone wants your contrib for life!

Cheers!

  • Steven