protected function _construct() { parent::_construct(); if (Mage::helper('core')->isModuleEnabled('SM_Easyproduct') && Mage::helper('smvendors')->getVendorLogin()) { $this->_editUrl = 'easyproduct/adminhtml_product/edit'; } }
protected function _prepareCollection() { $store = $this->_getStore(); $collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToSelect('sku')->addAttributeToSelect('name')->addAttributeToSelect('attribute_set_id')->addAttributeToSelect('type_id'); if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $collection->joinField('qty', 'cataloginventory/stock_item', 'qty', 'product_id=entity_id', '{{table}}.stock_id=' . $store->getId(), 'left'); } if ($store->getId()) { //$collection->setStoreId($store->getId()); $adminStore = Mage_Core_Model_App::ADMIN_STORE_ID; $collection->addStoreFilter($store); $collection->joinAttribute('name', 'catalog_product/name', 'entity_id', null, 'inner', $adminStore); $collection->joinAttribute('custom_name', 'catalog_product/name', 'entity_id', null, 'inner', $store->getId()); $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $store->getId()); $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner', $store->getId()); $collection->joinAttribute('price', 'catalog_product/price', 'entity_id', null, 'left', $store->getId()); } else { $collection->addAttributeToSelect('price'); $collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner'); $collection->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner'); } $this->setCollection($collection); parent::_prepareCollection(); $this->getCollection()->addWebsiteNamesToResult(); return $this; }
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(); }
protected function _prepareMassaction() { parent::_prepareMassaction(); if (Mage::helper('barcode')->isEnable()) { $this->getMassactionBlock()->addItem('printbarcode', array('label' => Mage::helper('catalog')->__('Print Barcode'), 'url' => $this->getUrl('adminhtml/barcode_product/index', array('_current' => true)))); } return $this; }
public function getRowUrl($row) { if (Mage::getStoreConfig('vc_easyupdateproductinfor/general/enable') == 1) { return false; } else { return parent::getRowUrl($row); } }
/** * 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; }
public function __construct() { parent::__construct(); $this->setId('productGrid'); $this->setDefaultSort('entity_id'); $this->setDefaultDir('desc'); $this->setSaveParametersInSession(true); $this->setUseAjax(true); }
/** * Mass actions for the product-linking. */ protected function _prepareMassaction() { parent::_prepareMassaction(); if (!Mage::helper('twowaylink')->isEnabled()) { return; } $this->getMassactionBlock()->addItem('union-link', array('label' => Mage::helper('catalog')->__('Related Union-Link'), 'url' => $this->getUrl('*/*/massUnionRelatedLink'))); $this->getMassactionBlock()->addItem('join-link', array('label' => Mage::helper('catalog')->__('Related Join-Link'), 'url' => $this->getUrl('*/*/massJoinRelatedLink'))); return $this; }
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); } } }
/** * set collection object * * @param Varien_Data_Collection $collection */ public function setCollection($collection) { if (Mage::helper('catalog')->isModuleEnabled('Mage_CatalogInventory')) { $select = $collection->getSelect(); $fromParts = $select->getPart(Zend_Db_Select::FROM); if (isset($fromParts['at_qty'])) { unset($fromParts['at_qty']); $select->reset(Zend_Db_Select::FROM); $select->setPart(Zend_Db_Select::FROM, $fromParts); $subquery = $collection->getConnection()->select()->from(array('at_sub_qty' => $collection->getResource()->getTable('cataloginventory/stock_item')), array('product_id'))->columns(new Zend_Db_Expr("SUM(at_sub_qty.qty) AS qty"))->group('at_sub_qty.product_id'); $select->joinLeft(array('at_qty' => $subquery), 'at_qty.product_id=e.entity_id', array()); } } parent::setCollection($collection); }
protected function _prepareMassaction() { parent::_prepareMassaction(); /** @var $collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection */ /*$collection = Mage::getModel('catalog/product')->getCollection() ->addAttributeToSelect('sku') ->addAttributeToSelect('name') ->addAttributeToFilter('has_options', array('eq'=>'1'), 'left') ->load(); $options = $this->toOptionArray($collection, 'entity_id'); array_unshift($options, array('value' => 0, 'label' => $this->__('Select source product'))); */ $massAction = $this->getMassactionBlock(); $help = '<div id=\\"zpoptions_help\\" style=\\"display:none;position:absolute;min-width:320px;top:-120px;left:-150px;background:#fff\\">'; $help .= '<ol style=\\"list-style:decimal inside; border:1px solid #EA7601;padding:3px 5px;\\">'; $help .= '<li>' . $this->__('Find the ID of product you would like to use as source.') . '</li>'; $help .= '<li>' . $this->__('Select products you would like to copy options to.') . '</li>'; $help .= '<li>' . $this->__('Choose \'Copy Custom Options\' from drop down.') . '</li>'; $help .= '<li>' . $this->__('Type/paste source product ID in text box and click \'Submit\'.') . '</li>'; $help .= '</ol>'; $help .= '<span style=\\"font-weight:bold;\\">' . $this->__('Click help link again to close this help.') . '</span>'; $help .= '</div>'; $script = '<script type="text/javascript"> $("src_product_note").observe("click", function(e){ Event.stop(e); var help = $("zpoptions_help"); if(help){ help.toggle(); }else { var helpContent = "' . $help . '"; $(this.parentNode).makePositioned().insert(helpContent); $("zpoptions_help").show(); } }); </script>'; $massAction->addItem('zpoptions', array('label' => Mage::helper('catalog')->__('Copy Custom Options'), 'url' => $this->getUrl('*/zp-options/masscopy', array('_current' => true)), 'additional' => array('src_product_id' => array('name' => 'source', 'type' => 'text', 'class' => 'required-entry', 'label' => Mage::helper('catalog')->__('Source Product ID')), 'src_product_note' => array('after_element_html' => $script, 'type' => 'link', 'value' => 'What is source product ID?', 'href' => '#')))); $massAction->getParentBlock(); }
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() { $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() { 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; }
public function __construct() { parent::__construct(); $this->setRowClickCallback('review.gridRowClick'); $this->setUseAjax(true); }
protected function _prepareMassaction() { parent::_prepareMassaction(); $statuses = Mage::getSingleton('catalog/product_status')->getOptionArray(); $this->getMassactionBlock()->addItem('statusandstate', array('label' => Mage::helper('catalog')->__('Change status and state'), 'url' => $this->getUrl('*/*/massStatusandstate', array('_current' => true)), 'additional' => array('visibility' => array('name' => 'statusandstate', 'type' => 'select', 'class' => 'required-entry', 'label' => Mage::helper('catalog')->__('Status and state'), 'values' => $statuses)))); return $this; }
protected function addCustomColumns(Mage_Adminhtml_Block_Catalog_Product_Grid $grid) { $store = Mage::app()->getStore((int) $grid->getRequest()->getParam('store', 0)); $grid->addColumnAfter('updated_at', array('header' => Mage::helper('magelog_grid')->__('Updated at'), 'width' => '150px', 'type' => 'datetime', 'index' => 'updated_at'), 'name'); }
protected function _prepareMassaction() { parent::_prepareMassaction(); Mage::dispatchEvent('am_product_grid_massaction', array('grid' => $this)); }
public function __construct() { parent::__construct(); $this->setUseAjax(false); }
protected function _prepareMassaction() { parent::_prepareMassaction(); Mage::dispatchEvent('adminhtml_catalog_product_grid_setup_export', array('block' => $this)); return $this; }
public function __construct() { parent::__construct(); $this->setRowClickCallback('productquestions.gridRowClick'); $this->setUseAjax(true); }
protected function _prepareColumns() { parent::_prepareColumns(); $this->getColumn('qty')->setData('renderer', 'gridqty/adminhtml_catalog_product_grid_column_qty'); return $this; }