Magento backend listview pricerules - magento

I have 300+ shopping cart price rules. I need to solve a problem that has to do with continue following rules . I would like in the overview in the backend add the column " stop rules Further processing". Where/how should I do that?

You need to rewrite the method
Mage_Adminhtml_Block_Promo_Quote_Grid::_prepareColumns()
In your new method you need to add something like this:
$this->addColumn('stop_rules_processing', array(
'header' => Mage::helper('salesrule')->__('Stop Rule'),
'align' => 'left',
'width' => '150px',
'index' => 'stop_rules_processing',
));
Don't forget, that magento strongly do not recommend to edit core files.

Related

Magento - Sales > Order 'Processing' status

Good morning,
We are currently using Magento and trying to list 'Processing' orders as default. We have located the status dropdown column but can't figure out how to set 'Processing' as default.
We would love some help on this,
Thank you.
$this->addColumn('status', array(
'header' => Mage::helper('sales')->__('Status'),
'index' => 'status',
'type' => 'options',
'width' => '70px',
'options' => Mage::getSingleton('sales/order_config')->getStatuses(),
));
A little help from Amit Bera we managed to figure this out.
Open - app/code/core/Mage/Adminhtml/Block/Sales/Order/Grid.php
Find - parent::__construct(); and add underneath $this->setDefaultFilter(array('status'=>'processing'));
Worked like a charm.

Change Customer to Company on Magento Administrator Dashboard

On the Magento administrator Dashboard I'm looking to update the 'Last 5 Orders' block so that instead of displaying the customer name, it shows the company billing name instead.
My understanding is that this can't be done using the standard reports collection, I've seen examples for doing this on the main sales grid screen, but not on the dashboard. To add further complexity this is for the latest version of Magento 1.6.1.0 and it appears the method of doing this may have changed somewhere around 1.4.
The file I believe needs editing is:
app/code/core/Mage/Adminhtml/Block/Dashboard/Orders/Grid.php
Hopefully this is one of those 'easy when you know how' solutions that lots of people can benefit from.
Here is the code
PS : I haven't got time to test this code block.
The code block available in the :
app\code\core\Mage\Adminhtml\Block\Dashboard\Tab\Customers\Most.php
protected function _prepareColumns()
{
$this->addColumn('name', array(
'header' => $this->__('Customer Name'),
'sortable' => false,
'index' => 'name'
));
$this->addColumn('orders_count', array(
'header' => $this->__('Number of Orders'),
'sortable' => false,
'index' => 'orders_count',
'type' => 'number'
));
and here is the sample link that you can override the magento admin sales grid
Override Admin Sales Order Search Grid

How to show Sum of Two fields in Grid in Magento Admin Panel

I am working on a extension in which user enter different price for " Stamp Cost, Ink Cost,
Form Cost ". currently in data grid i am showing value of one field
$this->addColumn('stamp_cost', array(
'header' => Mage::helper('imprint')->__('Stamp Cost'),
'width' => '100px',
'type' => 'price',
'currency_code' => $store->getBaseCurrency()->getCode(),
'index' => 'stamp_cost'
));
But Now I Need to show sum of all these fields in one column
How can we show sum of two fields in one column in magento admin data grid ?
Essentially, there are two ways to do it. Add the field to the collection and get the data from the database, or calculate it in PHP based on the 3 values returned from the DB. Doing the first way with the Magento Collection would, in my opinion, be too complex. instead, you want to use a Renderer (Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract)
First, inside of the Block/Adminhtml folder of your plugin, make a new folder called Renderer. Inside of it make a new file called CostSum.php with the following contents:
<?php
class Company_Module_Block_Adminhtml_Renderer_CostSum extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
return $row->getStampCost() + $row->getInkCost() + $row->getFormCost();
}
}
Then, in the grid, make a new column
$this->addColumn('cost_total', array(
'header' => Mage::helper('imprint')->__('Stamp Cost'),
//'index' => 'Im not sure this is necessary',
'type' => 'price',
'currency_code' => $store->getBaseCurrency()->getCode(),
'renderer' => new Company_Module_Block_Adminhtml_Renderer_CostSum()
));
Hope that helps!
The more right way is 'renderer' => 'company_module/adminhtml_renderer_costSum'
As #Zyava says, the correct option is this. But actually, is not 'company_module'. Instead you should call it as you have declared your blocks in the config.xml file.
<blocks>
<declaration>
<class>Company_Module_Block</class>
</declaration>
</blocks>
So, in this case you should create the 'renderer' as:
'renderer' => 'declaration/adminhtml_renderer_costSum'

Adding Stock Status column to Manage Product Admin Page

I'm trying to add 'stock status' column to the Admin Manage Product Grid.
Stock status is either "In Stock" or "Out of Stock".
Seems like I need to edit Adminhtml/Block/Catalog/Product/Grid.php 's _prepareColumns().
I added this line
$this->addColumn('stock',
array(
'header'=> Mage::helper('catalog')->__('Stock Avail.'),
'width' => '70px',
'index' => 'status',
'type' => 'options',
'options' => Mage::getSingleton('cataloginventory/source_stock')->toOptionArray()
which just prints out Array,Array.
I'm guessing it's just printing out the type, so I would need to access the array value to get options. Am I on the right path? I can't find any good coding docs for magento, if anyone can share with me how they figured out magento, that would be really nice.
You should use a renderer: in the array of the addColumn, add:
'renderer' => 'YourNamespace_YourModule_Path_To_Renderer_File',
And the renderer file would be something like:
class YourNamespace_YourModule_Path_To_Renderer_File extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
public function render(Varien_Object $row)
{
//let's see what you have to work with
Zend_Debug::dump($row->getData(), 'debug');
$stockStatus = $row->getSomething();
return $stockStatus;
}
}
Let me know if that ain't clear

Getting disabled checkboxes in Grid for a custom admin module in Magento

I am working on a custom module in magento admin that uses the ‘sales/order_grid_collection’ class to show the grid of all orders. The grid appears fine.
However, the first column of the grid is of ‘increment_id’, unlike the actual orders grid where the first column has checkboxes for mass action. I am getting this in spite having copy-pasted almost all the code for the _prepareColumns method from the original order module.
So I tried adding a first column of checkboxes manually inside the _prepareColumns method as follows
$this->addColumn('order_id', array(
'header_css_class' => 'a-center',
'header' => Mage::helper('sales')->__('Assigned'),
'type' => 'checkbox',
'width' => '20px',
'field_name' => 'orders[]',
'align' => 'center',
'renderer' => new Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Checkbox(),
'index' => 'order_id'
));
Upon doing this, the chekboxes do appear but they are disabled.
What am I missing here ?
Thanks
What shows up the checkboxes for mass action is the _prepareMassaction() method (see for example Mage_Adminhtml_Block_Sales_Order_Grid line 151-199 on v1.5), do you copy-pasted also in your Namespace_Module_Block_Adminhtml_Yourpath_Grid class?
If so, please paste it here to see if there is something wrong about it

Resources