Zum Inhalt springen

Newsletter Anmeldung um eigene Felder erweitern

Erstellt am 3. März 2005 · 5 Antworten · letzte Antwort am 4. März 2005

Tags: Frage

claudia3 ·

Hallo,

ich weiß zu diesem Thema gibt es schon einige Threads.
Hier gleich mal eine Liste:

#10193
http://www.typo3faq.net/index.php?aktion=artikel&rubrik=003&id=57&lang=de
#14216

Leider bekomme ich meine zusätzlichen Felder nicht in tt_address eingetragen.

Hier was ich bisher getan habe:

1. Mein Newsletter Template folgendermaßen angepasst:

<!-- ###TEMPLATE_CREATE### begin
	Form for creation of a new newsletter recipient
-->
<form name="tt_address_form" method="post" action="###FORM_URL###">
###GW1B###<h1>NEWSLETTER</h1>
<h2>IMMER AUF DEM AKTUELLEN STAND</h2>
<p>Abonnieren Sie den Newsletter und Sie erhalten monatlich aktuelle Informationen.</p>
<h2>MELDEN SIE SICH JETZT AN</h2>
###GW1E###
<br>
<br>
###GW2B###
<fieldset>
	<p><label for="FE[tt_address][gender]">Anrede:</label><input type="radio" id="FE[tt_address][gender]" name="FE[tt_address][gender]" value="Herr" checked>Herr&nbsp;&nbsp;<input type="radio" name="anrede" id="anrede" value="Frau">Frau</p>
    <p><label for="FE[tt_address][title]">Titel:</label><input type="text" name="FE[tt_address][title]" id="FE[tt_address][title]" maxlength="50"></p>
    <p><label for="FE[tt_address][firstname]">Vorname:</label><input type="text" name="FE[tt_address][firstname]" id="FE[tt_address][firstname]" maxlength="50"></p>
	<p><label for="FE[tt_address][name]">Name:</label><input type="text" name="FE[tt_address][name]" id="FE[tt_address][name]" maxlength="50"></p>
	<p><label for="FE[tt_address][position]">Funktion:</label><input type="text" name="FE[tt_address][position]" id="FE[tt_address][position]" maxlength="50"></p>
	<p><label for="FE[tt_address][company]">Firma:</label><input type="text" name="FE[tt_address][company]]" id="FE[tt_address][company]]" maxlength="50"></p>
	<p><label for="FE[tt_address][email]">E-Mail<span class="orange">*</span>:</label><input type="text" name="FE[tt_address][email]" id="FE[tt_address][email]" maxlength="50"></p>
	<p><label for="FE[tt_address][module_sys_dmail_html]">HTML E-Mails:</label><input type="checkbox" name="FE[tt_address][module_sys_dmail_html]" id="FE[tt_address][module_sys_dmail_html]" value="1"></p>
</fieldset>
<p><input type="submit" name="whatever" value="ANMELDEN" class="button"></p>
###HIDDENFIELDS###
</form>
<p>Wenn Sie schon angemeldet sind, können Sie <a href="###FORM_URL###&cmd=infomail&backURL=###FORM_URL_ENC###">hier Ihre Daten ändern oder sich abmelden</a>.</p>
###GW2E###
<!-- ###TEMPLATE_CREATE### end-->

2. Die entsprechenden Felder in der tt_address angelegt (über phpMyAdmin)

3. Die Datei tca.php folgendermaßen angepasst:

<?php

