This repository has been archived by the owner on Sep 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add column filter for non-English URL rewrites
- Loading branch information
Nathan Yam
authored and
Matthew Gamble
committed
May 21, 2015
1 parent
dd53c51
commit 47e708a
Showing
2 changed files
with
54 additions
and
19 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
app/code/community/BL/CustomGrid/Model/Custom/Column/Urldecoded.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php | ||
|
||
class BL_CustomGrid_Model_Custom_Column_Urldecoded extends BL_CustomGrid_Model_Custom_Column_Simple_Duplicate | ||
{ | ||
/** | ||
* Return forced grid column block values | ||
* (you can check BL_CustomGrid_Model_Custom_Column_Abstract::getBlockValues() for the priorities | ||
* of the different methods related to block values) | ||
* | ||
* @param Mage_Adminhtml_Block_Widget_Grid $gridBlock Grid block | ||
* @param BL_CustomGrid_Model_Grid $gridModel Grid model | ||
* @param string $columnBlockId Grid column block ID | ||
* @param string $columnIndex Grid column index | ||
* @param array $params Customization params values | ||
* @param Mage_Core_Model_Store $store Column store | ||
* @return array | ||
*/ | ||
public function getForcedBlockValues( | ||
Mage_Adminhtml_Block_Widget_Grid $gridBlock, | ||
BL_CustomGrid_Model_Grid $gridModel, | ||
$columnBlockId, | ||
$columnIndex, | ||
array $params, | ||
Mage_Core_Model_Store $store | ||
) { | ||
return array( | ||
'renderer' => 'customgrid/widget_grid_column_renderer_text_urldecoded', | ||
'filter_condition_callback' => array($this, 'addFilterToGridCollection'), | ||
); | ||
} | ||
|
||
/** | ||
* @param Mage_Core_Model_Resource_Url_Rewrite_Collection $collection | ||
* @param Mage_Adminhtml_Block_Widget_Grid_Column $columnBlock | ||
*/ | ||
public function addFilterToGridCollection($collection, Mage_Adminhtml_Block_Widget_Grid_Column $columnBlock) | ||
{ | ||
$filter = $columnBlock->getFilter(); | ||
$value = $filter->getValue(); | ||
$filter->setValue(urlencode($value)); | ||
$collection->addFieldToFilter($this->getDuplicatedFieldName(), $filter->getCondition()); | ||
$filter->setValue($value); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters