简体   繁体   English

分配ID以选择框magento管理员自定义网格

[英]assign id to select box magento admin custom grid

I have custom grid on my magento admin panel where I want to add product id as a css id to every select box I have tried 'column_css_class' => 'id' but this add class to every select box with id word not its value how can i do this 我在magento管理面板上有自定义网格,我想在其中将产品ID作为CSS ID添加到我尝试过的'column_css_class' => 'id'每个选择框,但是此添加类到每个具有ID字而不是其值的选择框的方式我可以这样做吗

$this->addColumn('icon',
        array(
            'header'    => 'Icon',
            'width'     => '100px',
            'type'      => 'action',
            'getter'    => 'getId',
            'index'     => 'stores',
            'column_css_class' => 'id',
            'actions'   => array(

                array(
                    'caption' => 'Enable',
                    'url'     => array(
                    'base'=>'*/*/enable'
                    ),'field'   => 'id'
                    ),
                array(
                    'caption' => 'Disable',
                    'url'     => array(
                    'base'=>'*/*/disable'
                    ),
                    'field'     => 'id'
                )
            )
));

If you have a product object says $oProduct, You can change your code so that instead of 如果您有一个产品对象说$ oProduct,则可以更改代码,以代替

'column_css_class' => 'id'

You would have: 你将会拥有:

'column_css_class' => $oProduct->getId()

Also using product id is not a good idea, use SKU instead. 另外,使用产品ID也不是一个好主意,请改用SKU。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM