Magento extratab im backend
Aus Vosp.info
Version vom 20. Oktober 2015, 20:03 Uhr von V (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „== Anzeigen eines extra Tabs unter Kunden bearbeiten == === Testprices === ==== Struktur ==== '''/app/etc/modules/''' 1) Anc_Testprices.xml '''/app/code/…“)
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
1 <?xml version="1.0"?>
2 <config>
3 <modules>
4 <Anc_Testprices>
5 <active>true</active>
6 <codePool>local</codePool>
7 </Anc_Testprices>
8 </modules>
9 </config>
2) Action.php
1 <?php
2
3 /**
4 * Adminhtml Kunden Tab
5 *
6 */
7 class Anc_Testprices_Block_Adminhtml_Customer_Edit_Tab_Action
8 extends Mage_Adminhtml_Block_Template
9 implements Mage_Adminhtml_Block_Widget_Tab_Interface {
10
11 public function __construct() {
12 $this->setTemplate('anc/testprices/action.phtml');
13 }
14
15 public function getCustomtabInfo() {
16 $customer = Mage::registry('current_customer');
17 $customtab = 'Inhalt wird hier angezeigt';
18 return $customtab;
19 }
20
21 /**
22 * @return string
23 */
24 public function getTabLabel() {
25 return $this->__('Kundenpreise');
26 }
27
28 /**
29 * @return string
30 */
31 public function getTabTitle() {
32 return $this->__('Preis Tab');
33 }
34
35 /**
36 * Can show tab in tabs
37 * @return boolean
38 */
39 public function canShowTab() {
40 $customer = Mage::registry('current_customer');
41 return (bool) $customer->getId();
42 }
43
44 /**
45
46 * @return boolean
47 */
48 public function isHidden() {
49 return false;
50 }
51
52 /**
53 * @return string
54 */
55 public function getAfter() {
56 return 'tags';
57 }
58
59 }
60
61 ?>
3) config.xml
1 <config>
2 <modules>
3 <Anc_Testprices>
4 <version>0.1.0</version>
5 </Anc_Testprices>
6 </modules>
7 <adminhtml>
8 <layout>
9 <updates>
10 <testprices>
11 <file>anc/testprices.xml</file>
12 </testprices>
13 </updates>
14 </layout>
15 </adminhtml>
16 <global>
17 <blocks>
18 <testprices>
19 <class>Anc_Testprices_Block</class>
20 </testprices>
21 </blocks>
22 </global>
23 </config>
4) testprices.xml
1 <layout version="0.1.0">
2 <adminhtml_customer_edit>
3 <reference name="customer_edit_tabs">
4 <action method="addTab">
5 <name>customer_edit_tab_action</name>
6 <block>testprices/adminhtml_customer_edit_tab_action</block>
7 </action>
8 </reference>
9 </adminhtml_customer_edit>
10 </layout>
5) action.phtml
1 <div id="customer_info_tabs_customer_edit_tab_action_content">
2 <div class="entry-edit">
3 <div class="entry-edit-head">
4 <h4 class="icon-head head-edit-form fieldset-legend">Preis Tab</h4>
5 </div>
6 <div id="group_fields4" class="fieldset fieldset-wide">
7 <div class="hor-scroll">
8 <table class="form-list" cellspacing="0">
9 <tbody>
10 <tr>
11 <td>Inhalt werden hier Angezeigt</td>
12 </tr>
13 </tbody>
14 </table>
15 </div>
16 </div>
17 </div>
18 </div>