Home > Magento > Code > Magento 1 : Menambahkan Kategori di Manage Products Grid

Magento 1 : Menambahkan Kategori di Manage Products Grid

Categories Grid

app\code\core\Mage\Adminhtml\Block\Catalog\Category\Tab\Product.php

menambahkan kolom Catalog Number

_prepareCollection

tambahkan

->addAttributeToSelect(‘sp_catalogno’)

menjadi

protected function _prepareCollection() { if ($this->getCategory()->getId()) { $this->setDefaultFilter(array(‘in_category’=>1)); } $collection = Mage::getModel(‘catalog/product’)->getCollection() ->addAttributeToSelect(‘sp_catalogno’) ->addAttributeToSelect(‘name’) ->addAttributeToSelect(‘sku’) ->addAttributeToSelect(‘price’) ->addStoreFilter($this->getRequest()->getParam(‘store’)) ->joinField(‘position’, ‘catalog/category_product’, ‘position’, ‘product_id=entity_id’, ‘category_id=’.(int) $this->getRequest()->getParam(‘id’, 0), ‘left’); $this->setCollection($collection);

if ($this->getCategory()->getProductsReadonly()) { $productIds = $this->_getSelectedProducts(); if (empty($productIds)) { $productIds = 0; } $this->getCollection()->addFieldToFilter(‘entity_id’, array(‘in’=>$productIds)); }

return parent::_prepareCollection(); }

_prepareColumns

tambahkan

$this->addColumn(‘sp_catalogno’, array( ‘header’=> Mage::helper(‘catalog’)->__(‘Catalog ID’), ‘width’ => ‘100px’, ‘index’ => ‘sp_catalogno’ ));

18 total views, 18 views today

About Andhi Irawan

Check Also

Magento 1 dan 2 : Re-index via ssh / putty

Magento 1 You are running this command from ROOT and indexer.php is located under shell …

Leave a Reply

Your email address will not be published. Required fields are marked *