Why is the stock property not enabled until after the product node is saved?
In TC 3.2.5 when I add a new product node that contains the stock property it is initially disabled. I cannot enter a value into the stock property field.
If I save the node and then go back into it the stock property is enabled and a value can be entered.
This is not good as it introduces more click for the editor when creating content. I'm sure it never used to be like this in previous versions of TC.
How the stock property works is to store the stock value in a custom DB table. It does this in order to allow the stock value to change without needing to re-save the product node (saving Umbraco nodes results in various Umbraco things occurring including storing historic versions of your node in order to allow rollbacks). Unfortunately, in order for the stock property to know which node the stock property belongs to, it needs to wait until the node has been saved and thus now has an ID.
It might have worked differently pre-v7, but that's because in previous versions of Umbraco the content node was created in the DB as soon as you clicked create from the content tree, and thus it had an ID. However in v7+, when you create a content node, it is not actually persisted until you hit save and so until then, the node doesn't have an ID the stock field can link to.
I appreciate it's not the most optimum process though and I'll definitely see if there is anything that could be done to improve on this. It will likely only be addressed in the v8 version I'm working on though, but if I can, I'll try and back port it to v7 where possible.
Why is the stock property not enabled until after the product node is saved?
In TC 3.2.5 when I add a new product node that contains the stock property it is initially disabled. I cannot enter a value into the stock property field.
If I save the node and then go back into it the stock property is enabled and a value can be entered.
This is not good as it introduces more click for the editor when creating content. I'm sure it never used to be like this in previous versions of TC.
Hi Matt,
How the stock property works is to store the stock value in a custom DB table. It does this in order to allow the stock value to change without needing to re-save the product node (saving Umbraco nodes results in various Umbraco things occurring including storing historic versions of your node in order to allow rollbacks). Unfortunately, in order for the stock property to know which node the stock property belongs to, it needs to wait until the node has been saved and thus now has an ID.
It might have worked differently pre-v7, but that's because in previous versions of Umbraco the content node was created in the DB as soon as you clicked create from the content tree, and thus it had an ID. However in v7+, when you create a content node, it is not actually persisted until you hit save and so until then, the node doesn't have an ID the stock field can link to.
I appreciate it's not the most optimum process though and I'll definitely see if there is anything that could be done to improve on this. It will likely only be addressed in the v8 version I'm working on though, but if I can, I'll try and back port it to v7 where possible.
Ok, thank you for the quick response Matt.
is working on a reply...