Created
December 27, 2014 12:21
-
-
Save Schrank/8aff4cc624b665a16705 to your computer and use it in GitHub Desktop.
Get magento XML configuration for default, websites and stores
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// app/code/local/Ikonoshirt/Shared/Model/Adminhtml/ | |
class Ikonoshirt_Shared_Model_Adminhtml_ConfigAsXml | |
extends Mage_Core_Model_Config_Data | |
{ | |
protected function _afterLoad() | |
{ | |
/** @var $xml Mage_Core_Model_Config */ | |
$xml = Mage::getConfig(); | |
$xml->loadDb(); | |
/** @var $result Mage_Core_Config_Element[] */ | |
$result | |
= $xml->getXpath('/config/default | /config/websites | /config/stores'); | |
$output | |
= <<<XML | |
<config> | |
<default> | |
{$result[0]->asNiceXml()} | |
</default> | |
<websites> | |
{$result[1]->asNiceXml()} | |
</websites> | |
<stores> | |
{$result[2]->asNiceXml()} | |
</stores> | |
</config> | |
XML; | |
$this->setValue($output); | |
} | |
protected function _beforeSave() | |
{ | |
$this->setValue(''); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" ?> | |
<!-- app/code/local/Ikonoshirt/Shared/etc/system.xml --> | |
<config> | |
<tabs> | |
<ikonoshirt translate="label" module="ikonoshirt_pbkdf2"> | |
<label>Ikonoshirt</label> | |
<sort_order>506</sort_order> | |
</ikonoshirt> | |
</tabs> | |
<sections> | |
<ikonoshirt_shared translate="label" module="ikonoshirt_pbkdf2"> | |
<label>Misc</label> | |
<tab>ikonoshirt</tab> | |
<sort_order>0</sort_order> | |
<show_in_default>1</show_in_default> | |
<show_in_website>1</show_in_website> | |
<show_in_store>1</show_in_store> | |
<groups> | |
<config translate="label" module="ikonoshirt_shared"> | |
<label>Config</label> | |
<expanded>1</expanded> | |
<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> | |
<fields> | |
<save_config translate="label comment" module="ikonoshirt_pbkdf2"> | |
<label><![CDATA[Get config as XML]]></label> | |
<frontend_type>textarea</frontend_type> | |
<backend_model>ikonoshirt_shared/adminhtml_configAsXml</backend_model> | |
<sort_order>5</sort_order> | |
<show_in_default>1</show_in_default> | |
<show_in_website>0</show_in_website> | |
<show_in_store>0</show_in_store> | |
</save_config> | |
</fields> | |
</config> | |
</groups> | |
</ikonoshirt_shared> | |
</sections> | |
</config> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment