Search

shamjascp

This WordPress.com site is the bee's knees

Month

March 2015

Magento admin panel sorting via manufacture

Magento: Add Manufacturer Column to Admin Product Grid

Thanks to Josh Pratt for his post for which this a resurrected copy of from March 11, 2010.  This was a tremendously helpful how to post that details how to add the manufacturer column to the Magento Admin Product Grid.  I have successfully used this on Magento v1.8 without issue.  Thanks.

Step 1:
Copy this file: /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php and paste it here:/app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php. This will override the core file with your own without actually modifying core code.

Step 2:
By looking at this file, you will clearly see how Magento is setting up the columns. Find where you want to put the Manufacturer column, and paste the following code:

$manufacturer_items = Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter()->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');
        foreach ($manufacturer_items as $manufacturer_item) :
            if ($manufacturer_item->getAttributeCode() == 'manufacturer')
                $manufacturer_options[$manufacturer_item->getOptionId()] = $manufacturer_item->getValue();
        endforeach;
 
        $this->addColumn('manufacturer',
            array(
                'header'=> Mage::helper('catalog')->__('Manufacturer'),
                'width' => '100px',
                'type'  => 'options',
                'index' => 'manufacturer',
                'options' => $manufacturer_options
        ));

Step 3:
Enjoy your new column. Props to wolfdog85 for helping me figure out the code. The original forum post can be found here.

Once again thanks to Josh's original post.
Advertisements

How to convert an entire MySQL database characterset and collation to UTF-8?

Use the ALTER DATABASE and ALTER TABLE commands.

ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;

Create a free website or blog at WordPress.com.

Up ↑