2017-12-02 222 views
0

如何將AdditionalActionBlockHtml添加到類別產品網格中的批量操作中?如何在Mgento的類別產品網格中添加創建AdditionalActionBlockHtml到批量操作?

這樣的狀態 enter image description here 我在app /設計/ adminhtml /默認/缺省的/模板/空間/格/ 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> 

回答

0

我決定通過這個加入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 
       ) 
      ) 
     )); 
    } 
} 
相關問題