1
votes

I'm using TYPO3 v 6.2 and the Extension tt_address. I need more (data)fields into the tt_address-table.

I've read, that I can add more db-fields via kickstarter. So I installed TYPO3 4.5 and install kickstarter.

Add new Extension "ttaddressaddfields". Add the "tt_address"-DB-table at "Extend Existing Tables". Add a new Data-Field type String "email1". View Result -> Write -> Install ext. and voila! Everything works .. I have a new Field at my tt_address Form called "email1". In the database, the field email1 was written with my content.

BUT! How can I show my result in Frontend? Do I have to edit the tt_address-Setup.ts?

I add this at my own Extension at ext_localconf.php

<?php
if (!defined ('TYPO3_MODE')) die ('Access denied.');
    $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extendingTCA'][] = 'ttaddressaddnew';
?>

in my HTML-template (from tt_address)

###PHONE###
<br>Extrafeld :&nbsp;    ###EMAIL1###

Anyhow .. it doesn't work! Where is my fault? I've no idea ;)

4

4 Answers

3
votes

you need to write your own hook for tt_address's extra itemmarker array.

Example taken from tt-address-add-categorys-of-address-to-the-template, but to make everybody happy include the essential parts here:

ext_localconf.php:

<?php
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][] 
='EXT:txnextaddresssort/class.tx_next_address_sort_addmarkers.php:tx_next_address_sort_addmarkers';

class.tx_next_address_sort_addmarkers.php:

    <?php
    class tx_next_address_sort_addmarkers {
      function extraItemMarkerProcessor(&$markerArray, &$address, &$lConf, 
        &$pObj) { 

        $lcObj = t3lib_div::makeInstance('tslib_cObj'); 
        $lcObj->data = $address; 

        $markerArray['###EMAIL1###']   = $address['email1'];
      } 
    }
1
votes

Thank you all! I've done it!

After create a new Extension at Kickstarter ...

In my Template for tt_address

###EMAIL1###

My Extra field in tt_address-table is called

tx_ttaddressextended_email1

Add a new class-file (class.tx_ttaddressextended_filename.php) in my new Extension typo3conf/ext/tt_address_extended/

<?php
class tx_ttaddressextended_classname {

    public function extraItemMarkerProcessor(&$markerArray, &$address, &$lConf, &$pObj) {

      $lcObj = t3lib_div::makeInstance('tslib_cObj');
      $lcObj->data = $address;

      $markerArray['###EMAIL1###'] = $lcObj->stdWrap($address['tx_ttaddressextended_email1'], $lConf['tx_ttaddressextended_email1']);

      return $markerArray;

    }

}
?>

And the HOOK at a new file ext_localconf.php:

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

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][] = 'EXT:tt_address_extended/class.tx_ttaddressextended_filename.php:tx_ttaddressextended_classname';

?>
0
votes

I think it would be better you write your own extension and use tt_address db fields. I do that every time, because when i need to extend it more, its no problem in my own extension.

-1
votes

There should be a special syntax to name markers for custom fields.

Have a look at this old thread: http://www.typo3forum.net/forum/extension-modifizieren-neu-erstellen/27095-tt_address-um-link-feld-erweitert-marker-nutzen.html

Where the user was successful with

###LINK_TX_TTADDRESSEXT_INTLINK###

So you might try with

###EMAIL1_TX_TTADDRESSEXT_FIELDTYPE###

Not sure why the fieldtype and what to put there though!