source/Application/Model/OrderFile.php
public function processOrderFile()
    {
        if ($this->isValid()) {
            //first download
            if (!$this->oxorderfiles__oxdownloadcount->value) {
                $this->oxorderfiles__oxdownloadcount = new \OxidEsales\Eshop\Core\Field(1);

                $iExpirationTime = $this->oxorderfiles__oxdownloadexpirationtime->value * 3600;
                $iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
                $this->oxorderfiles__oxvaliduntil = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime + $iExpirationTime));

                $this->oxorderfiles__oxfirstdownload = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime));
                $this->oxorderfiles__oxlastdownload = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime));
            } else {
                $this->oxorderfiles__oxdownloadcount = new \OxidEsales\Eshop\Core\Field($this->oxorderfiles__oxdownloadcount->value + 1);

                $iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
                $this->oxorderfiles__oxlastdownload = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime));
            }
            $this->save();

            return $this->oxorderfiles__oxfileid->value;
        }

        return false;
    }
public function processOrderFile()
    {
        if ($this->isValid()) {
            //first download
            if (!$this->oxorderfiles__oxdownloadcount->value) {
                $this->oxorderfiles__oxdownloadcount = new \OxidEsales\Eshop\Core\Field(1);

                $iExpirationTime = $this->oxorderfiles__oxdownloadexpirationtime->value * 3600;
                $iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
                $this->oxorderfiles__oxvaliduntil = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime + $iExpirationTime));

                $this->oxorderfiles__oxfirstdownload = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime));
                $this->oxorderfiles__oxlastdownload = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime));
            } else {
                $this->oxorderfiles__oxdownloadcount = new \OxidEsales\Eshop\Core\Field($this->oxorderfiles__oxdownloadcount->value + 1);

                $iTime = \OxidEsales\Eshop\Core\Registry::getUtilsDate()->getTime();
                $this->oxorderfiles__oxlastdownload = new \OxidEsales\Eshop\Core\Field(date('Y-m-d H:i:s', $iTime));
            }
            $this->save();

            return $this->oxorderfiles__oxfileid->value;
        }

        return false;
    }
public function processOrderFile ( ) { if ( $ this -> isValid ( ) ) { //first download if ( ! $ this -> oxorderfiles__oxdownloadcount -> value ) { $ this -> oxorderfiles__oxdownloadcount = new \ OxidEsales \ Eshop \ Core \ Field ( 1 ) ; $ iExpirationTime = $ this -> oxorderfiles__oxdownloadexpirationtime -> value * 3600 ; $ iTime = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ this -> oxorderfiles__oxvaliduntil = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d H:i:s' , $ iTime + $ iExpirationTime ) ) ; $ this -> oxorderfiles__oxfirstdownload = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d H:i:s' , $ iTime ) ) ; $ this -> oxorderfiles__oxlastdownload = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d H:i:s' , $ iTime ) ) ; } else { $ this -> oxorderfiles__oxdownloadcount = new \ OxidEsales \ Eshop \ Core \ Field ( $ this -> oxorderfiles__oxdownloadcount -> value + 1 ) ; $ iTime = \ OxidEsales \ Eshop \ Core \ Registry :: getUtilsDate ( ) -> getTime ( ) ; $ this -> oxorderfiles__oxlastdownload = new \ OxidEsales \ Eshop \ Core \ Field ( date ( 'Y-m-d H:i:s' , $ iTime ) ) ; } $ this -> save ( ) ; return $ this -> oxorderfiles__oxfileid -> value ; } return false ; }
Checks if download link is valid, changes count, if first download changes valid until

@return bool
Checks if download link is valid changes count if first download changes valid until