calcul

cachousam

Avatar: cachousam

2012-08-25 10:35

Hello,
Is it difficult to create a function that indicates when the administrator receives a new command, the amount of the margin on this command.
In fact, I created a new variable "purchase price" in the creation of my articles.
It is stored in my database.
So there should be a mathematical function as "selling price - purchase price," and the result is stored in the database to display in the template or mail message.

Thank you in advance.
Dominique

» Quick.Cart v3.x

cachousam

Avatar: cachousam

2012-08-29 07:56

Hello.
No Idea.
Put me on the right way?
Thanks

boboo

Avatar: boboo

2012-08-29 08:43

To get margin, just create a new variable in throwProduct function
$aData['fMargin']=normalizePrice($aData['fPrice']-$aData['fPurchasePrice']);
$aData['sMargin']=displayPrice($aData['fMargin']);
(I don't know, how did you name the "purchase price" field in DB, so I used example "fPurchasePrice").
Then add the $aData[sMargin] into admin products template, at the place, you want to see it.

To get the margin info in the orders email, you have to do something more.
Either to save the margin into orders-DB, or pick it from prod-DB after throwing order in sendEmailWithProductsDetails function.

qc-plugins.kimla.de

cachousam

Avatar: cachousam

2012-08-29 09:49

Hi Boboo

I would like to save this value in the database.
In fact, it will be necessary that the function calculates the margin ​​on each product (depending on purchased item number) and then make a margin on total order, and then stores the result in the database to s 'used to show where you want it.

Oupss, !
Dominique

boboo

Avatar: boboo

2012-08-29 11:17

I can do it for You.
But not here ;-)
Contact me over my page

qc-plugins.kimla.de

Back to top
about us | contact