Question

I'm pretty new to Modx I'm not sure if what I'm asking isn't possible or if I'm just looking in the wrong place.

We are using a TV field to store a quantity available. Someone fills in a form on the website we send them off to another site to finish there order. Then when they come back we'd like to update the quantity available. I've found lots of information about how to retrieve modx database information but nothing about updating it via code?

Was it helpful?

Solution

You can update the value of a TV like this:

$page = $modx->getObject('modResource', 123);

if (!$page->setTVValue('bio', 'This is my new bio...')) {
    $modx->log(xPDO::LOG_LEVEL_ERROR, 'There was a problem saving your TV...');
}

the documentation for it is here: http://rtfm.modx.com/revolution/2.x/making-sites-with-modx/customizing-content/template-variables/accessing-template-variable-values-via-the-api

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top