src/ShopBundle/objects/WebModules/MTShopBasketCore/MTShopBasketCoreEndpoint.class.php
public function AddToNoticeList($iArticleId = null, $iAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
    {
        $oGlobal = TGlobal::instance();
        $aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
        if (is_null($iArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
            $iArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
            if (empty($iArticleId)) {
                $iArticleId = null;
            }
        }
        if (is_null($iAmount) && array_key_exists(self::URL_ITEM_AMOUNT_NAME, $aRequestData)) {
            $iAmount = $aRequestData[self::URL_ITEM_AMOUNT_NAME];
            if (empty($iAmount)) {
                $iAmount = 1;
            }
        }

        if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
            $sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
            if (empty($sMessageHandler)) {
                $sMessageHandler = null;
            }
        }
        if (is_null($sMessageHandler)) {
            $sMessageHandler = self::MSG_CONSUMER_NAME;
        }

        $oMsgManager = TCMSMessageManager::GetInstance();
        if (is_null($iArticleId)) {
            $oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-ADD-ITEM-NO-ID-GIVEN');
        } else {
            $oItem = TdbShopArticle::GetNewInstance();
            /** @var $oItem TdbShopArticle */
            if ($oItem->Load($iArticleId)) {
                $oShop = TdbShop::GetInstance();
                // add item to list
                $oUser = TdbDataExtranetUser::GetInstance();
                $dNewAmountOnList = $oUser->AddArticleIdToNoticeList($iArticleId, $iAmount);
                $aInfoData = array('sLinkNoticeListStart' => '<a href="'.$oShop->GetLinkToSystemPage('noticelist').'">', 'sLinkNoticeListEnd' => '</a>', 'sLinkArticleStart' => '<a href="'.$oItem->GetDetailLink().'">', 'sLinkArticleEnd' => '</a>', 'sArticleName' => TGlobal::OutHTML($oItem->GetName()), 'dAddedAmount' => $iAmount, 'dNewAmount' => $dNewAmountOnList, 'sArticleAddedId' => $oItem->id);
                if (false === $dNewAmountOnList) {
                    // article was already on notice list...
                    $oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ITEM-ALREADY-ON-LIST', $aInfoData);
                } else {
                    $oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ADDED-ITEM', $aInfoData);
                }
            } else {
                $oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-INVALID-ITEM-ID');
            }
        }

        // now redirect either to requested page, or to calling page
        $iRedirectNodeId = null;
        if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
            $iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
            if (empty($iRedirectNodeId)) {
                $iRedirectNodeId = null;
            }
        }

        if (!$bIsInternalCall) {
            $this->RedirectAfterEvent($iRedirectNodeId);
        }
    }
public function AddToNoticeList($iArticleId = null, $iAmount = null, $sMessageHandler = null, $bIsInternalCall = false)
    {
        $oGlobal = TGlobal::instance();
        $aRequestData = $oGlobal->GetUserData(self::URL_REQUEST_PARAMETER);
        if (is_null($iArticleId) && array_key_exists(self::URL_ITEM_ID_NAME, $aRequestData)) {
            $iArticleId = $aRequestData[self::URL_ITEM_ID_NAME];
            if (empty($iArticleId)) {
                $iArticleId = null;
            }
        }
        if (is_null($iAmount) && array_key_exists(self::URL_ITEM_AMOUNT_NAME, $aRequestData)) {
            $iAmount = $aRequestData[self::URL_ITEM_AMOUNT_NAME];
            if (empty($iAmount)) {
                $iAmount = 1;
            }
        }

        if (is_null($sMessageHandler) && array_key_exists(self::URL_MESSAGE_CONSUMER_NAME, $aRequestData)) {
            $sMessageHandler = $aRequestData[self::URL_MESSAGE_CONSUMER_NAME];
            if (empty($sMessageHandler)) {
                $sMessageHandler = null;
            }
        }
        if (is_null($sMessageHandler)) {
            $sMessageHandler = self::MSG_CONSUMER_NAME;
        }

        $oMsgManager = TCMSMessageManager::GetInstance();
        if (is_null($iArticleId)) {
            $oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-ADD-ITEM-NO-ID-GIVEN');
        } else {
            $oItem = TdbShopArticle::GetNewInstance();
            /** @var $oItem TdbShopArticle */
            if ($oItem->Load($iArticleId)) {
                $oShop = TdbShop::GetInstance();
                // add item to list
                $oUser = TdbDataExtranetUser::GetInstance();
                $dNewAmountOnList = $oUser->AddArticleIdToNoticeList($iArticleId, $iAmount);
                $aInfoData = array('sLinkNoticeListStart' => '<a href="'.$oShop->GetLinkToSystemPage('noticelist').'">', 'sLinkNoticeListEnd' => '</a>', 'sLinkArticleStart' => '<a href="'.$oItem->GetDetailLink().'">', 'sLinkArticleEnd' => '</a>', 'sArticleName' => TGlobal::OutHTML($oItem->GetName()), 'dAddedAmount' => $iAmount, 'dNewAmount' => $dNewAmountOnList, 'sArticleAddedId' => $oItem->id);
                if (false === $dNewAmountOnList) {
                    // article was already on notice list...
                    $oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ITEM-ALREADY-ON-LIST', $aInfoData);
                } else {
                    $oMsgManager->AddMessage($sMessageHandler, 'NOTICE-LIST-ADDED-ITEM', $aInfoData);
                }
            } else {
                $oMsgManager->AddMessage($sMessageHandler, 'ERROR-SHOP-NOTICE-LIST-INVALID-ITEM-ID');
            }
        }

        // now redirect either to requested page, or to calling page
        $iRedirectNodeId = null;
        if (array_key_exists(self::URL_REDIRECT_NODE_ID_NAME, $aRequestData)) {
            $iRedirectNodeId = $aRequestData[self::URL_REDIRECT_NODE_ID_NAME];
            if (empty($iRedirectNodeId)) {
                $iRedirectNodeId = null;
            }
        }

        if (!$bIsInternalCall) {
            $this->RedirectAfterEvent($iRedirectNodeId);
        }
    }
