Version Notes
- Outputs correct scope for store view, website and default settings (explicit scope omitted for the latter).
Download this release
Release Info
| Developer | C3 Media |
| Extension | C3_ConfigSetupHelper |
| Version | 1.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.0.1 to 1.1.0
- app/code/local/C3/ConfigSetupHelper/Block/System/Config/Form/Field.php +10 -1
- app/code/local/C3/ConfigSetupHelper/Helper/Data.php +9 -0
- app/code/local/C3/ConfigSetupHelper/Model/Observer.php +41 -6
- app/code/local/C3/ConfigSetupHelper/etc/config.xml +1 -1
- app/code/local/C3/ConfigSetupHelper/etc/system.xml +11 -0
- app/etc/modules/C3_ConfigSetupHelper.xml +11 -0
- package.xml +8 -13
app/code/local/C3/ConfigSetupHelper/Block/System/Config/Form/Field.php
CHANGED
|
@@ -1,10 +1,19 @@
|
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
/**
|
| 3 |
* Abstract config form element renderer
|
| 4 |
*
|
| 5 |
* @category Mage
|
| 6 |
* @package Mage_Adminhtml
|
| 7 |
-
* @author Magento Core Team <core@magentocommerce.com>
|
| 8 |
*/
|
| 9 |
class C3_ConfigSetupHelper_Block_System_Config_Form_Field
|
| 10 |
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
| 1 |
<?php
|
| 2 |
+
/**
|
| 3 |
+
* C3 Media Ltd
|
| 4 |
+
*
|
| 5 |
+
* @title Config Setup Helper
|
| 6 |
+
* @category C3
|
| 7 |
+
* @package C3_ConfigSetupHelper
|
| 8 |
+
* @author C3 Development Team <development@c3media.co.uk>
|
| 9 |
+
* @copyright Copyright (c) 2014 C3 Media Ltd (http://www.c3media.co.uk)
|
| 10 |
+
*/
|
| 11 |
+
|
| 12 |
/**
|
| 13 |
* Abstract config form element renderer
|
| 14 |
*
|
| 15 |
* @category Mage
|
| 16 |
* @package Mage_Adminhtml
|
|
|
|
| 17 |
*/
|
| 18 |
class C3_ConfigSetupHelper_Block_System_Config_Form_Field
|
| 19 |
extends Mage_Adminhtml_Block_System_Config_Form_Field
|
app/code/local/C3/ConfigSetupHelper/Helper/Data.php
CHANGED
|
@@ -1,4 +1,13 @@
|
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Default Helper - Currently just so that translations will work
|
| 1 |
<?php
|
| 2 |
+
/**
|
| 3 |
+
* C3 Media Ltd
|
| 4 |
+
*
|
| 5 |
+
* @title Config Setup Helper
|
| 6 |
+
* @category C3
|
| 7 |
+
* @package C3_ConfigSetupHelper
|
| 8 |
+
* @author C3 Development Team <development@c3media.co.uk>
|
| 9 |
+
* @copyright Copyright (c) 2014 C3 Media Ltd (http://www.c3media.co.uk)
|
| 10 |
+
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Default Helper - Currently just so that translations will work
|
app/code/local/C3/ConfigSetupHelper/Model/Observer.php
CHANGED
|
@@ -1,4 +1,13 @@
|
|
| 1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
/**
|
| 4 |
* Observer for config setup helper
|
|
@@ -20,10 +29,30 @@ class C3_ConfigSetupHelper_Model_Observer
|
|
| 20 |
// Helper for translations
|
| 21 |
$helper = Mage::helper('c3_configsetuphelper');
|
| 22 |
|
| 23 |
-
|
| 24 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 25 |
$section = $ob->getSection();
|
| 26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 27 |
// Get fully qualified field names from form
|
| 28 |
$paths = array();
|
| 29 |
foreach (Mage::app()->getRequest()->getParam('show_config') as $groupname => $group) {
|
|
@@ -50,7 +79,13 @@ class C3_ConfigSetupHelper_Model_Observer
|
|
| 50 |
if ($pathValues[$fullName] === null) {
|
| 51 |
$showVal = 'null';
|
| 52 |
}
|
| 53 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
}
|
| 55 |
}
|
| 56 |
$string .= $this->_getFooter() . '</pre>';
|
|
@@ -77,7 +112,7 @@ $installer->startSetup();
|
|
| 77 |
*/
|
| 78 |
protected function _getFooter()
|
| 79 |
{
|
| 80 |
-
return '$installer->endSetup();';
|
| 81 |
}
|
| 82 |
|
| 83 |
/**
|
|
@@ -93,10 +128,10 @@ $installer->startSetup();
|
|
| 93 |
// Get collection with correct scope and paths
|
| 94 |
$collection = Mage::getModel('core/config_data')->getCollection();
|
| 95 |
if ($store !== null) {
|
| 96 |
-
$collection->addFieldToFilter('scope','
|
| 97 |
$collection->addFieldToFilter('scope_id',$store);
|
| 98 |
} elseif ($website !== null) {
|
| 99 |
-
$collection->addFieldToFilter('scope','
|
| 100 |
$collection->addFieldToFilter('scope_id',$website);
|
| 101 |
} else {
|
| 102 |
$collection->addFieldToFilter('scope','default');
|
| 1 |
<?php
|
| 2 |
+
/**
|
| 3 |
+
* C3 Media Ltd
|
| 4 |
+
*
|
| 5 |
+
* @title Config Setup Helper
|
| 6 |
+
* @category C3
|
| 7 |
+
* @package C3_ConfigSetupHelper
|
| 8 |
+
* @author C3 Development Team <development@c3media.co.uk>
|
| 9 |
+
* @copyright Copyright (c) 2014 C3 Media Ltd (http://www.c3media.co.uk)
|
| 10 |
+
*/
|
| 11 |
|
| 12 |
/**
|
| 13 |
* Observer for config setup helper
|
| 29 |
// Helper for translations
|
| 30 |
$helper = Mage::helper('c3_configsetuphelper');
|
| 31 |
|
| 32 |
+
// Get website and store codes and ids
|
| 33 |
+
$websiteCode = $ob->getWebsite();
|
| 34 |
+
$website = null;
|
| 35 |
+
if ($websiteCode !== null) {
|
| 36 |
+
$website = Mage::getModel('core/website')->load($websiteCode, 'code')->getId();
|
| 37 |
+
}
|
| 38 |
+
$storeCode = $ob->getStore();
|
| 39 |
+
$store = null;
|
| 40 |
+
if ($storeCode !== null) {
|
| 41 |
+
$store = Mage::getModel('core/store')->load($storeCode, 'code')->getId();
|
| 42 |
+
}
|
| 43 |
$section = $ob->getSection();
|
| 44 |
|
| 45 |
+
// Set scope based on what has been set
|
| 46 |
+
if ($store !== null) {
|
| 47 |
+
$scope = 'stores';
|
| 48 |
+
$scopeId = $store;
|
| 49 |
+
} elseif ($website !== null) {
|
| 50 |
+
$scope = 'websites';
|
| 51 |
+
$scopeId = $website;
|
| 52 |
+
} else {
|
| 53 |
+
$scope = 'default';
|
| 54 |
+
}
|
| 55 |
+
|
| 56 |
// Get fully qualified field names from form
|
| 57 |
$paths = array();
|
| 58 |
foreach (Mage::app()->getRequest()->getParam('show_config') as $groupname => $group) {
|
| 79 |
if ($pathValues[$fullName] === null) {
|
| 80 |
$showVal = 'null';
|
| 81 |
}
|
| 82 |
+
// If non-default scope used, add options to method call
|
| 83 |
+
if ($scope == 'default') {
|
| 84 |
+
$scopeArgs = '';
|
| 85 |
+
} else {
|
| 86 |
+
$scopeArgs = ", '{$scope}', '{$scopeId}'";
|
| 87 |
+
}
|
| 88 |
+
$string .= "\$installer->setConfigData('" . addslashes($fullName) . "', {$showVal}{$scopeArgs});\n";
|
| 89 |
}
|
| 90 |
}
|
| 91 |
$string .= $this->_getFooter() . '</pre>';
|
| 112 |
*/
|
| 113 |
protected function _getFooter()
|
| 114 |
{
|
| 115 |
+
return "\n" . '$installer->endSetup();';
|
| 116 |
}
|
| 117 |
|
| 118 |
/**
|
| 128 |
// Get collection with correct scope and paths
|
| 129 |
$collection = Mage::getModel('core/config_data')->getCollection();
|
| 130 |
if ($store !== null) {
|
| 131 |
+
$collection->addFieldToFilter('scope','stores');
|
| 132 |
$collection->addFieldToFilter('scope_id',$store);
|
| 133 |
} elseif ($website !== null) {
|
| 134 |
+
$collection->addFieldToFilter('scope','websites');
|
| 135 |
$collection->addFieldToFilter('scope_id',$website);
|
| 136 |
} else {
|
| 137 |
$collection->addFieldToFilter('scope','default');
|
app/code/local/C3/ConfigSetupHelper/etc/config.xml
CHANGED
|
@@ -13,7 +13,7 @@
|
|
| 13 |
<config>
|
| 14 |
<modules>
|
| 15 |
<C3_ConfigSetupHelper>
|
| 16 |
-
<version>1.0
|
| 17 |
</C3_ConfigSetupHelper>
|
| 18 |
</modules>
|
| 19 |
<global>
|
| 13 |
<config>
|
| 14 |
<modules>
|
| 15 |
<C3_ConfigSetupHelper>
|
| 16 |
+
<version>1.1.0</version>
|
| 17 |
</C3_ConfigSetupHelper>
|
| 18 |
</modules>
|
| 19 |
<global>
|
app/code/local/C3/ConfigSetupHelper/etc/system.xml
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
<config>
|
| 2 |
<tabs>
|
| 3 |
<c3extensions translate="label">
|
| 1 |
+
<!--
|
| 2 |
+
/**
|
| 3 |
+
* C3 Media Ltd
|
| 4 |
+
*
|
| 5 |
+
* @title Config Setup Helper
|
| 6 |
+
* @category C3
|
| 7 |
+
* @package C3_ConfigSetupHelper
|
| 8 |
+
* @author C3 Development Team <development@c3media.co.uk>
|
| 9 |
+
* @copyright Copyright (c) 2014 C3 Media Ltd (http://www.c3media.co.uk)
|
| 10 |
+
*/
|
| 11 |
+
-->
|
| 12 |
<config>
|
| 13 |
<tabs>
|
| 14 |
<c3extensions translate="label">
|
app/etc/modules/C3_ConfigSetupHelper.xml
CHANGED
|
@@ -1,4 +1,15 @@
|
|
| 1 |
<?xml version="1.0"?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
<config>
|
| 3 |
<modules>
|
| 4 |
<C3_ConfigSetupHelper>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
+
<!--
|
| 3 |
+
/**
|
| 4 |
+
* C3 Media Ltd
|
| 5 |
+
*
|
| 6 |
+
* @title Config Setup Helper
|
| 7 |
+
* @category C3
|
| 8 |
+
* @package C3_ConfigSetupHelper
|
| 9 |
+
* @author C3 Development Team <development@c3media.co.uk>
|
| 10 |
+
* @copyright Copyright (c) 2014 C3 Media Ltd (http://www.c3media.co.uk)
|
| 11 |
+
*/
|
| 12 |
+
-->
|
| 13 |
<config>
|
| 14 |
<modules>
|
| 15 |
<C3_ConfigSetupHelper>
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>C3_ConfigSetupHelper</name>
|
| 4 |
-
<version>1.0
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -12,20 +12,15 @@
|
|
| 12 |
<p>Features:
|
| 13 |
<ul><li>Speed up development - ready to copy and paste into a setup script and save</li>
|
| 14 |
<li>Works with any extension that displays options in the system config</li>
|
| 15 |
-
<li>Self-commenting: Gives section and group names to aid visibility</li>
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
<li>
|
| 19 |
-
<li>Self-commenting: Gives section and group names to aid visibility</li></ul></p>
|
| 20 |
-

