Magento - Store Config only added to database after being saved - magento

I have noticed that in Magento the core_config_data table is very small just after installation and it gradually gets populated over time ONLY when sections of the system config are saved. For example there are no values in the core_config_data table for the contacts settings - yet i can still do Mage::getStoreConfig('contacts/contacts/enabled') and get the correct value.
So, does this mean that magento is simply reading the config xml until a value is saved, and at which point it saves to the database and then the value is read from there?
If this is the case, then surely this is a bad design pattern, having these values stored in two places?

I think this post may help.
The Magento Config: Loading System Variables

Related

Magento table rates and multiple stores?

I am trying to make my table rates work with my multi store setup. I have 2 stores (not only store views) for the same installation and I want table rates for that.
I tried with the built in table rates and I also tried with http://www.magentocommerce.com/magento-connect/webshopapps-matrixrate-1-multiple-table-rates-extension.html.
The problem is, this only seems to work for my first store, the second store always tells me that there is no shipping available in the OPC.
I checked the tables shipping_tablerate and shipping_matrixrate (this one comes from the extension) and both have the website_id column which is 1 (my first store) for me. I tried changing from 1 to 3 (thats the id of my other store), did not help.
This is the content for the extensions file:
Land,Region/Staat,Stadt,"Zip/Postal Code From","Zip/Postal Code To","Gewicht From","Gewicht To",Versandkosten,"Delivery Type"
DEU,*,,,,1.1000,2.0000,4.4000,Versand
DEU,*,,,,2.1000,5.0000,6.9900,Versand
DEU,*,,,,0.2000,1.0000,3.9500,Versand
DEU,*,,,,0.0000,0.1000,6.9900,Versand
How can I make this work for my second store as well?
Thanks!
you just need to import csv for all websites.
No changes in code.

How to add image field in dynamic input group for magento admin configuration setting?

I have created a module which add dynamic input group to magento admin configuration.
I have added image field but it can't save in database. Means if I select image than only image store in database in core_config_data — the encrypted value of row (just image field value)
If I remove image field than the data saved properly in database along with other inputs.
So here I can't save image type data with other data of dynamic input.
I've found reason + solution, maybe this is helpful for someone. Magento is using the wrong backend model. For saving images the backend model must be system_config_backend_image. But as you've added the fields dynamically (and not inside the system.xml) the fields have no assigned backend model, so magento will use the default for text values etc..
The solution is, to use the clone_fields functionality. Please find my explanation how to use it on my blog post http://www.mellority-report.com/magento-dynamic-config-fields-with-custom-backend-models/

How to create multi store module in the Magento

I want to create my custom module multi store compatible. I want to get the value from my custom database table as per configuration scope. While adding the values to the database table, i have specified the scope_id and scope like as Magento does in the core_config_data table. Now how can i fetch those inserted value from the table according to the selected website on the front end.
I have the following database value snippet.
ID value scope_id scope
1 test 0 default
2 test1 4 store
3 test12 5 website
Can anybody help me in this? Thanks
It is not so easy to reuse Magento's config loading for your own needs.
What you want is to inherit your values from default -> website -> store (if not overwritten in there).
Magento converts the database config to the internal XML representation in Mage_Core_Model_Resource_Config::loadToXml and does the merging and inheritance logic in there.
The inheritance logic is all in the loadToXml() function - so you could implement something similar if you want to take the same approach and build your values for each store scope.
If you simply need to get one value for a specific scope you just have to read the database row with that store, if not found with the website the store is in, if not found the default value.

Saving Extension Config Data Magento

I've been trying to figure out exactly how does magento save the config data for a module given in System.xml. reason?I would like to edit the data provided by the user before storing it in the database.
Any clues????
Take a look at Mage_Core_Model_Store::setConfig function (and getConfig for reading the value). You will probbably have to write an observer that will listen to store_save_before event.
Magento stores configuration data in core_config_data database table - path column is the hierarhical structure of XML elements in system.xml file and is the same as XPath used for reading the default value out of config.xml file and value column contains the value that was saved.
When accessing the data with for e.g. Mage::getStoreConfig( 'path', $storeId ); Magento first searches the table for path-value pair and if it doesn't find it it reads the default value from config.xml file.

Magento checkout method recorded in database

Is the Magento checkout method recorded anywhere in the database.
I know the value can be accessed during the session i.e. register, guest etc but after the order is placed is the value recorded anywhere?
Anton S gave a good answer but if you need more help viewing tables and their fields in the Magento database, this is a really useful tool.
http://www.magereverse.com/
Simply select your version of Magento and then start selecting tables. It gives you correlations between various fields in the tables as well, which can be helpful when tracking down entity data.
Hope this helps!
Checkout method is stored in the sales_flat_quote table in the customer_is_guest field. A value of 1 indicates the customer checked out using the guest checkout option. A value of 0 indicates the customer checked out using their account. You can access the quote using its id from the order object.

Resources