106 Posts
krkr
11 years ago
0
Topic

Hi all

Short introduction and common mistakes :( (mine) in field calculation.

Actually it is very easy. Based on my needs.

1. VERY IMPORTANT! Check in SEBLOD Options -> Computation Format. It is important because I tried to multiply 0.7 with other number and it will never worked out as should be 0,7 and therefore result was always 0. Settings

2. I had 3 fields

  • price_eur - field where I insert price in EUR, just number.
  • exchange_rate - field which has already have default value with exchange rate, in my case 0,702804 , when I start new product with template it is always there
  • price_lvl - field which calculates from price_eur*exchange_rate     ( * -could be any function + - / etc)
3. Fields are made, ready to go, price_eur and exchange_rate is saved in DB by default, now for price_lvl calculation in Admin form press 5 which is Conditional States + Computation and press Add in Computation Rules column. Computation rules

4. In Modal windows for computation choose fields you want to operate with and give function what to do with it. I didn't experimented a lot with it, but I believe that as I used Custom a * b then added fields are the same way a, b ...  If someone could approve that fields added in column are counted like a, b, c and then you could write in Custom Computation you megaformulas.
Format/Precision i used toFixed and set for 2 as it shows 2 numbers behind comma, Round will remove everything behind comma. Computation Modal Window

5. Now when I am in my article/product and inserting price_eur then after hitting Tab for next field or saving article/product price is automatically saved in database field, after I am getting this out in in frontend.

I think there is time to start experimenting yourself :)

I hope that this will help anyone.
Regards
Get a Book for SEBLOD