|
| 21 |
-
<p>Known issues:
|
| 22 |
-
<ul><li>There are some settings in e.g. Paypal that aren’t currently outputting correctly. We are looking into this for the next version.</li>
|
| 23 |
-
<li>Oldest supported CE version is 1.7.0.1</li>
|
| 24 |
</ul></notes>
|
| 25 |
<authors><author><name>C3 Media</name><user>c3media_ltd</user><email>hello@c3media.co.uk</email></author></authors>
|
| 26 |
-
<date>2014-08-
|
| 27 |
-
<time>
|
| 28 |
-
<contents><target name="magelocal"><dir name="C3"><dir name="ConfigSetupHelper"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><file name="Field.php" hash="
|
| 29 |
<compatible/>
|
| 30 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 31 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>C3_ConfigSetupHelper</name>
|
| 4 |
+
<version>1.1.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license uri="http://www.opensource.org/licenses/gpl-license.php">GNU General Public License</license>
|
| 7 |
<channel>community</channel>
|
| 12 |
<p>Features:
|
| 13 |
<ul><li>Speed up development - ready to copy and paste into a setup script and save</li>
|
| 14 |
<li>Works with any extension that displays options in the system config</li>
|
| 15 |
+
<li>Self-commenting: Gives section and group names to aid visibility</li>
|
| 16 |
+
<li>Set default, website and store-view settings</li></ul></p></description>
|
| 17 |
+
<notes><ul>
|
| 18 |
+
<li>Outputs correct scope for store view, website and default settings (explicit scope omitted for the latter).</li>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</ul></notes>
|
| 20 |
<authors><author><name>C3 Media</name><user>c3media_ltd</user><email>hello@c3media.co.uk</email></author></authors>
|
| 21 |
+
<date>2014-08-30</date>
|
| 22 |
+
<time>06:45:36</time>
|
| 23 |
+
<contents><target name="magelocal"><dir name="C3"><dir name="ConfigSetupHelper"><dir name="Block"><dir name="System"><dir name="Config"><dir name="Form"><file name="Field.php" hash="0a60951c867788eef3f9d59ce0225c96"/></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="fc0cdda862331b3cde8e42db4d838388"/></dir><dir name="Model"><file name="Observer.php" hash="54286dd7328999b4b76c91c19f5896ae"/></dir><dir name="etc"><file name="adminhtml.xml" hash="264455adf68a82fdf90e66bcd8e55311"/><file name="config.xml" hash="72a97dbdeb2fbdc321f6354624998a65"/><file name="system.xml" hash="20a65918a7a3cbd8d5ccf52d7ef6a1fc"/></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="C3_ConfigSetupHelper.csv" hash="d9af8dbceefcb3641627229ee485e891"/></dir></target><target name="mageetc"><dir name="modules"><file name="C3_ConfigSetupHelper.xml" hash="ebfc0255290433a028e3e6ea91b22a14"/></dir></target></contents>
|
| 24 |
<compatible/>
|
| 25 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 26 |
</package>
|
