Magento – Is it possible to display the gross profit of a product as an attribute in the admin page of a product

adminadminhtmlpriceproducttotals

Simply looking to create an area/block in the admin area of a product page that displays what the current gross profit is on that product. I.e. calculating the difference between the cost price and selling price of the item. So for example we have a cost attribute, and either a price or special_price attribute for the selling price. Some products have a special (sale) price active, some don't, so this probably requires an if statement. Initially I explored creating an attribute to do this, but that didn't really work out, so looking to hard code something into the admin page. Ideally creating small module to do this. Any ideas on the best way to go about or detail some of the code involved to get me started?

Best Answer

I just completed a module to calculate the profit and profit ratio on a product. The calculation is done when the product is saved and stores the values in 2 attributes (product_profit and product_profit_ratio). The module also adds 2 columns to the productgrid to display both the profit and ratio.

I published the source on BitBucket, see https://bitbucket.org/genmato/productprofit/.

I tested it on both 1.7.0.2 and 1.8, and might work on 1.6 also. Not compatibel with 1.5 and lower.

Related Topic