Поиск:

Ответ в темуСоздание новой темы Создание опроса
> Общее описание файлов конфигурации 
:(
    Опции темы
awers
Дата 29.10.2009, 00:06 (ссылка) | (нет голосов) Загрузка ... Загрузка ... Быстрая цитата Цитата


Эксперт
***


Профиль
Группа: Участник
Сообщений: 1465
Регистрация: 22.3.2006
Где: Россия, Таганрог

Репутация: нет
Всего: 31



Обычно есть несколько файлов конфигурации: api.xml config.xml wsdl.xml system.xml
Сейчас я не буду углубляться в описание каждого, а приведу общее описание назначения каждого из них.

api.xml: Файл описания интерфейса SOAP API для модуля. Это опциональный файл. 
В качестве примера:
Код

<config>
    <api>
        <resources>
            <checkout_cart translate="title" module="checkout">
                <model>checkout/cart_api</model>
                <title>Cart API</title>
                <methods>
                    <list translate="title" module="checkout">
                        <title>Retrieve cart data</title>
                        <method>info</method>       
                    </list>
                </methods>
            </checkout_cart>                 
        </resources>
    ...         
    </api>
</config>


config.xml: Общий файл конфигурации модуля. Тут указываются используемые ресурсы, перекрытие модулей или блоков, в некоторых случаях конфигурация для панели управления.
Код

<config>
    <modules>
        <Mage_Customer>
            <version>0.8.11</version>
        </Mage_Customer>
    </modules>
...
<blocks>
            <customer><class>Mage_Customer_Block</class></customer>
        </blocks>
        <models>
            <customer>
                <class>Mage_Customer_Model</class>
                <resourceModel>customer_entity</resourceModel>
            </customer>
            <customer_entity>
                <class>Mage_Customer_Model_Entity</class>
                <entities>
                    <entity>
                        <table>customer_entity</table>
                    </entity>
                    <address_entity>
                        <table>customer_address_entity</table>
                    </address_entity>
                    <value_prefix>
                        <table>customer_entity</table>
                    </value_prefix>
                    <customer_group>
                        <table>customer_group</table>
                    </customer_group>
                </entities>
            </customer_entity>
        </models>
        <resources>
            <customer_setup>
                <setup>
                    <module>Mage_Customer</module>
                    <class>Mage_Customer_Model_Entity_Setup</class>
                </setup>
                <connection>
                    <use>core_setup</use>
                </connection>
            </customer_setup>
            <customer_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </customer_write>
            <customer_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </customer_read>
        </resources>
...



wsdl.xml: XML-RPC Api. Обычно используется там же где и api.xml
Код

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns:typens="urn:{{var wsdl.name}}" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
    name="{{var wsdl.name}}" targetNamespace="urn:{{var wsdl.name}}">
    <types>
        <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Magento">
            <import namespace="http://schemas.xmlsoap.org/soap/encoding/" schemaLocation="http://schemas.xmlsoap.org/soap/encoding/" />
            ...           
        </schema>
    </types>
    <message name="resourceNameMethodNameRequest">
        <part name="sessionId" type="xsd:string" />
    </message>
    <message name="resourceNameMethodNameResponse">
        <part name="result" type="xsd:string" />
    </message>  
    <binding name="{{var wsdl.handler}}Binding" type="typens:{{var wsdl.handler}}PortType">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="resourceNameMethodName">
            ...
        </operation>        
    </binding>
    <service name="{{var wsdl.name}}Service">
        <port name="{{var wsdl.handler}}Port" binding="typens:{{var wsdl.handler}}Binding">
            <soap:address location="{{var wsdl.url}}" />
        </port>
    </service>
</definitions>


Ну и конечно system.xml. В нём расписывается основная чать конфигурации для панели управления.
Код

<config>
    <tabs>
        <customer translate="label" module="customer">
            <label>Customers</label>
            <sort_order>300</sort_order>
        </customer>
    </tabs>
    <sections>
        <customer translate="label" module="customer">
            <class>separator-top</class>
            <label>Customer Configuration</label>
            <tab>customer</tab>
            <sort_order>130</sort_order>
            <show_in_default>1</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <account_share translate="label">
                    <label>Account Sharing Options</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>0</show_in_website>
                    <show_in_store>0</show_in_store>
                    <fields>
                        <scope translate="label">
                            <label>Share Customer Accounts</label>
                            <frontend_type>select</frontend_type>
                            <backend_model>customer/config_share</backend_model>
                            <source_model>customer/config_share</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>0</show_in_website>
                            <show_in_store>0</show_in_store>
                        </scope>
                    </fields>
                </account_share>
...


Подробно каждый файл конфигурации будет рассмотрен в других статьях.
PM MAIL WWW ICQ Skype   Вверх
  
Ответ в темуСоздание новой темы Создание опроса
1 Пользователей читают эту тему (1 Гостей и 0 Скрытых Пользователей)
0 Пользователей:
« Предыдущая тема | etc | Следующая тема »


 




[ Время генерации скрипта: 0.0809 ]   [ Использовано запросов: 21 ]   [ GZIP включён ]


Реклама на сайте     Информационное спонсорство

 
По вопросам размещения рекламы пишите на vladimir(sobaka)vingrad.ru
Отказ от ответственности     Powered by Invision Power Board(R) 1.3 © 2003  IPS, Inc.