[TYPO3-dev] Math in TS

Bernhard Kraft kraftb at kraftb.at
Sun Feb 1 12:06:35 CET 2009


Roberto Presedo - Cobweb schrieb:

> value = ({field:resultnumber}-1)
> insertData = 1
> prioriCalc = 1

Try it this way:

override = ({field:resultnumber}-1)
override.insertData = 1
prioriCalc = 1

It should also work this way:

override.dataWrap = ({field:resultnumber}-1)
prioriCalc = 1

Or you could also do it this way (I use this one usually):

stdWrap = 1
stdwrap.dataWrap = ({field:resultnumber}-1)
prioriCalc = 1

using ".dataWrap" is almost the same as assigning a value and setting
"insertData = 1" ... the important thing in your case, is that
"prioriCalc" is called very early during stdWrap - so it did the
prioriCalc "before" it inserted the field:resultnumber ... (probably it
is called "prioriCalc" because of this - and not because it takes */+-
priorities into account ;)


Note from a developer:
As a man should plant a tree, build a house and raise children once in
his life - A TYPO3 user/developer should have a look at
tslib/class.tslib_content.php method "stdWrap" once in his life *g*



PS: The whole price-calculation + adding VAT of my kb_shop system is
usually being done via TypoScript (!) To contra those who call this
"boring" *grin* ... For the kb_shop systems basket you wont find any
loops adding together the price*amount of each product - it is done via
TypoScript ... But be warned: kb_shop is discontinued. I am working
(large parts finished) on an "cleaner" alternative ...


greets,
Bernhard




More information about the TYPO3-dev mailing list