官术网_书友最值得收藏!

Websites and store scopes

One of Magento's core features is the ability to handle multiple websites and stores with a single Magento installation. Internally, Magento refers to each of these instances as scopes.

Values for certain elements such as products, categories, attributes, and configuration are scope-specific and can differ on different scopes. This gives Magento tremendous flexibility. For example, a product can be set up on two different websites with different prices but still share the rest of the attribute configuration.

As developers, one of the areas where we will be using scopes the most is when working with configuration. The different configuration scopes available in Magento are as follows:

  • Global: As the name implies, this applies across all scopes.
  • Website: These are defined by a domain name and are composed by one or more stores. Websites can be set up to share customer data or be completely isolated.
  • Store: These are used to manage products and categories and to group store views. Stores also have a root category that allows us to have separated catalogs per store.
  • Store view: By using store views, we can set up multiple languages on our store frontend.

Configuration options in Magento can store values on three scopes (global, website, and store views). By default, all the values are set on the global scope. Using system.xml on our modules, we can specify the scopes on which the configuration options can be set. Let's revisit our previous system.xml file:

…
<field_name translate="label comment">
    <label>Enabled</label>
    <comment>
         <![CDATA[Comments can contain <strong>HTML</strong>]]>
     </comment>
     <frontend_type>select</frontend_type>
     <source_model>adminhtml/system_config_source_yesno</source_model>
     <sort_order>10</sort_order>
     <show_in_default>1</show_in_default>
     <show_in_website>1</show_in_website>
     <show_in_store>1</show_in_store>
</field_name>
…
主站蜘蛛池模板: 库伦旗| 临夏市| 望奎县| 灵丘县| 临海市| 虹口区| 吴江市| 大庆市| 鄂托克前旗| 玉山县| 托克托县| 丰台区| 临沧市| 方山县| 辽宁省| 白玉县| 淳安县| 威信县| 栖霞市| 大竹县| 崇仁县| 仁化县| 库车县| 庐江县| 偃师市| 景洪市| 永胜县| 盐亭县| 大英县| 吉隆县| 宁明县| 攀枝花市| 大化| 凤山市| 中宁县| 临泉县| 杭州市| 宾川县| 乃东县| 邵东县| 镇赉县|