Magento extratab im backend
Anzeigen eines extra Tabs unter Kunden bearbeiten
Testprices
Struktur
/app/etc/modules/ 1) Anc_Testprices.xml /app/code/local/Anc/testprices/ 2) Block/Adminhtml/Customer/Edit/Tab/Action.php 3) etc/config.xml /app/design/adminhtml/default/default/ 4) layout/anc/testprices.xml 5) template/anc/testprices/action.phtml
1) Anc_Testprices.xml
<?xml version="1.0"?>
<config>
<modules>
<Anc_Testprices>
<active>true</active>
<codePool>local</codePool>
</Anc_Testprices>
</modules>
</config>
2) Action.php
<?php
/**
* Adminhtml Kunden Tab
*
*/
class Anc_Testprices_Block_Adminhtml_Customer_Edit_Tab_Action
extends Mage_Adminhtml_Block_Template
implements Mage_Adminhtml_Block_Widget_Tab_Interface {
public function __construct() {
$this->setTemplate('anc/testprices/action.phtml');
}
public function getCustomtabInfo() {
$customer = Mage::registry('current_customer');
$customtab = 'Inhalt wird hier angezeigt';
return $customtab;
}
/**
* @return string
*/
public function getTabLabel() {
return $this->__('Kundenpreise');
}
/**
* @return string
*/
public function getTabTitle() {
return $this->__('Preis Tab');
}
/**
* Can show tab in tabs
* @return boolean
*/
public function canShowTab() {
$customer = Mage::registry('current_customer');
return (bool) $customer->getId();
}
/**
* @return boolean
*/
public function isHidden() {
return false;
}
/**
* @return string
*/
public function getAfter() {
return 'tags';
}
}
?>
3) config.xml
<config>
<modules>
<Anc_Testprices>
<version>0.1.0</version>
</Anc_Testprices>
</modules>
<adminhtml>
<layout>
<updates>
<testprices>
<file>anc/testprices.xml</file>
</testprices>
</updates>
</layout>
</adminhtml>
<global>
<blocks>
<testprices>
<class>Anc_Testprices_Block</class>
</testprices>
</blocks>
</global>
</config>
4) testprices.xml
<layout version="0.1.0">
<adminhtml_customer_edit>
<reference name="customer_edit_tabs">
<action method="addTab">
<name>customer_edit_tab_action</name>
<block>testprices/adminhtml_customer_edit_tab_action</block>
</action>
</reference>
</adminhtml_customer_edit>
</layout>
5) action.phtml
<div id="customer_info_tabs_customer_edit_tab_action_content">
<div class="entry-edit">
<div class="entry-edit-head">
<h4 class="icon-head head-edit-form fieldset-legend">Preis Tab</h4>
</div>
<div id="group_fields4" class="fieldset fieldset-wide">
<div class="hor-scroll">
<table class="form-list" cellspacing="0">
<tbody>
<tr>
<td>Inhalt werden hier Angezeigt</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
