Zum Inhalt springen

zk_products: weitere Formularfelder einfügen

Erstellt am 7. Juni 2005 · 5 Antworten · letzte Antwort am 8. Juni 2005

Tags: PHP, Frage

donvito ·

moin

ich versuche grade weitere formularfelder in die bestellmaske einzupflegen, komme aber nicht mehr weiter. am besten kann ich das an einem beispiel erklären:

		<td align="left" valign="top">Firma:</td>
		<td></td>
		<td><input type="text" name="recs[personinfo][firma]" size="30" value="###PERSON_FIRMA###" class="inputfieldcontent"></td>
	</tr>

so habe ich ein weiteres feld in das formular eingegeben. dabei orientiere ich mich an den bestehenden feldern. dann habe ich in der class.tx_ttproducts.php in zwei bereichen ebenfalls den punkt branche dazugefügt:

		if ($GLOBALS["TSFE"]->loginUser && (!$this->personInfo || $this->conf["lockLoginUserInfo"]))	{
			$this->personInfo["firma"] = $GLOBALS["TSFE"]->fe_user->user["firma"];
.
.
.

und

"VALUES (".
 "'".$this->confpersonInfo["firma"]."', ".
.
.
.

leider spricht er im formular im vergleich zu den bestehenden feldern das value="" nicht an. da bleibt mein merker bestehen. daher meine frage, wie ich neue felder in das bestellformular übernehmen kann???

gruß

donvito ·

gibt es dazu eine doku, die du mir empfehlen kannst? ich bin ein php-rookie. wie gesagt, ich habe mir schon was in der class.tx_ttproducts.php angeschaut und verändert. muss ich noch änderungen in anderen php datein vornehmen?

donvito ·

ich brauch nochmal eure hilfe. also ich möchte die felder: branche, firma, vorname, von und bis hinzufügen.

ich meine ich hätte alles erforderliche geändert, aber er spring nicht drauf an... ich zeig euch meinen code dafür:

in der products_template_de.tmpl:

<!-- ###BILLING_ADDRESS### start -->
	<table border="0" cellspacing="0" cellpadding="0">
	<tr>
		<td align="left" valign="top">Firma:</td>
		<td></td>
		<td><input type="text" name="recs[personinfo][firma]" size="30" value="###PERSON_FIRMA###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">Branche:</td>
		<td></td>
		<td><input type="text" name="recs[personinfo][branche]" size="30" value="###PERSON_BRANCHE###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">Name:</td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td><input type="text" name="recs[personinfo][name]" size="30" value="###PERSON_NAME###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">Vorname:</td>
		<td></td>
		<td><input type="text" name="recs[personinfo][vorname]" size="30" value="###PERSON_VORNAME###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">Strasse:</td>
		<td><img src="clear.gif" width=5 height=1></td>
		<td><input type="text" name="recs[personinfo][address]" size="30" value="###PERSON_ADDRESS###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">PLZ / Ort:</td>
		<td><img src="clear.gif" width=5 height=1></td>
		<td><input type="text" name="recs[personinfo][zip]" size="6" value="###PERSON_ZIP###"class="inputfieldcontent02"><input type="text" name="recs[personinfo][city]" size="22" value="###PERSON_CITY###"class="inputfieldcontent04"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">Telefon:</td>
		<td><img src="clear.gif" width=5 height=1></td>
		<td><input type="text" name="recs[personinfo][telephone]" size="30" value="###PERSON_TELEPHONE###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">Telefax:</td>
		<td><img src="clear.gif" width=5 height=1></td>
		<td><input type="text" name="recs[personinfo][fax]" size="30" value="###PERSON_FAX###" class="inputfieldcontent"></td>
	</tr>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left" valign="top">e-mail:</td>
		<td><img src="clear.gif" width=5 height=1></td>
		<td><input type="text" name="recs[personinfo][email]" size="30" value="###PERSON_EMAIL###" class="inputfieldcontent"></td>
	<tr>
		<td align="left" valign="top"></td>
		<td><img src="clear.gif" width=15 height=8></td>
		<td></td>
	</tr>
	<tr>
		<td align="left">&Uuml;bernachtung:</td>
		<td></td>
		<td>
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>von: <input type="text" name="recs[personinfo][von]" size="6" value="###PERSON_VON###"class="inputfieldcontent02"></td>
					<td><img src="clear.gif" width=10 height=1></td>
					<td>bis: <input type="text" name="recs[personinfo][bis]" size="6" value="###PERSON_BIS###"class="inputfieldcontent02"></td>
				</tr>
			</table>
		</td>
	</tr>
</table>
	<br>
	
<!-- ###BILLING_ADDRESS### end-->

deweiteren habe ich in der class.tx_ttproducts.php ebenfalls die neuen felder eingetragen:

		$this->personInfo = $basket["personinfo"];
		$this->deliveryInfo = $basket["delivery"];
		if ($GLOBALS["TSFE"]->loginUser && (!$this->personInfo || $this->conf["lockLoginUserInfo"]))	{
			$this->personInfo["firma"] = $GLOBALS["TSFE"]->fe_user->user["firma"];
			$this->personInfo["branche"] = $GLOBALS["TSFE"]->fe_user->user["branche"];
			$this->personInfo["name"] = $GLOBALS["TSFE"]->fe_user->user["name"];
			$this->personInfo["vorname"] = $GLOBALS["TSFE"]->fe_user->user["vorname"];
			$this->personInfo["address"] = $GLOBALS["TSFE"]->fe_user->user["address"];
			$this->personInfo["email"] = $GLOBALS["TSFE"]->fe_user->user["email"];
			$this->personInfo["telephone"] = $GLOBALS["TSFE"]->fe_user->user["telephone"];
			$this->personInfo["fax"] = $GLOBALS["TSFE"]->fe_user->user["fax"];
			// ZK+
			$this->personInfo["zip"] = $GLOBALS["TSFE"]->fe_user->user["zip"];
			$this->personInfo["city"] = $GLOBALS["TSFE"]->fe_user->user["city"];
			$this->personInfo["country"] = $GLOBALS["TSFE"]->fe_user->user["country"];
			$this->personInfo["von"] = $GLOBALS["TSFE"]->fe_user->user["von"];
			$this->personInfo["bis"] = $GLOBALS["TSFE"]->fe_user->user["bis"];
			// ZK-
			// MRO+
			$this->personInfo["agb"] = $GLOBALS["TSFE"]->fe_user->user["agb"];
			// MRO-
		}

dann geht es weiter, auch für fe_user:

				$query=	"INSERT INTO fe_users (`pid`, `tstamp`, `username`, `password`, `usergroup`, `firma`, `branche`, `name`, `vorname`, `address`, `telephone`, `fax`, `email`, `zip`, `city`, `country`, `von`, `bis`, `crdate`) ".
					"VALUES (".
					"'".$this->conf["PIDuserFolder"]."', ".
					"'".time()."', ".
					"'".$username."', ".
					"'".$this->password."', ".
					"'".$this->conf["memberOfGroup"]."', ".
					"'".$this->personInfo["firma"]."', ".
					"'".$this->personInfo["branche"]."', ".
					"'".$this->personInfo["name"]."', ".
					"'".$this->personInfo["vorname"]."', ".
					"'".$this->personInfo["address"]."', ".
					"'".$this->personInfo["telephone"]."', ".
					"'".$this->personInfo["fax"]."', ".
					"'".$this->personInfo["email"]."', ".
					"'".$this->personInfo["zip"]."', ".
					"'".$this->personInfo["city"]."', ".
					"'".$this->personInfo["country"]."', ".
					"'".$this->personInfo["von"]."', ".
					"'".$this->personInfo["bis"]."', ".
					"'".time()."'".
					");";

dazu habe ich in einem forumbeitrag noch etwas gesehen und daher:

	function mapPersonIntoToDelivery()	{
		$infoFields = explode(",","branche,firma,name,vorname,address,telephone,fax,email,company,city,zip,state,country,von,bis,kk_fa,kk_nr,kk_ablauf,kk_pruefcode,agb");
		while(list(,$fName)=each($infoFields))	{
			if (!trim($this->deliveryInfo[$fName]))	{
				$this->deliveryInfo[$fName] = $this->personInfo[$fName];
			}
		}

leider spricht er meine felder trotzdem nicht an #angry# !!!

in meinen textfeldern wir immernoch das value angezeigt. da steht also ###PERSON_BRANCHE### weil er das value nicht anspricht. wo ist denn bei mir der fehler, ich seh den wald vor lauter bäumen nicht mehr :o [/img]

donvito ·

wow, der server ist ja grad richtig abgeraut und ich hatte plötzlich zehnmal den gleichen eintrag. tschuldigung! naja, ich verweise auf meinen eintrag... 😉

Flink ·

Am einfachsten, du suchst im tt_products Code nach 'country'.
Alles, was mit 'country' gemacht wird, mußt du auch mit deinen neuen Feldern tun.

Dann sind auch noch Einträge in den Dateien ext_tables.php, ext_tables.sql, tca.php und locallang_tca.php notwendig.