Blog Sections Open

Updating TV Values Directly Through the Database in Evolution CMS

How to update a TV value directly in the database and what tradeoffs that approach brings.

Sometimes the fastest way to update a template variable is not through the manager or a high-level helper, but through a direct database write. The original example used $modx->db->update() against the TV values table to replace a stored value for a known resource and TV.

That can be a valid technique in migration scripts, mass updates, cleanup tools, or repair operations. But it comes with a cost: you are bypassing the more structured parts of the content lifecycle, so you need to think about cache invalidation, dependent output, and any custom logic that would normally run on save.

As a rule, direct TV updates are fine for controlled maintenance scripts. They are a poor substitute for normal editorial workflows. If you use them, make the target TV ID and content ID explicit, and always plan the cache refresh afterward.

Newer post

Outputting TV Values Reliably in getResources Templates

How to make sure TV values really appear inside a getResources template instead of assuming the placeholder names will just work.

Older post

Rendering AJAX Product Details from Resource Data in Evolution CMS

How to load a product resource through the Evolution API, normalize its TV values, and render a popup or detail block through AJAX.