Example #1
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;
 }
Example #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 Tx_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;
 }
Example #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 = \TYPO3\CMS\Core\Utility\GeneralUtility::trimExplode(',', $this->images, TRUE);
         $this->teaserImagesArray = \TYPO3\CMS\Core\Utility\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;
     }
 }
Example #4
0
    /**
     * Reders an element as output
     *
     * @param Tx_Commerce_Domain_Model_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(Tx_Commerce_Domain_Model_AbstractEntity $element, $subpartName, array $typoscript, $prefix = '', $markerWrap = '###', $template = '')
    {
        if (empty($subpartName)) {
            return $this->error('renderElement', __LINE__, 'No supart defined for class.Tx_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);
        $hookObjectsArr = array();
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['generalElement'])) {
            GeneralUtility::deprecationLog('
				hook
				$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/lib/class.tx_commerce_pibase.php\'][\'generalElement\']
				is deprecated since commerce 1.0.0, it will be removed in commerce 1.4.0, please use instead
				$GLOBALS[\'TYPO3_CONF_VARS\'][\'EXTCONF\'][\'commerce/Classes/Controller/BaseController.php\'][\'generalElement\']
			');
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['generalElement'] as $classRef) {
                $hookObjectsArr[] =& GeneralUtility::getUserObj($classRef);
            }
        }
        if (is_array($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BaseController.php']['renderElement'])) {
            foreach ($GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/Classes/Controller/BaseController.php']['renderElement'] as $classRef) {
                $hookObjectsArr[] =& GeneralUtility::getUserObj($classRef);
            }
        }
        foreach ($hookObjectsArr as $hookObj) {
            if (method_exists($hookObj, 'additionalMarkerElement')) {
                $markerArray = $hookObj->additionalMarkerElement($markerArray, $element, $this);
            }
        }
        if ($prefix > '') {
            $markerWrap .= strtoupper($prefix) . '_';
        }
        $markerWrap .= '|###';
        if (is_array($markerArray) && count($markerArray)) {
            $output = $this->cObj->substituteMarkerArray($output, $markerArray, $markerWrap, 1);
            $output = $this->cObj->stdWrap($output, $typoscript['stdWrap.']);
        } else {
            $output = '';
        }
        return $output;
    }