本文整理汇总了PHP中Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection方法的具体用法?PHP Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection怎么用?PHP Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Adminhtml_Block_Widget_Grid
的用法示例。
在下文中一共展示了Mage_Adminhtml_Block_Widget_Grid::_addColumnFilterToCollection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getId() == 'zip') {
$value = $column->getFilter()->getValue();
if (!is_numeric($value)) {
$state = addslashes(strtoupper(substr($value, -2)));
$city = addslashes(substr_replace($value, "", -4));
$zipArr = Mage::getModel('urls/cities')->getCityZips($city, $state);
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
$this->getCollection()->addAttributeToFilter($field, array('in' => $zipArr));
return $this;
}
}
// Set custom filter for in category flag
if ($column->getId() == 'in_category') {
$productIds = $this->_getSelectedProducts();
if (empty($productIds)) {
$productIds = 0;
}
if ($column->getFilter()->getValue()) {
$this->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
} elseif (!empty($productIds)) {
$this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
}
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例2: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
// Set custom filter for in product flag
if ($column->getId() == 'in_products') {
$productIds = $this->_getSelectedProducts();
if (empty($productIds)) {
$productIds = 0;
}
$createdProducts = $this->_getCreatedProducts();
$existsProducts = $productIds;
// Only for "Yes" Filter we will add created products
if (count($createdProducts) > 0) {
if (!is_array($existsProducts)) {
$existsProducts = $createdProducts;
} else {
$existsProducts = array_merge($createdProducts);
}
}
if ($column->getFilter()->getValue()) {
$this->getCollection()->addFieldToFilter('entity_id', array('in' => $existsProducts));
} else {
if ($productIds) {
$this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
}
}
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例3: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
$filterArr = Mage::registry('preparedFilter');
if (($column->getId() === 'store_id' || $column->getId() === 'status') && $column->getFilter()->getValue() && strpos($column->getFilter()->getValue(), ',')) {
$_inNin = explode(',', $column->getFilter()->getValue());
$inNin = array();
foreach ($_inNin as $k => $v) {
if (is_string($v) && strlen(trim($v))) {
$inNin[] = trim($v);
}
}
if (count($inNin) > 1 && in_array($inNin[0], array('in', 'nin'))) {
$in = $inNin[0];
$values = array_slice($inNin, 1);
$this->getCollection()->addFieldToFilter($column->getId(), array($in => $values));
} else {
parent::_addColumnFilterToCollection($column);
}
} elseif (is_array($filterArr) && array_key_exists($column->getId(), $filterArr) && isset($filterArr[$column->getId()])) {
$this->getCollection()->addFieldToFilter($column->getId(), $filterArr[$column->getId()]);
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例4: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($this->getCollection()) {
if ($column->getId() == 'websites') {
$this->getCollection()->joinField('websites', 'catalog/product_website', 'website_id', 'product_id=entity_id', null, 'left');
}
}
// Set custom filter for in product flag
if ($column->getId() == 'in_products') {
$productIds = $this->_getSelectedProducts();
if (empty($productIds)) {
$productIds = 0;
}
if ($column->getFilter()->getValue()) {
$this->getCollection()->addFieldToFilter('entity_id', array('in' => $productIds));
} else {
if ($productIds) {
$this->getCollection()->addFieldToFilter('entity_id', array('nin' => $productIds));
}
}
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例5: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getIndex() == 'stores') {
$this->getCollection()->addStoreFilter($column->getFilter()->getCondition(), false);
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例6: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getIndex() == 'popularity') {
$this->getCollection()->addPopularityFilter($column->getFilter()->getCondition());
return $this;
} else {
return parent::_addColumnFilterToCollection($column);
}
}
示例7: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($this->getCollection()) {
if ($column->getId() == 'websites') {
$this->getCollection()->joinField('websites', 'catalog/product_website', 'website_id', 'product_id=entity_id', null, 'left');
}
}
return parent::_addColumnFilterToCollection($column);
}
示例8: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($this->getCollection()) {
if ($column->getId() == 'name') {
$this->getCollection()->getSelect()->join(array('cpev' => 'catalog_product_entity_varchar'), 'cpev.entity_id = main_table.product_id', array('product_name' => 'value'))->join(array('ea' => 'eav_attribute'), ' cpev.attribute_id = ea.attribute_id')->join(array('eet' => 'eav_entity_type'), 'eet.entity_type_id = ea.entity_type_id')->where('ea.attribute_code = ?', 'name')->where('eet.entity_type_code = ?', 'catalog_product');
}
}
return parent::_addColumnFilterToCollection($column);
}
示例9: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getId() == 'serial_codes' && $column->getFilter()->getValue() == '*') {
$this->getCollection()->addFieldToFilter($column->getId(), array('notnull' => true))->addFieldToFilter($column->getId(), array('neq' => ''));
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例10: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getId() == 'sku' && $column->getFilter()->getValue()) {
$this->getCollection()->addFieldToFilter($column->getId(), $column->getFilter()->getValue());
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例11: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
$field = $column->getFilterIndex() ? $column->getFilterIndex() : $column->getIndex();
$skip = array('subtotal', 'customer_name', 'email');
if (in_array($field, $skip)) {
return $this;
}
parent::_addColumnFilterToCollection($column);
return $this;
}
示例12: _addColumnFilterToCollection
/**
* Filter number of customers column
*
* @param Mage_Adminhtml_Block_Widget_Grid_Column $column
* @return Enterprise_CustomerSegment_Block_Adminhtml_Report_Customer_Segment_Grid
*/
protected function _addColumnFilterToCollection($column)
{
if ($column->getId() == 'customer_count') {
if ($column->getFilter()->getValue() !== null) {
$this->getCollection()->addCustomerCountFilter($column->getFilter()->getValue());
}
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例13: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getId() == 'in_products') {
$value = $column->getFilter()->getValue();
if ($value == 1) {
$this->getCollection()->addFieldToFilter('alsoviewed_relation', array('notnull' => true));
} elseif ($value == 0) {
$this->getCollection()->addFieldToFilter('alsoviewed_relation', array('null' => true));
}
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}
示例14: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($this->getCollection()) {
if ($column->getId() == 'websites') {
$this->getCollection()->joinField('websites', 'catalog/product_website', 'website_id', 'product_id=entity_id', null, 'left');
}
if ($column->getId() == 'ml_published') {
$this->getCollection()->joinField('published', 'mercadolivre/product', 'published', 'product_id=entity_id', null, 'left');
}
if ($column->getId() == 'ml_type') {
$this->getCollection()->joinField('type', 'mercadolivre/product', 'type', 'product_id=entity_id', null, 'left');
}
}
return parent::_addColumnFilterToCollection($column);
}
示例15: _addColumnFilterToCollection
protected function _addColumnFilterToCollection($column)
{
if ($column->getId() == 'ajax_grid_in_category') {
$collection = $this->getCollection();
$selectedNews = $this->getSelectedNews();
if ($column->getFilter()->getValue()) {
$collection->addFieldToFilter('news_id', array('in' => $selectedNews));
} elseif (!empty($selectedNews)) {
$collection->addFieldToFilter('news_id', array('nin' => $selectedNews));
}
} else {
parent::_addColumnFilterToCollection($column);
}
return $this;
}