Data Structure
Last updated
Last updated
The information about the changes in the builder is stored on different layers. Understanding the difference between them is the key for using the plugin at full power ;) Also, this article contains the information that will help you not overwrite your product price config by accident.
The data from the modals which can be accessed from the builder panel are saved directly to the DB. None of this info is used for modifying the visual appearance of the form.
The builder content data is a collection of information about each module/option settings. The builder content is getting updated every time any changes in option's settings are made. You have to save builder content after that.
The green diskette icon becomes yellow and a small yellow exclamation sign is added to open/close builder panel button. It means, that builder content has to be saved in order to publish changes made in visual builder.
The data from module/option setting modal are saved both as a part of the builder content (used for modifying the visual appearance) and directly to DB (used in price calculation and/or service data to be used in cart/order). So, when you click on Save button in option's settings modal window without 'add to DB' checkbox checked, only builder content will be updated. If you click that button with 'add to DB' checkbox checked, builder content will be updated as well as option's setting (all its settings) will be saved to DB.
👉 At the moment, any Module settings are saved as a part of the builder content ONLY. Therefore, you have to save the builder content in order to publish any changes made.
The limitation is that the marked settings cannot be different for the different instances of the same Option (Option with the same slug). However, those settings which are not marked with the yellow sign CAN! 💪 😎 The biggest and most significant advantage is a possibility to create only one specific Option and re-use it in other products. For instance, you can have different labels for the different instances of 'width' Option on different product pages for the same Option (Option with the same slug). Or you can have different colors for texts, borders, paddings, margins etc in the different instances of the same option.
Another disadvantage is that the info displayed in the Option's settings modal window is incorrect for this specific instance of the Option. For instance, you have changed "Price/Rate" setting for this Option, saved the changes to DB then. Of course, the builder content will be instantly updated with the new changes, but let's imagine that you did not saved the builder content and closed the builder. What happened now is that the builder content data contain the old info about "Price/Rate" setting, but the new values are actually used during the price calculation because they are pulled directly from the DB but not from the builder content. And this is confusing, I agree. But... see the previously described advantage. Is not it cool? :)
The second major advantage is that the Option settings data saved to DB is used when you duplicate this Option. So, by creating an Option and filling in its settings once - it is possible to quickly replicate Option (create many instances of the Option) in other products. Awesome! :)
Please, read more about this and option's 'Sync' setting here (section 'Basics').
As it has already been said, options' settings are actually of two types. Some of them are important for visual appearance. Others are used only during the price calculation/in the cart/on the order page, therefore must be saved to DB. The second type of settings is marked with a yellow sign. It looks like this:In this example, both "Price/Rate" and "Label text in cart/order meta" are marked by the yellow sign. Changes in these settings MUST be saved to DB (saved with checked 'Save to DB?' checkbox). Otherwise they will NOT take any effect!