Magento Admin has a store select drop down list of all the stores. I have added an addititional "SELECT ALL STORES" value to allow me to know when a user wishes to carry out a task on all stores.
I based this customisation on enterprise magento version 1.9 although I think the version is quite irrelevant since my question is quite generic to开发者_Python百科 magento I think.
How do I stop my "SELECT ALL STORES" from being selected by default in the search ?
/index.php/admin/admin/urlrewrite/index
The store list select form is built here:
app\code\core\Adminhtml\Block\Widget\Grid\Column\Filter\Store.php
Once I found that, I could override it to the local code pool and make the modifications I needed.
public function getHtml()
{
$storeModel = Mage::getSingleton('adminhtml/system_store');
/* @var $storeModel Mage_Adminhtml_Model_System_Store */
$websiteCollection = $storeModel->getWebsiteCollection();
$groupCollection = $storeModel->getGroupCollection();
$storeCollection = $storeModel->getStoreCollection();
$allShow = $this->getColumn()->getStoreAll();
$html = '<select name="' . $this->_getHtmlName() . '" ' . $this->getColumn()->getValidateClass() . '>';
$value = $this->getColumn()->getValue();
//if ($allShow) {
$html .= '<option value=""' . (**$value == 0** ? ' selected="selected"' : '') . '>' . Mage::helper('adminhtml')->__('All Store Views') . '</option>';
//} else {
// $html .= '<option value=""' . (!$value ? ' selected="selected"' : '') . '></option>';
//}
精彩评论