public function AddToNoticeList ( $ iArticleId = null , $ iAmount = null , $ sMessageHandler = null , $ bIsInternalCall = false ) { $ oGlobal = TGlobal :: instance ( ) ; $ aRequestData = $ oGlobal -> GetUserData ( self :: URL_REQUEST_PARAMETER ) ; if ( is_null ( $ iArticleId ) && array_key_exists ( self :: URL_ITEM_ID_NAME , $ aRequestData ) ) { $ iArticleId = $ aRequestData [ self :: URL_ITEM_ID_NAME ] ; if ( empty ( $ iArticleId ) ) { $ iArticleId = null ; } } if ( is_null ( $ iAmount ) && array_key_exists ( self :: URL_ITEM_AMOUNT_NAME , $ aRequestData ) ) { $ iAmount = $ aRequestData [ self :: URL_ITEM_AMOUNT_NAME ] ; if ( empty ( $ iAmount ) ) { $ iAmount = 1 ; } } if ( is_null ( $ sMessageHandler ) && array_key_exists ( self :: URL_MESSAGE_CONSUMER_NAME , $ aRequestData ) ) { $ sMessageHandler = $ aRequestData [ self :: URL_MESSAGE_CONSUMER_NAME ] ; if ( empty ( $ sMessageHandler ) ) { $ sMessageHandler = null ; } } if ( is_null ( $ sMessageHandler ) ) { $ sMessageHandler = self :: MSG_CONSUMER_NAME ; } $ oMsgManager = TCMSMessageManager :: GetInstance ( ) ; if ( is_null ( $ iArticleId ) ) { $ oMsgManager -> AddMessage ( $ sMessageHandler , 'ERROR-SHOP-NOTICE-LIST-ADD-ITEM-NO-ID-GIVEN' ) ; } else { $ oItem = TdbShopArticle :: GetNewInstance ( ) ; /** @var $oItem TdbShopArticle */ if ( $ oItem -> Load ( $ iArticleId ) ) { $ oShop = TdbShop :: GetInstance ( ) ; // add item to list $ oUser = TdbDataExtranetUser :: GetInstance ( ) ; $ dNewAmountOnList = $ oUser -> AddArticleIdToNoticeList ( $ iArticleId , $ iAmount ) ; $ aInfoData = array ( 'sLinkNoticeListStart' => '<a href="' . $ oShop -> GetLinkToSystemPage ( 'noticelist' ) . '">' , 'sLinkNoticeListEnd' => '</a>' , 'sLinkArticleStart' => '<a href="' . $ oItem -> GetDetailLink ( ) . '">' , 'sLinkArticleEnd' => '</a>' , 'sArticleName' => TGlobal :: OutHTML ( $ oItem -> GetName ( ) ) , 'dAddedAmount' => $ iAmount , 'dNewAmount' => $ dNewAmountOnList , 'sArticleAddedId' => $ oItem -> id ) ; if ( false === $ dNewAmountOnList ) { // article was already on notice list... $ oMsgManager -> AddMessage ( $ sMessageHandler , 'NOTICE-LIST-ITEM-ALREADY-ON-LIST' , $ aInfoData ) ; } else { $ oMsgManager -> AddMessage ( $ sMessageHandler , 'NOTICE-LIST-ADDED-ITEM' , $ aInfoData ) ; } } else { $ oMsgManager -> AddMessage ( $ sMessageHandler , 'ERROR-SHOP-NOTICE-LIST-INVALID-ITEM-ID' ) ; } } // now redirect either to requested page, or to calling page $ iRedirectNodeId = null ; if ( array_key_exists ( self :: URL_REDIRECT_NODE_ID_NAME , $ aRequestData ) ) { $ iRedirectNodeId = $ aRequestData [ self :: URL_REDIRECT_NODE_ID_NAME ] ; if ( empty ( $ iRedirectNodeId ) ) { $ iRedirectNodeId = null ; } } if ( ! $ bIsInternalCall ) { $ this -> RedirectAfterEvent ( $ iRedirectNodeId ) ; } }
insert an item into the notice list.

@param int    $iArticleId      - if you pass null, it will attempt to fetch the item id from post
@param int    $iAmount         - amount to add
@param string $sMessageHandler - info passed to this handler - uses the default message consumer for the shop if non passed (can also be passed via get/post)
@param bool   $bIsInternalCall
insert an item into the notice list .