Skip to content

Instantly share code, notes, and snippets.

<?xml version="1.0"?>
<config>
<modules>
<Davidf_AddCustomerGroupColumns>
<active>true</active>
<codePool>local</codePool>
</Davidf_AddCustomerGroupColumns>
</modules>
</config>
<?xml version="1.0"?>
<config>
<modules>
<Davidf_AddCustomerGroupColumns>
<version>1.0</version>
</Davidf_AddCustomerGroupColumns>
</modules>
<global>
<blocks>
<adminhtml>
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join(array('customer_info' => Mage::getSingleton('core/resource')->getTableName('customer_entity')), 'main_table.customer_id = customer_info.entity_id', array('customer_info.group_id'))
->join(array('customer_group' => Mage::getSingleton('core/resource')->getTableName('customer_group')), 'customer_info.group_id = customer_group.customer_group_id', array('customer_group.customer_group_code AS group_name'));
$this->setCollection($collection);
return parent::_prepareCollection();
protected function _prepareCollection()
{
$collection = Mage::getResourceModel($this->_getCollectionClass());
$collection->getSelect()->join(array('customer_info' => Mage::getSingleton('core/resource')->getTableName('customer_entity')), 'main_table.customer_id = customer_info.entity_id', array('customer_info.group_id'))
->join(array('customer_group' => Mage::getSingleton('core/resource')->getTableName('customer_group')), 'customer_info.group_id = customer_group.customer_group_id', array('customer_group.customer_group_code AS group_name'));
$this->setCollection($collection);
return parent::_prepareCollection();
}
protected function _prepareColumns()
{
...
$this->addColumn('group_name', array(
'header' => Mage::helper('sales')->__('Customer Group'),
'index' => 'group_name',
'width' => '70px',
'filter_index' => 'customer_group.customer_group_code',
));
...
<config>
<modules>
<DavidF_LayoutConfig>
<version>0.0.1</version>
</DavidF_LayoutConfig>
</modules>
<global>
<models>
<davidf_layoutconfig>
<class>DavidF_LayoutConfig_Model</class>
<?xml version="1.0"?>
<config>
<modules>
<DavidF_LayoutConfig>
<active>true</active>
<codePool>local</codePool>
</DavidF_LayoutConfig>
</modules>
</config>
<?xml version="1.0"?>
<config>
<tabs>
<layout_config translate="label" module="davidf_layoutconfig">
<label>Configurable Layout</label>
<sort_order>150</sort_order>
</layout_config>
</tabs>
<sections>
<layout_config translate="label" module="davidf_layoutconfig">
<?php
class DavidF_LayoutConfig_Model_Adminhtml_System_Config_Source_CatalogPage
{
public function toOptionArray()
{
$toReturn = array();
$toReturn[1]['value'] = '1';
$toReturn[1]['label'] = '1 Column with Topnav';
$toReturn[0]['value'] = '0';
...
<catalog_category_layered>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<action method="setTemplate" ifconfig="layout_config/layouts/catalog_page"><template>page/1column.phtml</template></action>
</reference>
</catalog_category_layered>
...