Memo ohne Userlogin


  • 1
  • BlackPixel BlackPixe...
    Sternenflotten-Admiral
    0 x
    230 Beiträge
    3 Hilfreiche Beiträge
    19. 02. 2010, 10:02

    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:

    1. if ($fe_user_uid) {
    2. if ($TSFE->fe_user->user['tt_products_memoItems'] != '') {
    3. $this->memoItems = explode(',', $TSFE->fe_user->user['tt_products_memoItems']);
    4. }
    5.  
    6. if ($this->pibase->piVars['addmemo']) {
    7. $addMemo = explode(',', $this->pibase->piVars['addmemo']);
    8.  
    9. foreach ($addMemo as $addMemoSingle)
    10. if (!in_array($addMemoSingle, $this->memoItems))
    11. $this->memoItems[] = intval($addMemoSingle);
    12.  
    13. $fieldsArray = array();
    14. $fieldsArray['tt_products_memoItems'] = implode(',', $this->memoItems);
    15. $TYPO3_DB->exec_UPDATEquery('fe_users', 'uid='.$fe_user_uid, $fieldsArray);
    16. }
    17.  
    18. if ($this->pibase->piVars['delmemo']) {
    19. $delMemo = explode(',', $this->pibase->piVars['delmemo']);
    20.  
    21. foreach ($delMemo as $delMemoSingle) {
    22. $val = intval($delMemoSingle);
    23. if (in_array($val, $this->memoItems))
    24. unset($this->memoItems[array_search($val, $this->memoItems)]);
    25. }
    26.  
    27. $fieldsArray = array();
    28. $fieldsArray['tt_products_memoItems']=implode(',', $this->memoItems);
    29. $TYPO3_DB->exec_UPDATEquery('fe_users', 'uid='.$fe_user_uid, $fieldsArray);
    30. }
    31. }

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

    1. if ($GLOBALS["TSFE"]->fe_user->getKey('ses','memo') != '') {
    2. $this->memoItems = explode(',', unserialize($GLOBALS["TSFE"]->fe_user->getKey('ses','memo')));
    3. }
    4. if ($this->pibase->piVars['addmemo']) {
    5. $addMemo = explode(',', $this->pibase->piVars['addmemo']);
    6.  
    7. foreach ($addMemo as $addMemoSingle)
    8. if (!in_array($addMemoSingle, $this->memoItems))
    9. $this->memoItems[] = intval($addMemoSingle);
    10.  
    11. $fieldsArray = array();
    12. $fieldsArray['tt_products_memoItems'] = implode(',', $this->memoItems);
    13. $GLOBALS["TSFE"]->fe_user->setKey('ses','memo',serialize($fieldsArray['tt_products_memoItems']));
    14. $GLOBALS["TSFE"]->storeSessionData();
    15. }
    16.  
    17.  
    18.  
    19. if ($this->pibase->piVars['delmemo']) {
    20. $delMemo = explode(',', $this->pibase->piVars['delmemo']);
    21.  
    22. foreach ($delMemo as $delMemoSingle) {
    23. $val = intval($delMemoSingle);
    24. if (in_array($val, $this->memoItems))
    25. unset($this->memoItems[array_search($val, $this->memoItems)]);
    26. }
    27.  
    28. $fieldsArray = array();
    29. $fieldsArray['tt_products_memoItems']=implode(',', $this->memoItems);
    30. $GLOBALS["TSFE"]->fe_user->setKey('ses','memo',serialize($fieldsArray['tt_products_memoItems']));
    31. $GLOBALS["TSFE"]->storeSessionData();
    32. }

    Gruß Manfred

    TYPO3 Slider Revolution: https://www.rutschmann.biz/extensions/typo3-slider-revolution/
    TYPO3 Layerslider Extension: http://www.rutschmann.biz/extensions/typo3-layerslider/
    TYPO3 Responsive Flipbook Extension: http://www.rutschmann.biz/extensions/typo3-responsive-flipbook/
    TYPO3 PayPal Download Checkout: http://www.rutschmann.biz/extensions/typo3-paypal-download/

    http://www.rutschmann.biz/
    ----------------------------------------------------
    Extbase, Fluid, HTML & CSS Development

  • 1