[英]Magento custom attribute filter
I am a Magento developer. 我是Magento开发人员。 In my project I have added a custom attribute 'featured_product' to the table catalog_product, so that when clicking on any product from catalog/manage product , there will be an option for making the current product as a 'featured product'.
在我的项目中,我向表catalog_product添加了一个自定义属性'featured_product',因此,当单击catalog / manage product中的任何产品时,将有一个将当前产品作为“ featured product”的选项。 Those featured products are displayed on the front end.
这些特色产品显示在前端。 Now in the product management grid, I want to develop a filter in terms of this 'featured product'.
现在,在产品管理网格中,我想针对此“精选产品”开发一个过滤器。 ie, There will be a check box or select box, and when we select 'featured product' from the select box and click on search, it will display all the featured products.
即,将有一个复选框或选择框,当我们从选择框中选择“特色产品”并单击搜索时,它将显示所有特色产品。 How can I achieve this?
我该如何实现?
You have to override product grid in admin and add the column featured_product there. 您必须在admin中覆盖产品网格,然后在其中添加一列featured_product。 In that column you can sort all featured products.
在该列中,您可以对所有特色产品进行排序。
add to method _prepareColumns next code like this 将这样的下一个代码添加到方法_prepareColumns中
$this->addColumn('featured_product', array( 'header'=> Mage::helper('your_modile')->__('Featured Product'), 'width' => '60px', 'index' => 'featured_product', 'type' => 'options', 'options' => array('1' => 'Yes', '0' => 'No'), ));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.