TYPO3-Testaccount
Testen Sie die aktuellste TYPO3-Version kostenlos und unverbindlich für einen Monat!

Jetzt testen!

Schulungen

Memo ohne Userlogin


Autor Nachricht
Verfasst am: 16. 02. 2010 [16:32]
BlackPixel
Themenersteller
Dabei seit: 22.04.2005
Beiträge: 193
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
Profil
Verfasst am: 19. 02. 2010 [10:02]
BlackPixel
Themenersteller
Dabei seit: 22.04.2005
Beiträge: 193
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:
PHP
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:

PHP
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
Profil