// ******************************************************************
// This is the standard TypoScript address table, tt_address
// ******************************************************************
$TCA['tt_address'] = Array (
	'ctrl' => $TCA['tt_address']['ctrl'],
	'interface' => Array (
		'showRecordFieldList' => 'name,address,city,zip,country,phone,fax,email,www,title,company,image'
	),
	'feInterface' => $TCA['tt_address']['feInterface'],
	'columns' => Array (	
		'hidden' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.hidden',
			'config' => Array (
				'type' => 'check'
			)
		),
		'gender' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.gender',
			'config' => Array (
				'type' => 'input',
				'size' => '10',
				'max' => '5'
			)
		),
		'firstname' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.firstname',
			'config' => Array (
				'type' => 'input',
				'size' => '20',
				'max' => '256'
			)
		),
		'name' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.name',
			'config' => Array (
				'type' => 'input',
				'size' => '20',
				'max' => '256'
			)
		),
		'title' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.title',
			'config' => Array (
				'type' => 'input',
				'size' => '20',
				'eval' => 'trim',
				'max' => '40'
			)
		),
		'position' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.position',
			'config' => Array (
				'type' => 'input',
				'size' => '40',
				'max' => '256'
			)
		),
		'address' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.address',
			'config' => Array (
				'type' => 'text',
				'cols' => '20',	
				'rows' => '3'
			)
		),
		'phone' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.phone',
			'config' => Array (
				'type' => 'input',
				'eval' => 'trim',
				'size' => '20',
				'max' => '30'
			)
		),
		'fax' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.fax',
			'config' => Array (
				'type' => 'input',
				'size' => '20',
				'eval' => 'trim',
				'max' => '30'
			)
		),
		'mobile' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:tt_address/locallang_tca.php:tt_address.mobile',
			'config' => Array (
				'type' => 'input',
				'eval' => 'trim',
				'size' => '20',
				'max' => '30'
			)
		),
		'www' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.www',
			'config' => Array (
				'type' => 'input',
				'eval' => 'trim',
				'size' => '20',
				'max' => '80'
			)
		),
		'email' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.email',
			'config' => Array (
				'type' => 'input',
				'size' => '40',
				'eval' => 'trim',
				'max' => '80'
			)
		),
		'company' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.company',
			'config' => Array (
				'type' => 'input',
				'eval' => 'trim',
				'size' => '20',
				'max' => '80'
			)
		),
		'city' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.city',
			'config' => Array (
				'type' => 'input',
				'size' => '20',
				'eval' => 'trim',
				'max' => '80'
			)
		),
		'zip' => Array (
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.zip',
			'config' => Array (
				'type' => 'input',
				'eval' => 'trim',
				'size' => '10',
				'max' => '20'
			)
		),
		'country' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.country',
			'config' => Array (
				'type' => 'input',
				'size' => '20',
				'eval' => 'trim',
				'max' => '30'
			)
		),
		'image' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.image',
			'config' => Array (
				'type' => 'group',
				'internal_type' => 'file',
				'allowed' => $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'],
				'max_size' => '1000',
				'uploadfolder' => 'uploads/pics',
				'show_thumbs' => '1',
				'size' => '3',
				'maxitems' => '6',
				'minitems' => '0'
			)
		),
		'description' => Array (
			'exclude' => 1,	
			'label' => 'LLL:EXT:lang/locallang_general.php:LGL.description',
			'config' => Array (
				'type' => 'text',
				'rows' => 5,
				'cols' => 48
			)
		)
	),
	'types' => Array (	
		'1' => Array('showitem' => 'hidden;;;;1-1-1, name;;2;;3-3-3, company;;6, address;;3, email;;5, phone;;4, image;;;;4-4-4, description')
	),
	'palettes' => Array (
		'2' => Array('showitem' => 'gender, title, firstname'),
		'3' => Array('showitem' => 'zip, city, country'),
		'4' => Array('showitem' => 'mobile, fax'),
		'5' => Array('showitem' => 'www'),
		'6' => Array('showitem' => 'position'),
	)
);
?>

4. Sprache in locallang_general.xml um neue Begriffe erweitert

5. ext_tables.php um neue Felder erweitert:

<?php
if (!defined ('TYPO3_MODE')) 	die ('Access denied.');

