ZenphotoCMS Forum
Adding Database Fields & Sort Options - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: Adding Database Fields & Sort Options (/thread-8096.html)



Adding Database Fields & Sort Options - mtnmchgrl - 2011-01-13

How difficult would it be to add fields to the ZP database? I like the current sort features that ZP offers, but I wanted to also add a field for price so that it could be sorted from low to high. Is that possible?




Adding Database Fields & Sort Options - sbillard - 2011-01-13

There is actually a field reserved for this sort of thing-the custom_data field. You do have to be careful, though, since there may be other demands on the field (for instance from some other plugins.)

But you can also add such a field through PHPmyAdmin. But of course there would be no Zenphoto interface to update/change/view the values. The object model provides a basic get() and set() methods which would let you code such accesses.




Adding Database Fields & Sort Options - acrylian - 2011-01-13

I think actually the new general purpose plugin_storage database table should be used if you require special extra fields, e.g. more than there are already (you can use the custom field but also of course codeblock or location for anything). Of course using that table that requires a little more code work since you have to relatively assign that to elements.