source/Application/Model/OrderArticle.php
public function _setOrderFiles()
    {
        $oArticle = $this->getArticle();

        if ($oArticle->oxarticles__oxisdownloadable->value) {
            $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
            $sOrderId = $this->oxorderarticles__oxorderid->value;
            $sOrderArticleId = $this->getId();
            $sShopId = $oConfig->getShopId();

            $oUser = $oConfig->getUser();

            $oFiles = $oArticle->getArticleFiles(true);

            if ($oFiles) {
                foreach ($oFiles as $oFile) {
                    $oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
                    $oOrderFile->setOrderId($sOrderId);
                    $oOrderFile->setOrderArticleId($sOrderArticleId);
                    $oOrderFile->setShopId($sShopId);
                    $iMaxDownloadCount = (!empty($oUser) && !$oUser->hasAccount()) ? $oFile->getMaxUnregisteredDownloadsCount() : $oFile->getMaxDownloadsCount();
                    $oOrderFile->setFile(
                        $oFile->oxfiles__oxfilename->value,
                        $oFile->getId(),
                        $iMaxDownloadCount * $this->oxorderarticles__oxamount->value,
                        $oFile->getLinkExpirationTime(),
                        $oFile->getDownloadExpirationTime()
                    );

                    $oOrderFile->save();
                }
            }
        }
    }
public function _setOrderFiles()
    {
        $oArticle = $this->getArticle();

        if ($oArticle->oxarticles__oxisdownloadable->value) {
            $oConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
            $sOrderId = $this->oxorderarticles__oxorderid->value;
            $sOrderArticleId = $this->getId();
            $sShopId = $oConfig->getShopId();

            $oUser = $oConfig->getUser();

            $oFiles = $oArticle->getArticleFiles(true);

            if ($oFiles) {
                foreach ($oFiles as $oFile) {
                    $oOrderFile = oxNew(\OxidEsales\Eshop\Application\Model\OrderFile::class);
                    $oOrderFile->setOrderId($sOrderId);
                    $oOrderFile->setOrderArticleId($sOrderArticleId);
                    $oOrderFile->setShopId($sShopId);
                    $iMaxDownloadCount = (!empty($oUser) && !$oUser->hasAccount()) ? $oFile->getMaxUnregisteredDownloadsCount() : $oFile->getMaxDownloadsCount();
                    $oOrderFile->setFile(
                        $oFile->oxfiles__oxfilename->value,
                        $oFile->getId(),
                        $iMaxDownloadCount * $this->oxorderarticles__oxamount->value,
                        $oFile->getLinkExpirationTime(),
                        $oFile->getDownloadExpirationTime()
                    );

                    $oOrderFile->save();
                }
            }
        }
    }
public function _setOrderFiles ( ) { $ oArticle = $ this -> getArticle ( ) ; if ( $ oArticle -> oxarticles__oxisdownloadable -> value ) { $ oConfig = \ OxidEsales \ Eshop \ Core \ Registry :: getConfig ( ) ; $ sOrderId = $ this -> oxorderarticles__oxorderid -> value ; $ sOrderArticleId = $ this -> getId ( ) ; $ sShopId = $ oConfig -> getShopId ( ) ; $ oUser = $ oConfig -> getUser ( ) ; $ oFiles = $ oArticle -> getArticleFiles ( true ) ; if ( $ oFiles ) { foreach ( $ oFiles as $ oFile ) { $ oOrderFile = oxNew ( \ OxidEsales \ Eshop \ Application \ Model \ OrderFile :: class ) ; $ oOrderFile -> setOrderId ( $ sOrderId ) ; $ oOrderFile -> setOrderArticleId ( $ sOrderArticleId ) ; $ oOrderFile -> setShopId ( $ sShopId ) ; $ iMaxDownloadCount = ( ! empty ( $ oUser ) && ! $ oUser -> hasAccount ( ) ) ? $ oFile -> getMaxUnregisteredDownloadsCount ( ) : $ oFile -> getMaxDownloadsCount ( ) ; $ oOrderFile -> setFile ( $ oFile -> oxfiles__oxfilename -> value , $ oFile -> getId ( ) , $ iMaxDownloadCount * $ this -> oxorderarticles__oxamount -> value , $ oFile -> getLinkExpirationTime ( ) , $ oFile -> getDownloadExpirationTime ( ) ) ; $ oOrderFile -> save ( ) ; } } } }
Set order files
Set order files