CalcBuilder Forum

matrix pricelist

User moon_1817 2014-09-22 22:51:18

Hi there!

A short question. The customer need to just put one number into the field "ku".
Now, my pricelist is based on quantyties. Example: buy up to 12, the price is 5; buy up to 24, the price is 4; buy up to 36, the price is 3, buy more then 36 the price is 2.

So how i need to create a matrix table?

With kind regards
Gunnar

Moonsoft support 2014-09-23 11:32:51

Hi,
you can build a matrix, the most simple one containing all combinations, or containg ranges that you should check when recovering data, but for that simple condition we'd suggest using if statement instead at the code:

(Please replace with lower than and greater than chars, they are stripped at the forum text)


//if ku lower or equal than 12 the price is 5.
if($ku

12&&$ku
24&&$ku
=36) $price=2;



//Now you can use $price here for further calculations.


Hope this helps

Edited by MSTeam - 23.09.2014 12:05

...
Support/development

Perfect for small code changes or to correct any bug at your site

Buy now!
...
Support/development 40 hours

With the peace of mind of having a professional team at your service (20% discount)

Buy now!