I need to someone to finish this ebay calculator because it isn't calculating correctly. It's actually a bit tricky.
The client wants to be able enter his desired profit margin, for example 15%, and then have the calculator determine exactly how much he needs to list the product for to cover his cost of the product, ebay fees, paypal fees, and his profit margin so that after all expenses are paid he pockets exactly 15% profit. But it's tricky because the ebay and paypal fee's are based on a percentage of the final value price (note these products are fixed price, not auction) and every time you add your ebay fees and paypal fee's to your list price to cover your costs. the ebay fees and paypals are no longer valid because the new list price is now greater than the list price for which the original ebay fees and paypals fees were calculated for.
If you look at the source code for the calculator you will see that I actually created php while loop which continously loops some code which increments a profit variable by 1 for as long as the following condition is true "while( 0.15(ebayfee + paypalfee + productcost + profit) <= profit) and then it breaks the loop but the end result, ie ebay fees, paypal fees, profit margin, and list price are not correct.
You can take a look at the calculator here... [url removed, login to view]
Được trao cho:
Hi sybercoda, the solution can be worked out mathematically without the need for trial and error loops. I can deliver the working code within a day, and probably much quicker. Thanks.