I want to create a record somewhere in the WordPress database that contains data for use globally throughout a website and also by php programs that will create and modify data in a post type called "products".
The data could be anything but includes some parameters that will be used to calculate a sale price from a trade price.
The parameters could include:
- mark-up percentage
- fixed cost
- minimum value
So in the php programs there will be a calculation similar to:
= max of (minimum value, ((trade cost * mark-up percentage) + fixed cost))
I know that I can embed this data in the php programs and also include it in templates but I would like a simple single place where it is stored and can be easily changed by a non technical user.
So, if the business decides to change mark-up percentage from 35% to 30% and then rerun the appropriate php program it is easy to do via a CRED form.
When displaying in a template, I am looking for something that effectively does the following:
display "mark-up percentage" from post type "scratchpad" record id "3456"
In the php program fields needs to be accessed via the appropriate php code, which I expect the programmer to be able to work out.
I have tried to describe this in a generic way in case it is of use to others.
Since those parameters is for "globally throughout a website", I suggest you store them into your database table "wp_options", then you will be able to get the parameters value anywhere in your website, with wordpress function get_option()
A safe way of getting values for a named option from the options database table. http://codex.wordpress.org/Function_Reference/get_option
but there isn't such a feature within CRED form or Types plugin, it needs custom PHP codes,according to our new support police, we do not provide custom codes support: https://toolset.com/toolset-support-policy/
so I suggest you check out our certified partners for it: https://toolset.com/consultant/