Magento管理员:是否可以使用datepicker字段添加批量操作?

时间:2013-09-30 16:11:12

标签: php magento datepicker admin

我正在尝试向客户网格添加批量操作以设置客户组(将模拟子组),但组分配的时间段有限。

我正在使用Magento ver。 1.4.2.0。

在客户网格定义中(在我的类中扩展了Mage_Adminhtml_Block_Customer_Grid)我正在添加这样的群发动作:

/*...*/

$this->getMassactionBlock()->addItem('set_subgroup', array(
    'label'        => Mage::helper('customersubgroup')->__('Set Customer Subgroup'),
    'url'          => $this->getUrl('adminhtml/customersubgroup/massSetSubgroup'),
    'additional'   => array(
        'subgroup'    => array(
            'name'     => 'subgroup',
            'type'     => 'select',
            'class'    => 'required-entry',
            'label'    => Mage::helper('customer')->__('Group'),
            'values'   => $subgroups
        ),
        'valid_from'    => array(
            'name'     => 'valid_from',
            'type'     => 'date',
            'class'    => 'required-entry',
            'label'    => Mage::helper('customersubgroup')->__('Valid From'),
            'gmtoffset' => true,
            'format'    => '%d.%m.%Y'
        ),
        'valid_to'    => array(
            'name'     => 'valid_to',
            'type'     => 'date',
            'class'    => 'required-entry',
            'label'    => Mage::helper('customersubgroup')->__('Valid To'),
            'gmtoffset' => true,
            'format'    => '%d.%m.%Y'
        )
    )
));

/*...*/

应该有一个客户群选择框和两个日期字段作为此群众行动的附加参数。

日期字段呈现为文本输入,但没有日期选择器功能(没有日历图标)。是否有可能以某种方式添加此功能?

提前致谢。

1 个答案:

答案 0 :(得分:2)

我现在应该把自己射向头部。我在项目定义中忘记了image属性:

/*...*/

$this->getMassactionBlock()->addItem('set_subgroup', array(
    'label'        => Mage::helper('customersubgroup')->__('Set Customer Subgroup'),
    'url'          => $this->getUrl('adminhtml/customersubgroup/massSetSubgroup'),
    'additional'   => array(
        'subgroup'    => array(
            'name'     => 'subgroup',
            'type'     => 'select',
            'class'    => 'required-entry',
            'label'    => Mage::helper('customer')->__('Group'),
            'values'   => $subgroups
        ),
        'valid_from'    => array(
            'name'     => 'valid_from',
            'type'     => 'date',
            'class'    => 'required-entry',
            'label'    => Mage::helper('customersubgroup')->__('Valid From'),
            'gmtoffset' => true,
            'image'    => '/skin/adminhtml/default/default/images/grid-cal.gif',
            'format'    => '%d.%m.%Y'
        ),
        'valid_to'    => array(
            'name'     => 'valid_to',
            'type'     => 'date',
            'class'    => 'required-entry',
            'label'    => Mage::helper('customersubgroup')->__('Valid To'),
            'gmtoffset' => true,
            'image'    => '/skin/adminhtml/default/default/images/grid-cal.gif',
            'format'    => '%d.%m.%Y'
        )
    )
));

/*...*/

所以是,可能