What is magento source models? The magento source models - its models which you can use for forms in the admin panel or admin settings at the magento system -> configuration tabs and fieldsets.
Is any way to say simple what is source models in Magento?
Yes, it is . I think the simplest way will be to explain: Magento Source Models List - its list of dropdown menus available in magento by default. This dropdowns can be used at the admin grid or at the system configuration. Actually you can use it anywhere where you make form using magento widget forms.How to use source model at system.xml file?
If you look at the line 43 at the code example below you will see tag <source_model /> . This is the place where you can put model name from the magento source models list below. Please pay attention at the previous line 42 it says <frontend_type> select</frontend_type> . This line define that our field will be select field (dropdown field) .Why Is it useful?
When you building new admin options or extension you can save time and avoid building duplicate of existing source model. Once you read once magento source models list you at least will remember what it doing. And the next time you will need to make source model you can save your time by using something what already exist.What the other fields mean in system.xml file?
At lines 39-49 field properties declared. Except source_model which you can make on your own or use one from the magento source models list which already exist, there are some properties of the system admin configuration field. Here are some of them: <label/> - This is label of your field <comment/> - comment which will appear under the field. <sort_order/> - order of the field in fieldset. <show_in_default/>, <show_in_website/>, <show_in_store> - Where this field will be shown. I.e. scope of the magento website. <frontend_type/> - This field will set what type of field will be visible. Here are some of the possible values: select, multiselect, label, text, textarea, time, image. <frontend_class/> - This can add additional custom class for your field. <validate/> - If field should be validated you can specify validation type here. <depends/> - Here you can specify dependable configuration fields in magento admin. and of course <source_model/> which may have values from the magento source models list below:Here is Magento Source Models List.
Model | Description |
adminhtml/system_config_source_admin_page | returns list of all the items in Magento Admin menu |
adminhtml/system_config_source_allregion | returns list of all country regions grouped by country |
adminhtml/system_config_source_catalog_timeFormat | returns time format (12h or 24h ) |
adminhtml/system_config_source_cms_page | returns list of CMS Pages |
adminhtml/system_config_source_cms_wysiwyg_enabled | returns list of text editor options |
adminhtml/system_config_source_country | returns list of all countries from directory module |
adminhtml/system_config_source_cron_frequency | returns list of cron frequence ( Daily, Weekly, Monthly) |
adminhtml/system_config_source_currency | returns list of currencies |
adminhtml/system_config_source_customer_group | returns list of customer groups |
adminhtml/system_config_source_date_short | returns list of available short date formats |
adminhtml/system_config_source_design_robots | returns list of robots options (index, follow) |
adminhtml/system_config_source_email_identity | returns list of email sending identities (General Contact, Sales Representative, etc) |
adminhtml/system_config_source_email_method | returns list of email methods (Bcc, Separate Email) |
adminhtml/system_config_source_email_template | returns list of transactional email templates |
adminhtml/system_config_source_enabledisable | returns list of two options (“Enable” and “Disable”) |
adminhtml/system_config_source_frequency | returns list of frequencies (Always, Hourly, Daily, Weekly, Monthly, Yearly, Never) |
adminhtml/system_config_source_locale | returns list of locales |
adminhtml/system_config_source_locale_country | returns list of localized country names |
adminhtml/system_config_source_locale_currency_all | returns list of localized currency names |
adminhtml/system_config_source_locale_timezone | returns list of localized timezone names |
adminhtml/system_config_source_locale_weekdays | returns list of localized weekday names |
adminhtml/system_config_source_notification_frequency | returns array of hours frequency ( used for cron) |
adminhtml/system_config_source_notoptreq | returns list of three options for customer widget mandatory indetificator (“Not”, “Optional”, “Required”) |
adminhtml/system_config_source_order_status | returns list of available order statuses except pending payment |
adminhtml/system_config_source_payment_allmethods | returns list of all payment methods |
adminhtml/system_config_source_payment_allspecificcountries | returns boolean values for payment ("All Allowed Countries", "Specific Countries") |
adminhtml/system_config_source_price_scope | returns list of price scopes |
adminhtml/system_config_source_shipping_allmethods | returns list of all shipping methods |
adminhtml/system_config_source_shipping_allspecificcountries | returns boolean values for shipping ("All Allowed Countries", "Specific Countries") |
adminhtml/system_config_source_shipping_taxclass | returns list of tax shipping classes |
adminhtml/system_config_source_store | returns list of stores |
adminhtml/system_config_source_tax_basedon | returns list of values which tax based on |
adminhtml/system_config_source_yesno | return boolean options (“Yes”, “No”) |
checkout/config_source_cart_summary | return list of display options at the cart |