ok, so this isn't my first mass action but, this does have me scratching my head.
I made a module CLR_exportMassAction. Deployed it on the good old localhost with no problems. However when I move the files out to my server, nothing happens. I have reindexed and flushed caches. I have a feeling its some configuration weirdness and magento isn't hooking in my module.
Here is my code: \local\CLR\exportMassAction\etc\config.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<global>
<models>
<CLR_exportMassAction>
<class>CLR_exportMassAction_Model</class>
</CLR_exportMassAction>
</models>
</global>
<adminhtml>
<events>
<adminhtml_block_html_before>
<observers>
<CLR_exportMassAction>
<type>singleton</type>
<class>CLR_exportMassAction/observer</class>
<method>addExportMassactionToProductGrid</method>
</CLR_exportMassAction>
</observers>
</adminhtml_block_html_before>
</events>
</adminhtml>
<admin>
<routers>
<adminhtml>
<args>
<modules>
<CLR_exportMassAction before="Mage_Adminhtml">CLR_exportMassAction_Adminhtml</CLR_exportMassAction>
</modules>
</args>
</adminhtml>
</routers>
</admin>
</config>
local\CLR\exportMassAction\Model\Observer.php
<?php
class CLR_exportMassAction_Model_Observer
{
public function addExportMassactionToProductGrid($observer)
{
$block = $observer->getBlock();
if($block instanceof Mage_adminHtml_Block_Catalog_Product_Grid) {
$block ->getMassactionBlock()->addItem('export', array(
'label' => Mage::helper('catalog')->__('Export to CSV'),
'url' => $block->getUrl('*/*/massExport', array('_current'=>true)),
));
}
}
}
local\CLR\exportMassAction\controllers\Adminhtml\Catalog\ProductController.php
<?php
class CLR_exportMassAction_Adminhtml_Catalog_ProductController extends Mage_Adminhtml_Controller_Action
{
public function massExportAction()
{
$productIds = $this->getRequest()->getParam('product');
if (!is_array($productIds)) {
$this->_getSession()->addError($this->__('Please select product(s).'));
$this->_redirect('*/*/index');
}
else {
//write headers to the csv file
$content = "id,name,url,sku\n";
try {
foreach ($productIds as $productId) {
$product = Mage::getSingleton('catalog/product')->load($productId);
$content .= "\"{$product->getId()}\",\"{$product->getName()}\",\"{$product->getProductUrl()}\",\"{$product->getSku()}\"\n";
}
} catch (Exception $e) {
$this->_getSession()->addError($e->getMessage());
$this->_redirect('*/*/index');
}
$this->_prepareDownloadResponse('export.csv', $content, 'text/csv');
}
}
}
app\etc\CLR_exportMassAction.xml
<config>
<modules>
<CLR_exportMassAction>
<active>true</active>
<codePool>community</codePool>
</CLR_exportMassAction>
</modules>
</config>
I am just looking for a pointer really on where to go from here; I am not sure what the next troubleshooting options are.