tt_address: add categorys of address to the template

烂漫一生 提交于 2020-02-08 02:38:49

问题


Is it somehow possible to add the sub-group of a cetrain group the address is assigned to the html output?

In the template I have ###MAINGROUP### and ###GROUPLIST###. I can't use maingroup, cause it's not the case that the group I need is always the maingroup. And with the grouplist I can't say which group is the sub-group of the one group.

Anyone have an idea how I could do it?

And in addition to that I also need the value of a self created field in the tt_address table.

Edit:

I try it like @lorenz say. What I have so far:

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['###SORTBEREICH###']   = 
        $lcObj->stdWrap($address['tx_nextaddresssort_sort_bereich'], 
        $lConf['tx_nextaddresssort_sort_bereich.']); 

    } 

}

Extentionkey: next_address_sort

All I get is a blank screen, but no errors in apache log


回答1:


No, there is no possibility to do that.

Yet you can write a custom extension that integrates the extraItemMarkerProcessorhook in tt_address. In ext_localconf.php, add:

$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['tt_address']['extraItemMarkerHook'][]     ='EXT:myextension/class.tx_myextension_filename.php:tx_myextension_classname';

Then add a file class.tx_myextension_filename.php to your extension.:

class tx_myextension_classname {

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

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

      $markerArray['###MYFIELD###'] = $lcObj->stdWrap($address['myfieldlikeindatabase'], $lConf['myfieldlikeindatabase.']);

      return $markerArray;

    }

}

This would be an example for getting a field that is in the tt_address table and adding it to the markers so they can be used in a template. It is also stdWrap enabled.

Now, instead of getting a field, you should replace $address['myfieldlikeindatabase'] with a variable that contains the information you need. To receive the data, you can use the TYPO3 database API functions ($GLOBALS['TYPO3_DB']).



来源:https://stackoverflow.com/questions/19569667/tt-address-add-categorys-of-address-to-the-template

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!