本文整理汇总了PHP中Mage_Adminhtml_Block_Widget_Grid类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Widget_Grid类的具体用法?PHP Mage_Adminhtml_Block_Widget_Grid怎么用?PHP Mage_Adminhtml_Block_Widget_Grid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Adminhtml_Block_Widget_Grid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: countTotals
/**
* Retrieve count totals
*
* @param Mage_Adminhtml_Block_Widget_Grid $grid
* @param string $from
* @param string $to
* @return Varien_Object
*/
public function countTotals($grid, $from, $to)
{
$columns = array();
foreach ($grid->getColumns() as $col) {
$columns[$col->getIndex()] = array("total" => $col->getTotal(), "value" => 0);
}
$count = 0;
$report = $grid->getCollection()->getReportFull($from, $to);
foreach ($report as $item) {
if ($grid->getSubReportSize() && $count >= $grid->getSubReportSize()) {
continue;
}
$data = $item->getData();
foreach ($columns as $field => $a) {
if ($field !== '') {
$columns[$field]['value'] = $columns[$field]['value'] + (isset($data[$field]) ? $data[$field] : 0);
}
}
$count++;
}
$data = array();
foreach ($columns as $field => $a) {
if ($a['total'] == 'avg') {
if ($field !== '') {
if ($count != 0) {
$data[$field] = $a['value'] / $count;
} else {
$data[$field] = 0;
}
}
} else {
if ($a['total'] == 'sum') {
if ($field !== '') {
$data[$field] = $a['value'];
}
} else {
if (strpos($a['total'], '/') !== FALSE) {
if ($field !== '') {
$data[$field] = 0;
}
}
}
}
}
$totals = new Varien_Object();
$totals->setData($data);
return $totals;
}
示例2: _prepareCollection
/**
* Prepare related orders collection
*
* @return Mage_Adminhtml_Block_Widget_Grid
*/
protected function _prepareCollection()
{
$collection = Mage::getResourceModel('Mage_Sales_Model_Resource_Order_Grid_Collection');
$collection->addBillingAgreementsFilter(Mage::registry('current_billing_agreement')->getId());
$this->setCollection($collection);
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
}
示例3: _prepareCollection
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=1', 'left');
}
if ($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');
}
$collection->joinAttribute('seller_id', 'catalog_product/seller_id', 'entity_id', null, 'left');
$this->setCollection($collection);
Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
$this->getCollection()->addWebsiteNamesToResult();
return $this;
}
示例4: _prepareCollection
protected function _prepareCollection()
{
$role = Mage::getSingleton('aitpermissions/role');
$collection = Mage::getResourceModel('reports/quote_collection');
if (version_compare(Mage::getVersion(), '1.6.0.0', '<')) {
$collection->prepareForProductsInCarts()->setSelectCountSqlType(Mage_Reports_Model_Mysql4_Quote_Collection::SELECT_COUNT_SQL_TYPE_CART);
} else {
$collection->prepareForProductsInCarts()->setSelectCountSqlType(Mage_Reports_Model_Resource_Quote_Collection::SELECT_COUNT_SQL_TYPE_CART);
}
if ($role->isPermissionsEnabled()) {
if (!Mage::helper('aitpermissions')->isShowingAllProducts()) {
if ($role->isScopeStore()) {
$collection->getSelect()->joinLeft(array('product_cat' => Mage::getSingleton('core/resource')->getTableName('catalog_category_product')), 'product_cat.product_id = e.entity_id', array());
$collection->getSelect()->where(' product_cat.category_id in (' . join(',', $role->getAllowedCategoryIds()) . ')
or product_cat.category_id IS NULL ');
$collection->getSelect()->distinct(true);
}
if ($role->isScopeWebsite()) {
$collection->addStoreFilter($role->getAllowedStoreviewIds());
}
}
}
$this->setCollection($collection);
return Mage_Adminhtml_Block_Widget_Grid::_prepareCollection();
}
示例5: _prepareColumns
/**
* @throws Exception
*/
protected function _prepareColumns()
{
$this->addColumn('variable_id', array('header' => Mage::helper('adminhtml')->__('ID'), 'width' => 5, 'align' => 'right', 'sortable' => true, 'index' => 'variable_id'));
$this->addColumn('variable_name', array('header' => Mage::helper('adminhtml')->__('Variable'), 'index' => 'variable_name'));
$this->addColumn('is_allowed', array('header' => Mage::helper('adminhtml')->__('Status'), 'index' => 'is_allowed', 'type' => 'options', 'options' => array('1' => Mage::helper('adminhtml')->__('Allowed'), '0' => Mage::helper('adminhtml')->__('Not allowed'))));
parent::_prepareColumns();
}
示例6: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('bagpercent_id', array('header' => Mage::helper('bagpercent')->__('ID'), 'align' => 'right', 'width' => '50px', 'index' => 'bagpercent_id'));
/* $this->addColumn('title', array(
'header' => Mage::helper('combooffers')->__('Title'),
'align' =>'left',
'index' => 'title',
));*/
/*$this->addColumn('productsid', array(
'header' => Mage::helper('combooffers')->__('Products Id'),
'align' =>'left',
'index' => 'productsid',
));*/
$this->addColumn('sku', array('header' => Mage::helper('bagpercent')->__('SKU'), 'align' => 'left', 'index' => 'sku'));
/*
$this->addColumn('content', array(
'header' => Mage::helper('combooffers')->__('Item Content'),
'width' => '150px',
'index' => 'content',
));
*/
$this->addColumn('status', array('header' => Mage::helper('bagpercent')->__('Status'), 'align' => 'left', 'width' => '80px', 'index' => 'status', 'type' => 'options', 'options' => array(1 => 'Enabled', 2 => 'Disabled')));
$this->addColumn('action', array('header' => Mage::helper('bagpercent')->__('Action'), 'width' => '100', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('bagpercent')->__('Edit'), 'url' => array('base' => '*/*/edit'), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
$this->addExportType('*/*/exportCsv', Mage::helper('bagpercent')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('bagpercent')->__('XML'));
return parent::_prepareColumns();
}
示例7: _prepareColumns
/**
* Prepare Rating Grid colunms
*
* @return Mage_Adminhtml_Block_Rating_Grid
*/
protected function _prepareColumns()
{
$this->addColumn('rating_id', array('header' => Mage::helper('rating')->__('ID'), 'align' => 'right', 'width' => '50px', 'index' => 'rating_id'));
$this->addColumn('rating_code', array('header' => Mage::helper('rating')->__('Rating Name'), 'index' => 'rating_code'));
$this->addColumn('position', array('header' => Mage::helper('rating')->__('Sort Order'), 'align' => 'left', 'width' => '100px', 'index' => 'position'));
return parent::_prepareColumns();
}
示例8: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('report', array('header' => Mage::helper('reports')->__('Report'), 'index' => 'report', 'type' => 'string', 'width' => 150, 'sortable' => false));
$this->addColumn('comment', array('header' => Mage::helper('reports')->__('Description'), 'index' => 'comment', 'type' => 'string', 'sortable' => false));
$this->addColumn('updated_at', array('header' => Mage::helper('reports')->__('Updated At'), 'index' => 'updated_at', 'type' => 'datetime', 'width' => 200, 'default' => Mage::helper('reports')->__('undefined'), 'sortable' => false));
return parent::_prepareColumns();
}
示例9: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('synonym_id', array('header' => Mage::helper('searchsphinx')->__('ID'), 'align' => 'right', 'width' => '50px', 'index' => 'synonym_id'));
$this->addColumn('synonyms', array('header' => Mage::helper('searchsphinx')->__('Synonyms'), 'align' => 'left', 'index' => 'synonyms', 'renderer' => 'Mirasvit_SearchSphinx_Block_Adminhtml_Synonym_Grid_Renderer_Synonyms'));
$this->addColumn('store', array('header' => Mage::helper('searchsphinx')->__('Store'), 'align' => 'left', 'width' => '200px', 'index' => 'store', 'type' => 'options', 'options' => Mage::getSingleton('adminhtml/system_store')->getStoreOptionHash()));
return parent::_prepareColumns();
}
示例10: _prepareColumns
/**
* Preparing colums for grid
*
* @return Testimonial_Block_Adminhtml_Testimonial_Grid
*/
protected function _prepareColumns()
{
$this->addColumn('testimonial_id', array('header' => Mage::helper('testimonial')->__('ID'), 'align' => 'right', 'width' => '50px', 'index' => 'testimonial_id'));
$this->addColumn('testimonial_name', array('header' => Mage::helper('testimonial')->__('Name'), 'align' => 'left', 'width' => '100px', 'index' => 'testimonial_name'));
$this->addColumn('order_id', array('header' => Mage::helper('testimonial')->__('Order ID'), 'align' => 'left', 'width' => '100px', 'index' => 'order_id'));
$this->addColumn('testimonial_text', array('header' => Mage::helper('testimonial')->__('Comment'), 'align' => 'left', 'width' => '300px', 'index' => 'testimonial_text'));
/* $this->addColumn('testimonial_image', array(
'header' => Mage::helper('testimonial')->__('Photo'),
'align' =>'left',
'width' => '50px',
'index' => 'testimonial_image',
'renderer' => 'testimonial/adminhtml_testimonial_renderer_image'
));
*/
$this->addColumn('country', array('header' => Mage::helper('testimonial')->__('Country'), 'align' => 'left', 'width' => '50px', 'index' => 'country'));
$this->addColumn('email', array('header' => Mage::helper('testimonial')->__('Email ID'), 'align' => 'left', 'width' => '50px', 'index' => 'email'));
$this->addColumn('address', array('header' => Mage::helper('testimonial')->__('Street Address'), 'align' => 'left', 'width' => '50px', 'index' => 'address'));
$this->addColumn('created_time', array('header' => Mage::helper('testimonial')->__('Creation Time'), 'align' => 'left', 'width' => '70px', 'type' => 'date', 'default' => '--', 'index' => 'created_time'));
$this->addColumn('update_time', array('header' => Mage::helper('testimonial')->__('Update Time'), 'align' => 'left', 'width' => '70px', 'type' => 'date', 'default' => '--', 'index' => 'update_time'));
$this->addColumn('status', array('header' => Mage::helper('testimonial')->__('Status'), 'align' => 'left', 'width' => '70px', 'index' => 'status', 'type' => 'options', 'options' => array(1 => 'Enabled', 2 => 'Disabled')));
$this->addColumn('action', array('header' => Mage::helper('testimonial')->__('Action'), 'width' => '70', 'align' => 'center', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('testimonial')->__('Edit'), 'url' => array('base' => '*/*/edit'), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
$this->addExportType('*/*/exportCsv', Mage::helper('testimonial')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('testimonial')->__('XML'));
return parent::_prepareColumns();
}
示例11: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('customer_id', array('header' => Mage::helper('affiliate')->__('#'), 'align' => 'right', 'width' => '25px', 'index' => 'customer_id'));
$this->addColumn('affiliate_name', array('header' => Mage::helper('affiliate')->__('Name'), 'align' => 'left', 'index' => 'customer_id', 'width' => '250px', 'renderer' => 'affiliate/adminhtml_renderer_name', 'filter_condition_callback' => array($this, '_filterReferralnameCondition')));
$this->addColumn('referral_code', array('header' => Mage::helper('affiliate')->__('Referral Code'), 'align' => 'left', 'index' => 'referral_code', 'width' => '250px'));
$this->addColumn('affiliate_email', array('header' => Mage::helper('affiliate')->__('Email'), 'align' => 'left', 'index' => 'customer_id', 'width' => '200px', 'renderer' => 'affiliate/adminhtml_renderer_emailreferral', 'filter_condition_callback' => array($this, '_filterReferralemailCondition')));
// $this->addColumn('action',
// array(
// 'header' => Mage::helper('affiliate')->__('Action'),
// 'width' => '100',
// 'type' => 'action',
// 'getter' => 'getId',
// 'actions' => array(
// array(
// 'caption' => Mage::helper('affiliate')->__('Run Report'),
// 'url' => array('base'=> '*/*/run'),
// 'field' => 'customer_id'
// )
// ),
// 'filter' => false,
// 'sortable' => false,
// 'is_system' => true,
// ));
//
$this->addColumn('group_name', array('header' => Mage::helper('affiliate')->__('Group Name'), 'align' => 'left', 'index' => 'customer_id', 'filter' => false, 'renderer' => 'affiliate/adminhtml_renderer_affiliategroup'));
$this->addColumn('affiliate_report', array('header' => '', 'align' => 'left', 'index' => 'customer_id', 'width' => '200px', 'filter' => false, 'renderer' => 'affiliate/adminhtml_renderer_residualreport'));
//
//
// $this->addExportType('*/*/exportbinaryresidualCsv', Mage::helper('affiliate')->__('CSV'));
// $this->addExportType('*/*/exportbinaryresidualXml', Mage::helper('affiliate')->__('XML'));
//
return parent::_prepareColumns();
}
示例12: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('entity_id', array('header' => Mage::helper('customer')->__('ID'), 'width' => '50px', 'index' => 'entity_id', 'type' => 'number'));
/*$this->addColumn('firstname', array(
'header' => Mage::helper('customer')->__('First Name'),
'index' => 'firstname'
));
$this->addColumn('lastname', array(
'header' => Mage::helper('customer')->__('Last Name'),
'index' => 'lastname'
));*/
$this->addColumn('name', array('header' => Mage::helper('customer')->__('Name'), 'index' => 'name'));
$this->addColumn('email', array('header' => Mage::helper('customer')->__('Email'), 'width' => '150', 'index' => 'email'));
$groups = Mage::getResourceModel('customer/group_collection')->addFieldToFilter('customer_group_id', array('gt' => 0))->load()->toOptionHash();
$this->addColumn('group', array('header' => Mage::helper('customer')->__('Group'), 'width' => '100', 'index' => 'group_id', 'type' => 'options', 'options' => $groups));
$this->addColumn('Telephone', array('header' => Mage::helper('customer')->__('Telephone'), 'width' => '100', 'index' => 'billing_telephone'));
$this->addColumn('billing_postcode', array('header' => Mage::helper('customer')->__('ZIP'), 'width' => '90', 'index' => 'billing_postcode'));
$this->addColumn('billing_country_id', array('header' => Mage::helper('customer')->__('Country'), 'width' => '100', 'type' => 'country', 'index' => 'billing_country_id'));
$this->addColumn('billing_region', array('header' => Mage::helper('customer')->__('State/Province'), 'width' => '100', 'index' => 'billing_region'));
$this->addColumn('customer_since', array('header' => Mage::helper('customer')->__('Customer Since'), 'type' => 'datetime', 'align' => 'center', 'index' => 'created_at', 'gmtoffset' => true));
if (!Mage::app()->isSingleStoreMode()) {
$this->addColumn('website_id', array('header' => Mage::helper('customer')->__('Website'), 'align' => 'center', 'width' => '80px', 'type' => 'options', 'options' => Mage::getSingleton('adminhtml/system_store')->getWebsiteOptionHash(true), 'index' => 'website_id'));
}
$this->addColumn('action', array('header' => Mage::helper('customer')->__('Action'), 'width' => '100', 'type' => 'action', 'getter' => 'getId', 'actions' => array(array('caption' => Mage::helper('customer')->__('Edit'), 'url' => array('base' => '*/*/edit'), 'field' => 'id')), 'filter' => false, 'sortable' => false, 'index' => 'stores', 'is_system' => true));
$this->addExportType('*/*/exportCsv', Mage::helper('customer')->__('CSV'));
$this->addExportType('*/*/exportXml', Mage::helper('customer')->__('Excel XML'));
return parent::_prepareColumns();
}
示例13: _prepareColumns
/**
* Prepare grid colunms
*
* @return Mage_GoogleShopping_Block_Adminhtml_Types_Grid
*/
protected function _prepareColumns()
{
$this->addColumn('attribute_set_name', array('header' => $this->__('Attributes Set'), 'index' => 'attribute_set_name'));
$this->addColumn('target_country', array('header' => $this->__('Target Country'), 'width' => '150px', 'index' => 'target_country', 'renderer' => 'Mage_GoogleShopping_Block_Adminhtml_Types_Renderer_Country', 'filter' => false));
$this->addColumn('items_total', array('header' => Mage::helper('Mage_Catalog_Helper_Data')->__('Total Qty Content Items'), 'width' => '150px', 'index' => 'items_total', 'filter' => false));
return parent::_prepareColumns();
}
示例14: _prepareColumns
protected function _prepareColumns()
{
$this->addColumn('thumbnail', array('renderer' => 'orderapproval/customercart_edit_grid_column_renderer_image', 'width' => '80', 'align' => 'center', 'index' => 'item', 'sortable' => false));
$this->addColumn('product-name', array('header' => $this->__('Product Name'), 'renderer' => 'orderapproval/customercart_edit_grid_column_renderer_productoptions', 'align' => 'left', 'index' => 'item', 'sortable' => false));
$this->addColumn('price', array('header' => $this->__('Price'), 'renderer' => 'orderapproval/customercart_edit_grid_column_renderer_price', 'width' => '60', 'align' => 'right', 'index' => 'item', 'sortable' => false));
$this->addColumn('qty', array('header' => $this->__('Qty'), 'renderer' => 'orderapproval/customercart_edit_grid_column_renderer_qty', 'width' => '40', 'align' => 'center', 'index' => 'item', 'sortable' => false));
$this->addColumn('subtotal', array('header' => $this->__('Total Price'), 'renderer' => 'orderapproval/customercart_edit_grid_column_renderer_subtotal', 'width' => '60', 'align' => 'right', 'index' => 'item', 'sortable' => false));
/* $this->addColumn('approve_item', array(
'header' => $this->__('Action'),
'width' => '60',
'align' => 'center',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => $this->__('Approve'),
'url' => array(
'base' => 'updateApprovalState',
'params' => array(
'state' => ZetaPrints_OrderApproval_Helper_Data::APPROVED)),
'field' => 'item' ),
array(
'caption' => $this->__('Decline'),
'url' => array(
'base' => 'updateApprovalState',
'params' => array(
'state' => ZetaPrints_OrderApproval_Helper_Data::DECLINED)),
'field' => 'item' ),
),
'filter' => false,
'sortable' => false,
));
* */
return parent::_prepareColumns();
}
示例15: _prepareColumns
protected function _prepareColumns()
{
$helper = Mage::helper('adyen_subscription');
$this->addColumn('entity_id', ['header' => $helper->__('ID'), 'align' => 'right', 'width' => 1, 'index' => 'entity_id', 'filter_index' => 'main_table.entity_id']);
$this->addColumn('increment_id', ['header' => $helper->__('Increment ID'), 'align' => 'right', 'width' => 1, 'index' => 'increment_id', 'filter_index' => 'main_table.increment_id']);
$this->addColumn('error_message', ['header' => $helper->__('Error Message'), 'index' => 'error_message']);
if (!Mage::getStoreConfig(Mage_Customer_Model_Customer::XML_PATH_GENERATE_HUMAN_FRIENDLY_ID)) {
$this->addColumn('customer_id', ['header' => $helper->__('Customer ID'), 'index' => 'customer_id']);
} else {
$this->addColumn('customer_increment_id', ['header' => $helper->__('Customer Inc.'), 'index' => 'customer_increment_id', 'filter_condition_callback' => array($this, '_customCustomerIncrementIdSort')]);
}
$this->addColumn('customer_email', ['header' => $helper->__('Customer Email'), 'index' => 'customer_email', 'filter_index' => 'ce.email']);
$this->addColumn('customer_name', ['header' => $helper->__('Name'), 'index' => 'customer_name']);
$this->addColumn('ba_method_code', ['type' => 'options', 'header' => $helper->__('Payment method'), 'index' => 'ba_method_code', 'options' => Mage::helper('payment')->getAllBillingAgreementMethods(), 'filter_index' => 'ba.method_code']);
$this->addColumn('ba_reference_id', ['header' => $helper->__('Billing Agreement'), 'index' => 'ba_reference_id', 'filter_index' => 'ba.reference_id']);
$this->addColumn('created_at', ['header' => $helper->__('Created at'), 'index' => 'created_at', 'filter_index' => 'main_table.created_at', 'type' => 'datetime']);
// $this->addColumn('ends_at', [
// 'header' => $helper->__('Ends at'),
// 'index' => 'ends_at',
// 'type' => 'datetime'
// ]);
//
// $this->addColumn('next_order_at', [
// 'header' => $helper->__('Next shipment'),
// 'index' => 'next_order_at',
// 'type' => 'datetime'
// ]);
$this->addColumn('status', ['header' => $helper->__('Status'), 'index' => 'status', 'type' => 'options', 'options' => Adyen_Subscription_Model_Subscription::getStatuses(), 'renderer' => 'Adyen_Subscription_Block_Adminhtml_Subscription_Renderer_Status', 'filter_index' => 'main_table.status']);
$this->addColumn('action', ['header' => $helper->__('Actions'), 'width' => '1', 'type' => 'action', 'getter' => 'getId', 'actions' => [['caption' => $helper->__('View'), 'url' => ['base' => '*/subscription/view', 'params' => ['store' => $this->getRequest()->getParam('store')]], 'field' => 'id']], 'filter' => false, 'sortable' => false]);
return parent::_prepareColumns();
}