impulsmedia
  • Home
  • Vormgeving
  • Websites
    • Magento
    • WordPress
    • Hosting
  • Drukwerk
  • Belettering
  • contact
impulsmedia
Reading now

Attribute kolom toevoegen aan admin list magento

jul 02, 2016

Betrouwbare hosting

apr 08, 2016

Zelf apps maken …

jan 14, 2016

Latitude and Longitude Finder on Map Get Coordinates

jan 13, 2016

Chrome flush DNS and Sockets

dec 17, 2015

InDesign / Dynamische PDF-documenten

dec 17, 2015

How to change a header for the Magento CMS or Module page | Atwix

Load more

Attribute kolom toevoegen aan admin list magento

Magento By ipmadmin / 27 maart 2017
next
Use ← → keys to navigate
  • A+ A-

Magento: Add attribute columns in ‘Manage Products’ grid

Magento does not provide us with the ability to choose which attributes are included as columns in the Manage Products grid but it’s fairly simple to make the necessary code changes.

The code that generates the Manage Products grid is at /app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php. The first thing you need to do is copy Grid.php into to the local directory structure. In other words, you copy Grid.php into the following location; /app/code/local/Mage/Adminhtml/Block/Catalog/Product/. If there is no such location, then you must create the necessary directories. The final location of the file must be; /app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php

Now, open Grid.php (the one in the local directory structure) and begin editing. Find the following code;

 $this->addColumn('sku',
 array(
 'header'=> Mage::helper('catalog')->__('SKU'),
 'width' => '80px',
 'index' => 'sku',

That’s the code that adds the SKU column to the product grid. Now, let’s say you have a custom attribute called Supplier ID (supplier_ID) and you want these to appear on the Manage Products grid as well. Place the following code either before or after the above block of code, as long as it’s inside _prepareColumns().

 $this->addColumn('supplier_id',
 array(
 'header'=> Mage::helper('catalog')->__('Supplier ID'),
 'width' => '150px',
 'index' => 'supplier_id',
 ));

Then add the following line to _prepareCollection() where the other attributes are listed like this;

 ->addAttributeToSelect('supplier_id')

That should be all you need to do. You might have to re-compile, refresh your caches, logout, and log back in to see the change in your product grid.

The above example is for adding an attribute with a Catalog Input Type for Store Owner of Text Field. What if your attribute uses a dropdown list? The code above will have to be modified.

Let’s say you have an attribute called Supplier (supplier) which in the product editor presents a dropdown list of suppliers to choose from. To do this, we can add the following code to _prepareColumns():

 $supplier_items = Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter()->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');
foreach ($supplier_items as $supplier_item) :
 if ($supplier_item->getAttributeCode() == 'supplier')
 $supplier_options[$supplier_item->getOptionId()] = $supplier_item->getValue();
endforeach;
 
$this->addColumn('supplier',
 array(
 'header'=> Mage::helper('catalog')->__('supplier'),
 'width' => '150px',
 'type' => 'options',
 'index' => 'supplier',
 'options' => $supplier_options,
));
->addAttributeToSelect('supplier')

That should do it for you. Re-compile, refresh your caches, and logout and then back in if you need to.

 

Magento: Add attribute columns in ‘Manage Products’ grid

Meest recente berichten

  • 40 Most Common WordPress Errors and How to Fix Them
  • e-mail builder
  • Attribute kolom toevoegen aan admin list magento
  • Betrouwbare hosting
  • Zelf apps maken …

Categorieën

  • Developer
  • Drukwerk
  • Hosting
  • Magento
  • Vormgeving
  • Websites
  • Wordpress
  • Home
  • Vormgeving
  • Websites
  • Drukwerk
  • Belettering
  • contact
Copyright © 2019 by impulsmedia.