I have the following in MODX revo 2.2:
I defined 5 Template Variables which represent a pricing structure. One of the TV’s represents the base price and is maintained (in the manager) by the user while the others should be automatically calculated as a known percentage of the base price. So what I want is that when the user changes the base price the other 4 TV’s are automatically (re)calculated.
I tried implementing this by defining an @EVAL binding for the 4 TV’s and calling a snippet, however I was not successful with that approach. Even just a simple @EVAL return 100; would leave the TVs blank.
I also had a look at plugins to solve this and found various system events that fire when working with TV’s. This suggests that this would be a method to implement this.
Any ideas on how to deal with this?
Can we see some code? It sounds to me like your 4 other TV’s don’t need to be TV’s at all [unless they need to be modified on a per resource basis?] but may be better served as snippets in your template running a calculation from the one base price TV. Also – be careful with the system events, while there are quite a few there to work with, not all of them are actually implemented. [I found out the hard way] –
Thanks Roger. I do spend a lot of time trying to find ways to NOT use TVs as they can become very expensive to process. If at anytime you look at a TV and think it will work as a snippet [or chunk or plugin] then that’s probably going to be the way to go. IMHO.
Glad you got it worked out.