製品管理の Magento 管理に新しいタブを追加して、ERP データを表示しました。次のファイルを追加しました。
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 が含まれています。なぜこれが起こっているのか誰にもわかりません。私が行ったすべての変更は、この投稿に記載されていることに注意してください。その他の変更は行われていません。
前もって感謝します。