コード例 #1
0
ファイル: ArticleHooks.php プロジェクト: AndreasA/commerce
 /**
  * Load the deliveryArticle
  *
  * @param Tx_Commerce_Domain_Model_Article $article Article
  *
  * @return Tx_Commerce_Domain_Model_Article $result
  */
 protected function getDeliveryArticle(Tx_Commerce_Domain_Model_Article &$article)
 {
     $deliveryConf = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF'][COMMERCE_EXTKEY]['SYSPRODUCTS']['DELIVERY']['types'];
     $classname = array_shift(array_keys($deliveryConf));
     $database = $this->getDatabaseConnection();
     $row = $database->exec_SELECTgetSingleRow('uid', 'tx_commerce_articles', 'classname = \'' . $classname . '\'');
     $result = FALSE;
     if (!empty($row)) {
         /**
          * Instantiate article class
          *
          * @var Tx_Commerce_Domain_Model_Article $deliveryArticle
          */
         $deliveryArticle = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('Tx_Commerce_Domain_Model_Article', $row['uid'], $article->getLang());
         /**
          * Do not call loadData at this point, since loadData recalls this hook,
          * so we have a non endingrecursion
          */
         if (is_object($deliveryArticle)) {
             $deliveryArticle->loadPrices();
         }
         $result = $deliveryArticle;
     }
     return $result;
 }