2012-02-29 2 views
1

製品管理のMagento管理者に新しいタブを追加してERPデータを表示しました。以下のファイルを追加しました:Magento - 追加タブは閉じるulとdivを含むオプションメニューを提供

class Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Erp extends Mage_Adminhtml_Block_Widget 
{ 
    public function __construct() 
    { 
     parent::__construct(); 
     $this->setProduct($this->getProduct()); 
     $this->setTemplate('Purchase/Product/Edit/Tab/SupplyNeedsSummary.phtml'); 
    } 

    /** 
    * Return current product instance 
    * 
    * @return Mage_Catalog_Model_Product 
    */ 

    public function getProduct() 
    { 
     return Mage::registry('product'); 
    } 
} 

と...

class MDN_AdvancedStock_Block_Adminhtml_Catalog_Product_Edit_Tab_Erp extends Mage_Adminhtml_Block_Catalog_Product_Edit_Tab_Erp { 

    protected function _toHtml() { 
      return parent::_toHtml(); 
    } 

} 

私は、ファイルMage_Adminhtml_Block_Catalog_Product_Edit_Tabsを編集し、(周りのライン#85)に追加:

$this->addTab('erp', array(
    'label'  => Mage::helper('catalog')->__('ERP Samenvatting'), 
    'content' => $this->getLayout()->createBlock('adminhtml/catalog_product_edit_tab_erp')->toHtml(), 
    )); 

それはすべてが正常に動作し、データ表示されます。しかし、何らかの理由でタブメニューのHTMLが不正になりました。あなたが見ることができるように

<li> 

     <a class="tab-item-link" title="Voorraad" name="inventory" id="product_info_tabs_inventory" href="#"> 
      <span><span title="The information in this tab has been changed." class="changed"/><span title="This tab contains invalid data. Please solve the problem before saving." class="error"/>Voorraad</span> 
     </a> 

    </li> 
    <li> 
     <a class="tab-item-link active" title="ERP Samenvatting" name="erp" id="product_info_tabs_erp" href="#"> 
      <span><span title="The information in this tab has been changed." class="changed"/><span title="This tab contains invalid data. Please solve the problem before saving." class="error"/>ERP Samenvatting</span> 

     </a> 
     </li></ul></div> 

    <li> 
     <a class="tab-item-link ajax notloaded" title="Categorieën" name="categories" id="product_info_tabs_categories" href="http://www.sicomputers.nl/index.php/login/catalog_product/categories/id/23532/key/3fd54077f0c85aa69c3383ccb4f0e7cb/"> 
      <span><span title="The information in this tab has been changed." class="changed"/><span title="This tab contains invalid data. Please solve the problem before saving." class="error"/>Categorieën</span> 
     </a> 
     <div style="display: none;" id="product_info_tabs_categories_content"/> 
    </li> 

、ERPオプションで、閉じULおよびDIVが何らかの理由で含まれています:私は、ソースコードに見ると、これは私が見たものです。誰もがこれが起こっている理由を知っていますか?私が作ったすべての変更がこの記事に記載されていることに注意してください。それ以外の変更はありません。

ありがとうございます。

答えて

0

コアファイルを編集しないでください。新しいタブを追加するには、レイアウトの更新を使用する必要があります。バンドル製品の仕組みを確認してください:

<adminhtml_catalog_product_bundle> 
    <reference name="product_tabs"> 
     <action method="addTab"><name>bundle_items</name><block>bundle/adminhtml_catalog_product_edit_tab_bundle</block></action> 
     <action method="bindShadowTabs"><first>bundle_items</first><second>customer_options</second></action> 
    </reference> 
</adminhtml_catalog_product_bundle> 
関連する問題