source/Application/Controller/Admin/ActionsMainAjax.php
public function addArtToAct()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aArticles = $this->_getActionIds('oxarticles.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        $this->_getOxRssFeed()->removeCacheFile($soxId);

        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sArtTable = $this->_getViewName('oxarticles');
            $aArticles = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
        }

        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $sArtTable = $this->_getViewName('oxarticles');
        $sQ = "select max(oxactions2article.oxsort) from oxactions2article join {$sArtTable} " .
              "on {$sArtTable}.oxid=oxactions2article.oxartid " .
              "where oxactions2article.oxactionid = " . $database->quote($soxId) .
              " and oxactions2article.oxshopid = '" . $myConfig->getShopId() .
              "'and $sArtTable.oxid is not null";

        $iSort = ((int) $database->getOne($sQ)) + 1;

        $articleAdded = false;
        if ($soxId && $soxId != "-1" && is_array($aArticles)) {
            $sShopId = $myConfig->getShopId();
            foreach ($aArticles as $sAdd) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oNewGroup->init('oxactions2article');
                $oNewGroup->oxactions2article__oxshopid = new \OxidEsales\Eshop\Core\Field($sShopId);
                $oNewGroup->oxactions2article__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oNewGroup->oxactions2article__oxartid = new \OxidEsales\Eshop\Core\Field($sAdd);
                $oNewGroup->oxactions2article__oxsort = new \OxidEsales\Eshop\Core\Field($iSort++);
                $oNewGroup->save();
            }
            $articleAdded = true;
        }

        return $articleAdded;
    }
public function addArtToAct()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aArticles = $this->_getActionIds('oxarticles.oxid');
        $soxId = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('synchoxid');

        $this->_getOxRssFeed()->removeCacheFile($soxId);

        if (\OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('all')) {
            $sArtTable = $this->_getViewName('oxarticles');
            $aArticles = $this->_getAll($this->_addFilter("select $sArtTable.oxid " . $this->_getQuery()));
        }

        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822).
        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $sArtTable = $this->_getViewName('oxarticles');
        $sQ = "select max(oxactions2article.oxsort) from oxactions2article join {$sArtTable} " .
              "on {$sArtTable}.oxid=oxactions2article.oxartid " .
              "where oxactions2article.oxactionid = " . $database->quote($soxId) .
              " and oxactions2article.oxshopid = '" . $myConfig->getShopId() .
              "'and $sArtTable.oxid is not null";

        $iSort = ((int) $database->getOne($sQ)) + 1;

        $articleAdded = false;
        if ($soxId && $soxId != "-1" && is_array($aArticles)) {
            $sShopId = $myConfig->getShopId();
            foreach ($aArticles as $sAdd) {
                $oNewGroup = oxNew(\OxidEsales\Eshop\Core\Model\BaseModel::class);
                $oNewGroup->init('oxactions2article');
                $oNewGroup->oxactions2article__oxshopid = new \OxidEsales\Eshop\Core\Field($sShopId);
                $oNewGroup->oxactions2article__oxactionid = new \OxidEsales\Eshop\Core\Field($soxId);
                $oNewGroup->oxactions2article__oxartid = new \OxidEsales\Eshop\Core\Field($sAdd);
                $oNewGroup->oxactions2article__oxsort = new \OxidEsales\Eshop\Core\Field($iSort++);
                $oNewGroup->save();
            }
            $articleAdded = true;
        }

        return $articleAdded;
    }
public function addArtToAct ( ) { $ myConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ aArticles = $ this -> _getActionIds ( 'oxarticles.oxid' ) ; $ soxId = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'synchoxid' ) ; $ this -> _getOxRssFeed ( ) -> removeCacheFile ( $ soxId ) ; if ( \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) -> getRequestParameter ( 'all' ) ) { $ sArtTable = $ this -> _getViewName ( 'oxarticles' ) ; $ aArticles = $ this -> _getAll ( $ this -> _addFilter ( "select $sArtTable.oxid " . $ this -> _getQuery ( ) ) ) ; } // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804 and ESDEV-3822). $ database = \ OxidEsales \ Eshop \ Core \ DatabaseProvider :: getMaster ( ) ; $ sArtTable = $ this -> _getViewName ( 'oxarticles' ) ; $ sQ = "select max(oxactions2article.oxsort) from oxactions2article join {$sArtTable} " . "on {$sArtTable}.oxid=oxactions2article.oxartid " . "where oxactions2article.oxactionid = " . $ database -> quote ( $ soxId ) . " and oxactions2article.oxshopid = '" . $ myConfig -> getShopId ( ) . "'and $sArtTable.oxid is not null" ; $ iSort = ( ( int ) $ database -> getOne ( $ sQ ) ) + 1 ; $ articleAdded = false ; if ( $ soxId && $ soxId != "-1" && is_array ( $ aArticles ) ) { $ sShopId = $ myConfig -> getShopId ( ) ; foreach ( $ aArticles as $ sAdd ) { $ oNewGroup = oxNew ( \ OxidEsales \ Eshop \ Core \ Model \ BaseModel :: class ) ; $ oNewGroup -> init ( 'oxactions2article' ) ; $ oNewGroup -> oxactions2article__oxshopid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sShopId ) ; $ oNewGroup -> oxactions2article__oxactionid = new \ OxidEsales \ Eshop \ Core \ Field ( $ soxId ) ; $ oNewGroup -> oxactions2article__oxartid = new \ OxidEsales \ Eshop \ Core \ Field ( $ sAdd ) ; $ oNewGroup -> oxactions2article__oxsort = new \ OxidEsales \ Eshop \ Core \ Field ( $ iSort ++ ) ; $ oNewGroup -> save ( ) ; } $ articleAdded = true ; } return $ articleAdded ; }
Adds article to Promotions list

@return bool Whether any article was added to action.

@throws Exception
Adds article to Promotions list