Пример #1
0
 /**
  * Reders an element as output.
  *
  * @param AbstractEntity $element Element
  * @param string $subpartName Template subpart name
  * @param array $typoscript TypoScript array for rendering
  * @param string $prefix Prefix for Marker, optional#
  * @param string $markerWrap SecondPrefix for Marker, default ###
  * @param string $template Template
  *
  * @return string HTML-Content
  */
 public function renderElement(AbstractEntity $element, $subpartName, array $typoscript, $prefix = '', $markerWrap = '###', $template = '')
 {
     if (empty($subpartName)) {
         return $this->error('renderElement', __LINE__, 'No supart defined for class.CommerceTeam\\Commerce\\Controller\\BaseController::renderElement');
     }
     if (strlen($template) < 1) {
         $template = $this->template;
     }
     if (empty($template)) {
         return $this->error('renderElement', __LINE__, 'No Template given as parameter to method and no template loaded via TS');
     }
     $output = $this->cObj->getSubpart($template, $subpartName);
     if (empty($output)) {
         return $this->error('renderElement', __LINE__, 'class.tx_commerce_pibase::renderElement: Subpart:' . $subpartName . ' not found in HTML-Code', $template);
     }
     $data = $element->returnAssocArray();
     $markerArray = $this->generateMarkerArray($data, $typoscript);
     $hooks = HookFactory::getHooks('Controller/BaseController', 'renderElement');
     foreach ($hooks as $hook) {
         if (method_exists($hook, 'additionalMarkerElement')) {
             $markerArray = $hook->additionalMarkerElement($markerArray, $element, $this);
         }
     }
     if ($prefix > '') {
         $markerWrap .= strtoupper($prefix) . '_';
     }
     $markerWrap .= '|###';
     if (is_array($markerArray) && !empty($markerArray)) {
         $output = $this->cObj->substituteMarkerArray($output, $markerArray, $markerWrap, 1);
         $output = $this->cObj->stdWrap($output, $typoscript['stdWrap.']);
     } else {
         $output = '';
     }
     return $output;
 }
Пример #2
0
 /**
  * Load data and divide comma sparated images in array
  * inherited from parent.
  *
  * @param mixed $translationMode Translation mode of the record,
  *     default FALSE to use the default way of translation
  *
  * @return \CommerceTeam\Commerce\Domain\Model\Product
  */
 public function loadData($translationMode = false)
 {
     $return = parent::loadData($translationMode);
     $this->images_array = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->images);
     $this->teaserImagesArray = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->teaserimages);
     return $return;
 }
Пример #3
0
 /**
  * Loads the data.
  *
  * @param bool $translationMode Translation mode of the record,
  *      default FALSE to use the default way of translation
  *
  * @return void
  */
 public function loadData($translationMode = false)
 {
     if ($this->data_loaded == false) {
         parent::loadData($translationMode);
         $this->images_array = GeneralUtility::trimExplode(',', $this->images, true);
         $this->teaserImagesArray = GeneralUtility::trimExplode(',', $this->teaserimages, true);
         $this->categories_uid = array_unique($this->databaseConnection->getChildCategories($this->uid, $this->lang_uid));
         $this->parent_category_uid = $this->databaseConnection->getParentCategory($this->uid);
         $this->products_uid = array_unique($this->databaseConnection->getChildProducts($this->uid, $this->lang_uid));
         $this->data_loaded = true;
     }
 }
Пример #4
0
 /**
  * Returns the data of this object als array.
  *
  * @param string $prefix Prefix for the keys or returnung array optional
  *
  * @return array Assoc Arry of data
  */
 public function returnAssocArray($prefix = '')
 {
     $data = parent::returnAssocArray($prefix);
     $data[$prefix . 'stock'] = $this->getStock();
     return $data;
 }