Zum Inhalt springen

Memo ohne Userlogin

Erstellt am 16. Februar 2010 · 1 Antwort · letzte Antwort am 19. Februar 2010

Tags: Frontend-Benutzer, Frage

BlackPixel ·

Hallo Leute,

kann ich die Memo Funktion des Shops ohne fe_user nutzen? Die komplette Funktionaltität des Shops wird erst später benötigt, vorab sollen Besucher nur einen Merkzettel ohne speichern erstellen können.

Hat jemand infos?

Danke Manfred

BlackPixel ·

geht wohl nicht. da die anforderung aber ein muss ist habe ich die klasse etwas geändert.

Am anfang der Klasse tx_ttproducts_memo_view.php ist die abfrage der user id mit dem code für die memoliste:

		if ($fe_user_uid)	{
			if ($TSFE->fe_user->user['tt_products_memoItems'] != '')	{
				$this->memoItems = explode(',', $TSFE->fe_user->user['tt_products_memoItems']);
			}

			if ($this->pibase->piVars['addmemo'])	{
				$addMemo = explode(',', $this->pibase->piVars['addmemo']);

				foreach ($addMemo as $addMemoSingle)
					if (!in_array($addMemoSingle, $this->memoItems))
						$this->memoItems[] = intval($addMemoSingle);

				$fieldsArray = array();
				$fieldsArray['tt_products_memoItems'] = implode(',', $this->memoItems);
				$TYPO3_DB->exec_UPDATEquery('fe_users', 'uid='.$fe_user_uid, $fieldsArray);
			}

			if ($this->pibase->piVars['delmemo'])	{
				$delMemo = explode(',', $this->pibase->piVars['delmemo']);

				foreach ($delMemo as $delMemoSingle)	{
					$val = intval($delMemoSingle);
					if (in_array($val, $this->memoItems))
						unset($this->memoItems[array_search($val, $this->memoItems)]);
				}

				$fieldsArray = array();
				$fieldsArray['tt_products_memoItems']=implode(',', $this->memoItems);
				$TYPO3_DB->exec_UPDATEquery('fe_users', 'uid='.$fe_user_uid, $fieldsArray);
			}
		}

Hab die auf Sessions umgebut, reicht in unserem Fall aus:

		if ($GLOBALS["TSFE"]->fe_user->getKey('ses','memo') != '')	{
			$this->memoItems = explode(',', unserialize($GLOBALS["TSFE"]->fe_user->getKey('ses','memo')));
		}
		if ($this->pibase->piVars['addmemo'])	{
			$addMemo = explode(',', $this->pibase->piVars['addmemo']);

			foreach ($addMemo as $addMemoSingle)
				if (!in_array($addMemoSingle, $this->memoItems))
				$this->memoItems[] = intval($addMemoSingle);

			$fieldsArray = array();
			$fieldsArray['tt_products_memoItems'] = implode(',', $this->memoItems);
			$GLOBALS["TSFE"]->fe_user->setKey('ses','memo',serialize($fieldsArray['tt_products_memoItems']));
			$GLOBALS["TSFE"]->storeSessionData();
		}

		
		
		if ($this->pibase->piVars['delmemo'])	{
			$delMemo = explode(',', $this->pibase->piVars['delmemo']);

			foreach ($delMemo as $delMemoSingle)	{
				$val = intval($delMemoSingle);
				if (in_array($val, $this->memoItems))
					unset($this->memoItems[array_search($val, $this->memoItems)]);
			}

			$fieldsArray = array();
			$fieldsArray['tt_products_memoItems']=implode(',', $this->memoItems);
			$GLOBALS["TSFE"]->fe_user->setKey('ses','memo',serialize($fieldsArray['tt_products_memoItems']));
			$GLOBALS["TSFE"]->storeSessionData();
		}

Gruß Manfred