【问题标题】:How add create AdditionalActionBlockHtml into massactions in category products grid in magento?如何在magento的类别产品网格中添加create AdditionalActionBlockHtml到massactions?
【发布时间】:2017-12-02 20:47:43
【问题描述】:

如何将create AdditionalActionBlockHtml 添加到分类产品网格中的massactions 中?

喜欢这个状态 我在 app/design/adminhtml/default/default/template/widget/grid/massaction.phtml 中创建了 getAdditionalActionBlockHtml 但我不明白它是如何工作的。

        <div class="right">
        <div class="entry-edit">
            <?php if ($this->getHideFormElement() !== true):?>
            <form action="" id="<?php echo $this->getHtmlId() ?>-form" method="post">
            <?php endif ?>
                <?php echo $this->getBlockHtml('formkey')?>
                <fieldset>
                    <span class="field-row">
                        <label><?php echo $this->__('Actions') ?></label>
                        <select id="<?php echo $this->getHtmlId() ?>-select" class="required-entry select absolute-advice local-validation">
                            <option value=""></option>
                            <?php foreach($this->getItems() as $_item): ?>
                                <option value="<?php echo $_item->getId() ?>"<?php echo ($_item->getSelected() ? ' selected="selected"' : '')?>><?php echo $_item->getLabel() ?></option>
                            <?php endforeach; ?>
                        </select>
                    </span>
                    <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-hiddens"></span>
                    <span class="outer-span" id="<?php echo $this->getHtmlId() ?>-form-additional"></span>
                    <span class="field-row">
                        <?php echo $this->getApplyButtonHtml() ?>
                    </span>
                </fieldset>
            <?php if ($this->getHideFormElement() !== true):?>
            </form>
            <?php endif ?>
        </div>

        <div class="no-display">
        <?php foreach($this->getItems() as $_item): ?>
            <div id="<?php echo $this->getHtmlId() ?>-item-<?php echo $_item->getId() ?>-block">
                <?php echo $_item->getAdditionalActionBlockHtml() ?>
            </div>
        <?php endforeach; ?>
        </div>
    </div>

【问题讨论】:

    标签: magento grid product


    【解决方案1】:

    我是通过在 massactions 中添加方法来决定的

        public function addMassAction($observer)
    {
        $block = $observer->getEvent()->getBlock();
        if(get_class($block) =='Mage_Adminhtml_Block_Widget_Grid_Massaction' && $block->getRequest()->getControllerName() == 'catalog_product')
        {
            $stores = Mage::getSingleton('adminhtml/system_config_source_store')->toOptionArray();
    
            $block->addItem('export', array(
                'label' => Mage::helper("prodestransl")->__("Export"),
                'url' => Mage::helper('adminhtml')->getUrl('prod/adminhtml_export/run'),
                'additional' => array(
                    'stores' => array(
                        'name' => 'stores',
                        'type' => 'select',
                        'class' => 'required-entry',
                        'label' => Mage::helper('catalog')->__('Stores'),
                        'values' => $stores
                    )
                )
            ));
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多