问题
Hi i have added a new product tab in admin grid by following the below link
http://inchoo.net/magento/how-to-add-custom-product-relations-in-magento/
Everything is working fine. BUt this has added the new tab at the last position in product edit section. Can you please suggest me how can i change the position of that tab.
thanks
回答1:
You can use the action addTabAfter
instead of addTab
, then you have to specify the <after>
parameter (categories, websites, upsell...).
I edited the code of your tutorial for example:
<reference name="product_tabs">
<action method="addTabAfter">
<name>custom</name>
<block>inchoo_customlinkedproducts/adminhtml_catalog_product_edit_tab</block>
<after>upsell</after>
</action>
</reference>
I hope this is fexible enough for you.
回答2:
after searching a lot i have not got any default solution to change the custom tab position so i have decided to go with JavaScript.
I manage to do this with the below code
in my module file i have loaded a custom JavaScript file with the below code on product edit action and product create action
<adminhtml_catalog_product_edit>
<reference name="head">
<action method="addJs">
<script>jsoveride/accesorytab.js</script>
</action>
</reference>
</adminhtml_catalog_product_edit>
<adminhtml_catalog_product_new>
<reference name="head">
<action method="addJs">
<script>jsoveride/accesorytab.js</script>
</action>
</reference>
</adminhtml_catalog_product_new>
and in the i have use the below code
document.observe("dom:loaded", function() {
document.getElementById("product_info_tabs_crosssell").appendChild(document.getElementById("product_info_tabs_custom"));
});
and it has done my work.
If anybody gets better solution please let me know.
thanks
来源:https://stackoverflow.com/questions/30521418/change-custom-product-tab-position-in-admin-grid-magento