vendredi 1 mai 2015

Powermail - Prefill befüllen aus Datenbank von der Extension news

Hallo,
ich nutze: Typo3 6.2.12
Extensions: Powermail und News

Nun wollte ich ein Formular generieren, welches als "Thema" das Auswahlfeld von Powermail nutzt,
in diesem Auswahlfeld sollen die Daten / Tag aus der "News" Extension angezeigt werden.

Das habe ich gemacht:

Schritt 1:
- lib ausgedacht: lib.newsCategory

Schritt 2:
- Powermail -> Seite angelegt -> Formular angelegt -> Feld Thema angelegt als Typ "Auswahlfeld"
- In das Feld unter (Erweitert) unter "Aus TypoScript generieren (z.B. lib.fieldvalues)" eingetragen: {f:cObject(typoscriptObjectPath:'lib.newsCategory')}
Optionen habe ich leer gelassen

Schritt 3:
- Typoscript Datei extern erstellt und eingebunden, die Datei hat folgendes Script:
Code:

plugin.tx_powermail.settings.setup {
        # Save values to any table (example for tt_adress)
        dbEntry {
                #####################################################
                        ### EXAMPLE for adding values to table tt_address ###
                        #####################################################

                        # Enable or disable db entry for table tt_address
                        tx_news_domain_model_news._enable = TEXT
                        tx_news_domain_model_news._enable.value = 1

                        # Write only if any field is not yet filled with current value (e.g. test if an email is already in database)
                                # default: always add new records (don't care about existing values)
                                # update: update record if there is an existing entry (e.g. if email is already there)
                                # none: no entry if field is filled (do nothing if record already exists)
                        #tt_address._ifUnique.email = update

                        # Fill new record of table "tt_address" with field "email" with a static value => mail@mail.com
                        #tt_address.email = TEXT
                        #tt_address.email.value = mail@mail.com

                        # Fill new record of table "tt_address" with field "pid" with the current pid (e.g. 12)
                        tx_news_domain_model_news.pid = TEXT
                        tx_news_domain_model_news.pid.data = TSFE:id

                        # Fill new record of table "tt_address" with field "tstamp" with the current time as timestamp (like 123456789)
                        tx_news_domain_model_news.tstamp = TEXT
                        tx_news_domain_model_news.tstamp.data = date:U

                        # Fill new record of table "tt_address" with field "address" with the current formatted time (like "Date: 20.01.2013")
                        #tt_address.address = TEXT
                        #tt_address.address.data = date:U
                        #tt_address.address.strftime = Date: %d.%m.%Y

                        # Fill new record of table "tt_address" with field "name" with the value from powermail {firstname}
                        tx_news_domain_model_news.title = TEXT
                        tx_news_domain_model_news.title.field = title

                        # Fill new record of table "tt_address" with field "last_name" with the value from powermail {lastname}
                        tx_news_domain_model_news.teaser = TEXT
                        tx_news_domain_model_news.teaser.field = teaser

                        # Fill new record of table "tt_address" with field "company" with the value from powermail {company}
                        tx_news_domain_model_news.bodytext = TEXT
                        tx_news_domain_model_news.bodytext.field = news



                        ##############################################################
                        ### EXAMPLE for adding values to table tt_address_group_mm ###
                        ### Add relation to an existing address group with uid 123 ###
                        ##############################################################

                        # Enable or disable db entry for table tt_address_group_mm
                        #tt_address_group_mm._enable = TEXT
                        #tt_address_group_mm._enable.value = 1

                        # Fill new record of table "tt_address_group_mm" with field "uid_local" with uid of tt_address record that was just created before with .field=uid_[tablename]
                        #tt_address_group_mm.uid_local = TEXT
                        #tt_address_group_mm.uid_local.field = uid_tt_address

                        # Fill new record of table "tt_address_group_mm" with field "uid_foreign" with uid 123
                        #tt_address_group_mm.uid_foreign = TEXT
                        #tt_address_group_mm.uid_foreign.value = 123
        }
}

#Script, um die Werte ins Auswahlfeld zu übertragen.
lib.newsCategory = COA_INT
lib.newsCategory {
  plugin.tx_powermail{
    settings {
      setup {
        prefill {
          topic = CONTENT
          topic {
            table = tx_news_domain_model_tag
            #Name der Tabelle in der Tag gespeichert sind.
            select {
              pidInList = 19
              #ID in der die News/Nachrichten gespeichert werden
              andWhere {
                data = GP:title
                #Name des Feldes in der Tabelle in der die Inhalte von Tag gespeichert sind
                wrap = tx_news_domain_model_tag.uid=|
              }
            }
            renderObj = TEXT
            renderObj.field = title
          }
        }
      }
    }
  }
}

Mit dem oberen Code kann ich Werte aus dem Formular in die Extension News speichern, das funktioniert. Jedoch kann ich mit dem unteren Code nicht das Auswahlfeld mit dem Nachrichten Tag befüllen:(

Deshalb habe ich mal folgende Alternative zum unteren Script probiert:


Code:

lib.newsCategory = CONTENT
lib.newsCategory {
    table = pages
    select {
      pidInList = 19
    }
    renderObj = COA
    renderObj {
      10 = COA
      10 {
        10 = TEXT
        10.dataWrap = {field:title}[\n]
      }
    }
  }

plugin.tx_powermail.settings.setup.prefill {
    topic= RECORDS
    topic {
      tables = tx_news_domain_model_tag
      source.data = source.data = GP:tx_news_domain_model_tag|title
      conf.pages = TEXT
      conf.pages.field = title
    }
}

Aber leider werden auch hier keine Ergebnisse im Auswahlfeld angezeigt:
"Error no options to show"

Hier noch Datenbank Infos:
Tag für News ist in dem Ordner PID 19 gespeichert.
Tag Datenbankname ist: tx_news_domain_model_tag
Tag Eintrag ist unter "title" gespeichert.

Jemand eine Vorstellung, wo mein Fehler liegen könnte?


Powermail - Prefill befüllen aus Datenbank von der Extension news

Aucun commentaire:

Enregistrer un commentaire