$TCA['tt_address'] = Array (
	'ctrl' => Array (
		'label' => 'name',
		'label_alt' => 'email',
		'default_sortby' => 'ORDER BY name',
		'tstamp' => 'tstamp',
		'prependAtCopy' => 'LLL:EXT:lang/locallang_general.php:LGL.prependAtCopy',
		'delete' => 'deleted',
		'title' => 'LLL:EXT:tt_address/locallang_tca.php:tt_address',
		'enablecolumns' => Array (
			'disabled' => 'hidden'
		),
		'thumbnail' => 'image',
		'iconfile' => t3lib_extMgm::extRelPath($_EXTKEY).'ext_icon.gif',
		'dynamicConfigFile' => t3lib_extMgm::extPath($_EXTKEY).'tca.php'
	),
	'feInterface' => Array (
		'fe_admin_fieldList' => 'pid,hidden,name,firstname,gender,title,address,phone,fax,mobile,www,email,city,zip,company,position,country,description'
	)
);
t3lib_extMgm::addPlugin(Array('LLL:EXT:tt_address/locallang_tca.php:pi_tt_address', '0'));
t3lib_extMgm::allowTableOnStandardPages('tt_address');
t3lib_extMgm::addToInsertRecords('tt_address');

t3lib_extMgm::addLLrefForTCAdescr('tt_address','EXT:tt_address/locallang_csh_ttaddr.php');
?>

6. ext_tables.sql um neue Felder erweitert, was allerdings bestimmt nicht nötig gewesen wäre, da ich die Felder in der DB ja schon von Hand angelegt hatte.

Das alles hat zur Folge, dass meine Anmeldemaske genauso aussihet wie ich will. Auch im Backend ist die Ansicht der einzelnen Empfänger perfekt.
Nur: es werden immer nur wie vor meiner Erweiterung Name, Email und HTML/nichtHTML in die DB gespeichert ;o(.

Woran kann das liegen?

Gruß,
Claudia

claudia3 ·

Aha, wenn ich folgenden Anweisungen folge

http://www.typo3forum.net/viewtopic.php?p=3528

Und den Eintrag

plugin.feadmin.dmailsubscription.edit.fields = gender, firstname, name, title, position, company, email, module_sys_dmail_category, module_sys_dmail_html 
plugin.feadmin.dmailsubscription.create.fields = gender, firstname, name, title, position, company, email, module_sys_dmail_category, module_sys_dmail_html

Vom Constants Field ins Setup nehme, funktioniert schon ein bißchen mehr.
Jetzt werden zumindest die Felder "title" und "company" übernommen. Das sind ja Felder, die in der tt_address ursprünglich auch schon vorhanden waren.

Mit "gender", "firstname" und "position" klappt es immer noch nicht.

???

Gruß,
Claudia

Stoneage ·

Weiß ich auch nicht so genau, sieht eigentlich alles richtig aus. Aber probier doch mal in die tca.php die neuen Felder in 'showRecordFieldList' => 'name,address,city,zip,country,phone,fax,email,www,title,company,image' hinzuzufügen. Vielleicht hilfts ja!?

Gruß,

T.
[/quote]

claudia3 ·

Hi,

das war`s auch nicht.
Ich habe jetzt eine Vermutung. Bei der Anmeldemaske wird folgender Javascriptcode eingebunden:

<script type="text/javascript">
	/*<![CDATA[*/ 
	updateForm('tt_address_form','FE[tt_address][pid]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][hidden]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][name]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][title]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][address]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][phone]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][fax]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][mobile]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][www]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][email]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][city]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][zip]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][company]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][country]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][description]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][module_sys_dmail_category]',unescape(''))
	updateForm('tt_address_form','FE[tt_address][module_sys_dmail_html]',unescape(''))
	/*]]>*/
</script>

Im Newslettertemplate steht das an der Stelle des Markers ###GW2E### denke ich.
Weiß jemand wo ich das oben genannte Javascript anpassen kann?

Danke,
Claudia

claudia3 ·

Wenn ich im BE unter Konfiguration

$TCA['tt_address']['feInterface']['fe_admin_fieldList']

betrachte fehlen da meine neuen Felder.
Die sollte ich doch oben durch ändern der ext_tables.php
angefügt haben.
Wieso werden sie nicht angezeigt?
Wo muss ich noch was ändern?

Ich verzweifle langsam.

Gruß,
Claudia

claudia3 ·

Ich habe es jetzt mit der "Holzhammer-Methode"
versucht und mit dem Kickstarter eine Extension zur Tabellenerweiterung gemacht.
Damit hat es funktioniert.

Gruß,
Claudia