Meets.io is a native SDK for iOS and Android, designed to ease communication between mobile apps and Magento stores.
URL: http://meets.io
Category Archives: Magento
About Magento: Meets Magento | Build native mobile shopping experiences for Magento
Posted by loopion
on April 28, 2014
No comments
Add column to product grid properly
Posted by loopion
on May 27, 2011
No comments
app/code/local/My/Module/etc/config.xml
mymodule/adminhtml_observer
onBlockHtmlBefore
mymodule/adminhtml_observer
onEavLoadBefore
app/code/local/My/Module/Model/Adminhtml/Observer
class My_Module_Model_Adminhtml_Observer
{
public function onBlockHtmlBefore(Varien_Event_Observer $observer) {
$block = $observer->getBlock();
if (!isset($block)) return;
switch ($block->getType()) {
case 'adminhtml/catalog_product_grid':
/* @var $block Mage_Adminhtml_Block_Catalog_Product_Grid */
$block->addColumn('COLUMN_ID', array(
'header' => Mage::helper('mymodule')->__('COLUMN HEADER'),
'index' => 'COLUMN_ID',
));
break;
}
}
public function onEavLoadBefore(Varien_Event_Observer $observer) {
$collection = $observer->getCollection();
if (!isset($collection)) return;
if (is_a($collection, 'Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection')) {
/* @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */
// Manipulate $collection here to add a COLUMN_ID column
$collection->addExpressionAttributeToSelect('COLUMN_ID', '...Some SQL goes here...');
}
}
}
This come from Clockworkgeek user on a stackoverflow question. This is gold!