protected function _prepareColumns() { $this->addColumn('entity_id', array('header' => Mage::helper('catalog')->__('ID'), 'width' => '50px', 'type' => 'number', 'index' => 'entity_id')); $this->addColumn('name', array('header' => Mage::helper('catalog')->__('Name'), 'index' => 'name')); $store = $this->_getStore(); if ($store->getId()) { $this->addColumn('custom_name', array('header' => Mage::helper('catalog')->__('Name in %s', $store->getName()), 'index' => 'custom_name')); } $this->addColumn('type', array('header' => Mage::helper('catalog')->__('Type'), 'width' => '60px', 'index' => 'type_id', 'type' => 'options', 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray())); $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())->load()->toOptionHash(); $this->addColumn('set_name', array('header' => Mage::helper('catalog')->__('Attrib. Set Name'), 'width' => '100px', 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets)); $this->addColumn('sku', array('header' => Mage::helper('catalog')->__('SKU'), 'width' => '80px', 'index' => 'sku')); $this->addColumn('yc_most_recent_expiration_date', array('header' => Mage::helper('swisspost_yellowcube')->__('exp Date'), 'width' => '80px', 'index' => 'yc_most_recent_expiration_date')); $store = $this->_getStore(); $this->addColumn('price', array('header' => Mage::helper('catalog')->__('Price'), 'type' => 'price', 'currency_code' => $store->getBaseCurrency()->getCode(), 'index' => 'price')); if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $this->addColumn('qty', array('header' => Mage::helper('catalog')->__('Qty'), 'width' => '100px', 'type' => 'number', 'index' => 'qty')); } $this->addColumn('visibility', array('header' => Mage::helper('catalog')->__('Visibility'), 'width' => '70px', 'index' => 'visibility', 'type' => 'options', 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray())); $this->addColumn('status', array('header' => Mage::helper('catalog')->__('Status2222'), 'width' => '70px', 'index' => 'status', 'type' => 'options', 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray())); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('websites', array('header' => Mage::helper('catalog')->__('Websites'), 'width' => '100px', 'sortable' => false, 'index' => 'websites', 'type' => 'options', 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash())); } $this->addColumn('action', array('header' => Mage::helper('catalog')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('catalog')->__('Edit'), 'url' => array('base' => '*/*/edit', 'params' => array('store' => $this->getRequest()->getParam('store'))), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores')); if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss')) { $this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS')); } return parent::_prepareColumns(); }
/** * Remove some grid columns for product grid in popup */ public function _prepareColumns() { parent::_prepareColumns(); $this->removeColumn('action'); $this->removeColumn('status'); $this->removeColumn('visibility'); $this->clearRss(); }
protected function _prepareColumns() { parent::_prepareColumns(); if (!Mage::getSingleton('aitpermissions/role')->isPermissionsEnabled() && Mage::helper('aitpermissions')->isShowProductOwner()) { $this->addColumnAfter('created_by', array('header' => Mage::helper('aitpermissions')->__('Owner'), 'width' => '70px', 'index' => 'created_by', 'type' => 'options', 'options' => array_diff(Mage::getSingleton('aitpermissions/source_admins')->getOptionArray(), array(""))), 'status'); $this->sortColumnsByOrder(); } return $this; }
protected function _prepareColumns() { parent::_prepareColumns(); if (Mage::getStoreConfig('vc_easyupdateproductinfor/general/enable') == 1) { $store = $this->_getStore(); $this->addColumn('price', array('header' => Mage::helper('catalog')->__('Price'), 'type' => 'price', 'currency_code' => $store->getBaseCurrency()->getCode(), 'index' => 'price', 'renderer' => 'vc_easyupdateproductinfor/adminhtml_column_renderer_price')); if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $this->addColumn('qty', array('header' => Mage::helper('catalog')->__('Qty'), 'width' => '100px', 'type' => 'number', 'index' => 'qty', 'renderer' => 'vc_easyupdateproductinfor/adminhtml_column_renderer_qty')); } } }
protected function _prepareColumns() { $helper = Mage::helper('categorygridfilter'); if ($helper->isCategoryEnabled() == 1) { $this->addColumnAfter('categorygridfilter_category_list', array('header' => Mage::helper('catalog')->__('Category'), 'index' => 'categorygridfilter_category_list', 'sortable' => false, 'width' => '250px', 'type' => 'options', 'options' => Mage::getSingleton('categorygridfilter/system_config_source_category')->toOptionArray(), 'renderer' => 'SSTech_Categorygridfilter_Block_Adminhtml_Catalog_Product_Grid_Render_Category', 'filter_condition_callback' => array($this, 'filterCallback')), "name"); } if ($helper->isThumbnailEnabled() == 1) { $this->addColumnAfter('thumbnail', array('header' => Mage::helper('catalog')->__('Thumbnail'), 'align' => 'left', 'index' => 'thumbnail', 'renderer' => 'SSTech_Categorygridfilter_Block_Adminhtml_Catalog_Product_Grid_Render_Thumbnail', 'width' => '107'), "entity_id"); } return parent::_prepareColumns(); }
protected function _prepareColumns() { $helper = Mage::helper('thememanager'); $this->addColumn('entity_id_grid_checkbox', array('header' => $helper->__(''), 'width' => 20, 'renderer' => 'Meigee_Thememanager_Block_Adminhtml_Options_Tabs_Product_EntityIdGrid', 'filter' => false)); parent::_prepareColumns(); $used_product_columns = array('entity_id_grid_checkbox', 'entity_id', 'name', 'custom_name', 'type'); $columns = $this->getColumns(); foreach ($columns as $column_id => $columns) { if (!in_array($column_id, $used_product_columns)) { $this->removeColumn($column_id); } } }
protected function _prepareColumns() { $this->addColumn('entity_id', array('header' => Mage::helper('catalog')->__('ID'), 'width' => '50px', 'type' => 'number', 'index' => 'entity_id')); $this->addColumn('name', array('header' => Mage::helper('catalog')->__('Name'), 'index' => 'name')); $store = $this->_getStore(); if ($store->getId()) { $this->addColumn('custom_name', array('header' => Mage::helper('catalog')->__('Name in %s', $store->getName()), 'index' => 'custom_name')); } $this->addColumn('type', array('header' => Mage::helper('catalog')->__('Type'), 'width' => '60px', 'index' => 'type_id', 'type' => 'options', 'options' => Mage::getSingleton('catalog/product_type')->getOptionArray())); $sets = Mage::getResourceModel('eav/entity_attribute_set_collection')->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())->load()->toOptionHash(); $this->addColumn('set_name', array('header' => Mage::helper('catalog')->__('Attrib. Set Name'), 'width' => '100px', 'index' => 'attribute_set_id', 'type' => 'options', 'options' => $sets)); $this->addColumn('sku', array('header' => Mage::helper('catalog')->__('SKU'), 'width' => '80px', 'index' => 'sku')); $store = $this->_getStore(); $this->addColumn('price', array('header' => Mage::helper('catalog')->__('Price'), 'type' => 'price', 'currency_code' => $store->getBaseCurrency()->getCode(), 'index' => 'price')); if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $this->addColumn('qty', array('header' => Mage::helper('catalog')->__('Qty'), 'width' => '100px', 'type' => 'number', 'index' => 'qty')); } // Get the seller name by seller id $sellerCollection = Mage::getModel('customer/customer')->getCollection()->addAttributeToSelect('company_name')->addFieldToFilter('seller_subscriber', 1); //Create option array for drop down $sellerName = array(); $temp['value'] = 'entity_id'; $temp['label'] = 'company_name'; foreach ($sellerCollection as $item) { foreach ($item as $code => $field) { $sellerData[$item[$temp['value']]] = $item[$temp['label']]; } $sellerName = $sellerData; } $this->addColumn('seller_id', array('header' => Mage::helper('catalog')->__('Seller Company Name'), 'index' => 'seller_id', 'type' => 'options', 'width' => '60px', 'options' => $sellerName)); $this->addColumn('visibility', array('header' => Mage::helper('catalog')->__('Visibility'), 'width' => '70px', 'index' => 'visibility', 'type' => 'options', 'options' => Mage::getModel('catalog/product_visibility')->getOptionArray())); $this->addColumn('status', array('header' => Mage::helper('catalog')->__('Status'), 'width' => '70px', 'index' => 'status', 'type' => 'options', 'options' => Mage::getSingleton('catalog/product_status')->getOptionArray())); if (!Mage::app()->isSingleStoreMode()) { $this->addColumn('websites', array('header' => Mage::helper('catalog')->__('Websites'), 'width' => '100px', 'sortable' => false, 'index' => 'websites', 'type' => 'options', 'options' => Mage::getModel('core/website')->getCollection()->toOptionHash())); } $this->addColumn('action', array('header' => Mage::helper('catalog')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('catalog')->__('Edit'), 'url' => array('base' => '*/*/edit', 'params' => array('store' => $this->getRequest()->getParam('store'))), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores')); if (Mage::helper('catalog')->isModuleEnabled('Mage_Rss')) { $this->addRssList('rss/catalog/notifystock', Mage::helper('catalog')->__('Notify Low Stock RSS')); } return parent::_prepareColumns(); }
protected function _prepareColumns() { $this->addExportType('ampgrid/adminhtml_product/exportCsv', Mage::helper('customer')->__('CSV')); $this->addExportType('ampgrid/adminhtml_product/exportExcel', Mage::helper('customer')->__('Excel XML')); if (Mage::getStoreConfig('ampgrid/additional/thumb')) { // will add thumbnail column to be the first one $this->addColumn('thumb', array('header' => Mage::helper('catalog')->__('Thumbnail'), 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_thumb', 'index' => 'thumbnail', 'sortable' => true, 'filter' => false, 'width' => 90)); } if (Mage::getStoreConfig('ampgrid/additional/category')) { $categoryFilter = false; $categoryOptions = array(); if (Mage::getStoreConfig('ampgrid/additional/category_filter')) { $categoryFilter = 'ampgrid/adminhtml_catalog_product_grid_filter_category'; $categoryOptions = Mage::helper('ampgrid/category')->getOptionsForFilter(); } // adding categories column $this->addColumn('categories', array('header' => Mage::helper('catalog')->__('Categories'), 'index' => 'category_id', 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_category', 'sortable' => false, 'filter' => $categoryFilter, 'type' => 'options', 'options' => $categoryOptions)); } parent::_prepareColumns(); $actionsColumn = null; if (isset($this->_columns['action'])) { $actionsColumn = $this->_columns['action']; unset($this->_columns['action']); } // from version 2.4.1 $colsToRemove = Mage::getStoreConfig('ampgrid/additional/remove'); if ($colsToRemove) { $colsToRemove = explode(',', $colsToRemove); foreach ($colsToRemove as $c) { $c = trim($c); if (isset($this->_columns[$c])) { unset($this->_columns[$c]); } } } if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory') && Mage::getStoreConfig('ampgrid/additional/avail')) { $this->addColumn('is_in_stock', array('header' => Mage::helper('catalog')->__('Availability'), 'type' => 'options', 'options' => array(0 => $this->__('Out of stock'), 1 => $this->__('In stock')), 'index' => 'is_in_stock')); } if (Mage::getStoreConfig('ampgrid/additional/created_at')) { $this->addColumn('created_at', array('header' => $this->__('Creation Date'), 'index' => 'created_at', 'type' => 'date')); } if (Mage::getStoreConfig('ampgrid/additional/modified_at')) { $this->addColumn('updated_at', array('header' => $this->__('Last Modified Date'), 'index' => 'updated_at', 'type' => 'date')); } // adding special price columns if (Mage::getStoreConfig('ampgrid/additional/special_price_dates')) { $this->addColumn('special_from_date', array('header' => $this->__('Special Price From'), 'index' => 'special_from_date', 'type' => 'date')); $this->addColumn('special_to_date', array('header' => $this->__('Special Price To'), 'index' => 'special_to_date', 'type' => 'date')); } // adding cost column if ($this->_gridAttributes->getSize() > 0) { Mage::register('ampgrid_grid_attributes', $this->_gridAttributes); Mage::helper('ampgrid')->attachGridColumns($this, $this->_gridAttributes, $this->_getStore()); // foreach ($this->_gridAttributes as $attribute) // { // $props = array( // 'header'=> $attribute->getStoreLabel(), // 'index' => $attribute->getAttributeCode(), // ); // if ('price' == $attribute->getFrontendInput()) // { // $props['type'] = 'price'; // $props['currency_code'] = $this->_getStore()->getBaseCurrency()->getCode(); // } // if ('select' == $attribute->getFrontendInput() || 'multiselect' == $attribute->getFrontendInput() || 'boolean' == $attribute->getFrontendInput()) // { // $propOptions = array(); // // if ('multiselect' == $attribute->getFrontendInput()) // { // $propOptions['null'] = $this->__('- No value specified -'); // } // // if ('custom_design' == $attribute->getAttributeCode()) // { // $allOptions = $attribute->getSource()->getAllOptions(); // if (is_array($allOptions) && !empty($allOptions)) // { // foreach ($allOptions as $option) // { // if (!is_array($option['value'])) // { // if ($option['value']) // { // $propOptions[$option['value']] = $option['value']; // } // } else // { // foreach ($option['value'] as $option2) // { // if (isset($option2['value'])) // { // $propOptions[$option2['value']] = $option2['value']; // } // } // } // } // } // } else // { // // getting attribute values with translation // $valuesCollection = Mage::getResourceModel('eav/entity_attribute_option_collection') // ->setAttributeFilter($attribute->getId()) // ->setStoreFilter($this->_getStore()->getId(), false) // ->load(); // if ($valuesCollection->getSize() > 0) // { // foreach ($valuesCollection as $item) { // $propOptions[$item->getId()] = $item->getValue(); // } // } else // { // $selectOptions = $attribute->getFrontend()->getSelectOptions(); // if ($selectOptions) // { // foreach ($selectOptions as $selectOption) // { // $propOptions[$selectOption['value']] = $selectOption['label']; // } // } // } // } // // if ('multiselect' == $attribute->getFrontendInput()) // { // $props['renderer'] = 'ampgrid/adminhtml_catalog_product_grid_renderer_multiselect'; // $props['filter'] = 'ampgrid/adminhtml_catalog_product_grid_filter_multiselect'; // } // // $props['type'] = 'options'; // $props['options'] = $propOptions; // } // // $this->addColumn($attribute->getAttributeCode(), $props); // } } if ($actionsColumn) { $this->_columns['action'] = $actionsColumn; } $this->sortColumnsByDragPosition(); }
protected function _prepareColumns() { $this->addColumn('image', array('header' => Mage::helper('catalog')->__('Image'), 'align' => 'left', 'index' => 'image', 'width' => '70', 'renderer' => 'Genius_GridImage_Block_Adminhtml_Template_Grid_Renderer_Image')); return parent::_prepareColumns(); }
protected function _prepareColumns() { $this->addExportType('ampgrid/adminhtml_product/exportCsv', Mage::helper('customer')->__('CSV')); $this->addExportType('ampgrid/adminhtml_product/exportExcel', Mage::helper('customer')->__('Excel XML')); if (Mage::getStoreConfig('ampgrid/additional/thumb')) { // will add thumbnail column to be the first one $this->addColumn('thumb', array('header' => Mage::helper('catalog')->__('Thumbnail'), 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_thumb', 'index' => 'thumbnail', 'sortable' => true, 'filter' => false, 'width' => 90)); } if (Mage::helper('ampgrid')->isCategoryColumnEnabled()) { $categoryFilter = false; $categoryOptions = array(); if (Mage::getStoreConfig('ampgrid/additional/category_filter')) { $categoryFilter = 'ampgrid/adminhtml_catalog_product_grid_filter_category'; $categoryOptions = Mage::helper('ampgrid/category')->getOptionsForFilter(); } // adding categories column $this->addColumn('categories', array('header' => Mage::helper('catalog')->__('Categories'), 'index' => 'category_id', 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_category', 'sortable' => false, 'filter' => $categoryFilter, 'type' => 'options', 'options' => $categoryOptions)); } parent::_prepareColumns(); $actionsColumn = null; if (isset($this->_columns['action'])) { $actionsColumn = $this->_columns['action']; unset($this->_columns['action']); } // from version 2.4.1 $colsToRemove = Mage::getStoreConfig('ampgrid/additional/remove'); if ($colsToRemove) { $colsToRemove = explode(',', $colsToRemove); foreach ($colsToRemove as $c) { $c = trim($c); if (isset($this->_columns[$c])) { unset($this->_columns[$c]); } } } if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory') && Mage::getStoreConfig('ampgrid/additional/avail')) { $this->addColumn('is_in_stock', array('header' => Mage::helper('catalog')->__('Availability'), 'type' => 'options', 'options' => array(0 => $this->__('Out of stock'), 1 => $this->__('In stock')), 'index' => 'is_in_stock')); } if (Mage::getStoreConfig('ampgrid/additional/created_at')) { $this->addColumn('created_at', array('header' => $this->__('Creation Date'), 'index' => 'created_at', 'type' => 'date')); } if (Mage::getStoreConfig('ampgrid/additional/modified_at')) { $this->addColumn('updated_at', array('header' => $this->__('Last Modified Date'), 'index' => 'updated_at', 'type' => 'date')); } // adding special price columns if (Mage::getStoreConfig('ampgrid/additional/special_price_dates')) { $this->addColumn('special_from_date', array('header' => $this->__('Special Price From'), 'index' => 'special_from_date', 'type' => 'date')); $this->addColumn('special_to_date', array('header' => $this->__('Special Price To'), 'index' => 'special_to_date', 'type' => 'date')); } if (Mage::getStoreConfig('ampgrid/additional/related_products')) { $this->addColumn('related_products', array('header' => $this->__('Related Products'), 'index' => 'related_products', 'filter' => false, 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_related')); } if (Mage::getStoreConfig('ampgrid/additional/up_sells')) { $this->addColumn('up_sells', array('header' => $this->__('Up Sells'), 'index' => 'up_sells', 'filter' => false, 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_related')); } if (Mage::getStoreConfig('ampgrid/additional/cross_sells')) { $this->addColumn('cross_sells', array('header' => $this->__('Cross Sells'), 'index' => 'cross_sells', 'filter' => false, 'renderer' => 'ampgrid/adminhtml_catalog_product_grid_renderer_related')); } // adding cost column if ($this->_gridAttributes->getSize() > 0) { Mage::register('ampgrid_grid_attributes', $this->_gridAttributes); Mage::helper('ampgrid')->attachGridColumns($this, $this->_gridAttributes, $this->_getStore()); } if ($actionsColumn) { $this->_columns['action'] = $actionsColumn; } $this->sortColumnsByDragPosition(); }
protected function _prepareColumns() { parent::_prepareColumns(); $this->addColumn(Mage::getStoreConfig('vc_shopbybrands/general/brand'), array('header' => Mage::helper('catalog')->__(Mage::getStoreConfig('vc_shopbybrands/general/brand_title')), 'width' => '60px', 'index' => Mage::getStoreConfig('vc_shopbybrands/general/brand'), 'type' => 'options', 'options' => Mage::getSingleton('vc_shopbybrands/catalog_product_brand')->getOptionArray())); return $this; }
protected function _prepareColumns() { parent::_prepareColumns(); $this->removeColumn('action'); $this->addColumn('action', array('header' => Mage::helper('catalog')->__('Action'), 'width' => '50px', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('catalog')->__('Edit'), 'url' => array('base' => 'adminhtml/catalog_product/edit', 'params' => array('store' => $this->getRequest()->getParam('store'))), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores')); //pr(count($this->getColumns()));die(); foreach ($this->getColumns() as $l_mKey => $l_oColumn) { //pr($l_mKey); //pr(get_class($l_oColumn)); //pr(array_keys($l_oColumn->getData())); } //die(); return $this; }
protected function _prepareColumns() { parent::_prepareColumns(); $this->getColumn('qty')->setData('renderer', 'gridqty/adminhtml_catalog_product_grid_column_qty'); return $this; }