문제

시스템 -> 구성 -> 디자인에서 사용자 정의 그룹 및 필드를 만들었습니다. 나는 아래의 이벤트를 사용했다.

<admin_system_config_changed_section_design>
    <observers>
        <custom>
            <type>singleton</type>
            <class>Custon_Custom_Observer</class>
            <method>save</method>
            </custom>
    </observers>
</admin_system_config_changed_section_design>
.

마젠토에는 세 가지 유형의 범위가 있습니다.

1) 기본

2) 웹 사이트

3) 상점

관리 패널의 사용자 정의 필드의 모든 값을 사용자 정의 테이블의 값을 저장하고 싶습니다. 여기에 이미지 설명 예를 들어

저장소 수준에서 필드 값을 설명합니다.

Mage::getStoreConfig('design/custom/description');
.

나는 위의 값을 웹 사이트 레벨 및 현재 상점 수준에서 원한다. 나는 이 링크 을 시도했습니다.

도움이 되었습니까?

해결책

config.xml,

 <global>
    <events>
        <admin_system_config_changed_section_design>
            <observers>
                <custom>
                    <type>singleton</type>
                    <class>Custon_Custom_Observer</class>
                    <method>saveSystemConfig</method>
                    </custom>
            </observers>
        </admin_system_config_changed_section_design>
    </events>
 </global>
.

observer.php,

public function saveSystemConfig(Varien_Event_Observer $observer)
{
    $postData = $observer->getEvent()->getData();

    if (is_null($postData['store']) && $postData['website']) //check for website scope
    {
        $scopeId = Mage::getModel('core/website')->load($postData['website'])->getId();
        $description  = Mage::app()->getWebsite($scopeId)->getConfig('design/custom/description');
        $currentScope = 'websites';
    }
    elseif($postData['store']) //check for store scope
    {
        $scopeId =   Mage::getModel('core/store')->load($postData['store'])->getId();
        $description  = Mage::app()->getStore($scopeId)->getConfig('design/custom/description');
        $currentScope = 'stores';
    }
    else //for default scope
    {
        $scopeId = 0;
        $description  = Mage::getStoreConfig('design/social-meta-tags/design/custom/description')
        $currentScope = 'default';
    }
}
.

위의 모든 범위에서 개별 필드 값을 가져올 수 있습니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top