Example #1
0
 /**
  * Load the deliveryArticle.
  *
  * @param \CommerceTeam\Commerce\Domain\Model\Article $article Article
  *
  * @return \CommerceTeam\Commerce\Domain\Model\Article $result
  */
 protected function getDeliveryArticle(\CommerceTeam\Commerce\Domain\Model\Article &$article)
 {
     $deliveryConf = SettingsFactory::getInstance()->getConfiguration('SYSPRODUCTS.DELIVERY.types');
     $classname = array_shift(array_keys($deliveryConf));
     /**
      * Article repository.
      *
      * @var ArticleRepository
      */
     $articleRepository = GeneralUtility::makeInstance('CommerceTeam\\Commerce\\Domain\\Repository\\ArticleRepository');
     $row = $articleRepository->findByClassname($classname);
     $result = false;
     if (!empty($row)) {
         /**
          * Instantiate article class.
          *
          * @var \CommerceTeam\Commerce\Domain\Model\Article $deliveryArticle
          */
         $deliveryArticle = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('CommerceTeam\\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 ending recursion
          */
         if (is_object($deliveryArticle)) {
             $deliveryArticle->loadPrices();
         }
         $result = $deliveryArticle;
     }
     return $result;
 }