diff --git a/model/class.tx_ttproducts_table_base.php b/model/class.tx_ttproducts_table_base.php index 63f5a7aff..60636e172 100755 --- a/model/class.tx_ttproducts_table_base.php +++ b/model/class.tx_ttproducts_table_base.php @@ -71,7 +71,9 @@ abstract class tx_ttproducts_table_base implements \TYPO3\CMS\Core\SingletonInte 'endtime' => 'tx_ttproducts_field_datetime', 'graduated_price_uid' => 'tx_ttproducts_field_graduated_price', 'image' => 'tx_ttproducts_field_image', + 'image_uid' => 'tx_ttproducts_field_image', 'smallimage' => 'tx_ttproducts_field_image', + 'smallimage_uid' => 'tx_ttproducts_field_image', 'itemnumber' => 'tx_ttproducts_field_text', 'note' => 'tx_ttproducts_field_note', 'note2' => 'tx_ttproducts_field_note', diff --git a/model/field/class.tx_ttproducts_field_media.php b/model/field/class.tx_ttproducts_field_media.php index f6e429d43..f8d12e9b0 100755 --- a/model/field/class.tx_ttproducts_field_media.php +++ b/model/field/class.tx_ttproducts_field_media.php @@ -38,6 +38,8 @@ */ +use TYPO3\CMS\Core\Utility\GeneralUtility; + class tx_ttproducts_field_media extends tx_ttproducts_field_base { @@ -70,7 +72,6 @@ public function getFileArray ( $sysfileRowArray = array(); if ( - $tablename == 'tt_products' && isset($imageRow['ext']) && is_array($imageRow['ext']) && isset($imageRow['ext']['tt_products_articles']) && diff --git a/view/class.tx_ttproducts_article_base_view.php b/view/class.tx_ttproducts_article_base_view.php index 893f2399f..7dc9b8123 100755 --- a/view/class.tx_ttproducts_article_base_view.php +++ b/view/class.tx_ttproducts_article_base_view.php @@ -142,12 +142,12 @@ public function getPriceMarkerArray ($basketExtra, &$markerArray, $row, $markerK */ public function getModelMarkerArray ( &$row, - $markerKey, + $markerParam, &$markerArray, $catTitle, $imageNum=0, $imageRenderObj='image', - &$tagArray, + $tagArray, $forminfoArray=array(), $theCode='', $basketExtra=array(), @@ -157,7 +157,7 @@ public function getModelMarkerArray ( $linkWrap='', $bHtml=true, $charset='' - ) { + ) { $modelObj = $this->getModelObj(); $imageObj = GeneralUtility::makeInstance('tx_ttproducts_field_image_view'); @@ -173,7 +173,7 @@ public function getModelMarkerArray ( $variantFieldArray = $modelObj->variant->getFieldArray(); $variantMarkerArray = array(); - $this->getRowMarkerArray ( + $this->getRowMarkerArray( $row, $marker, $markerArray, diff --git a/view/class.tx_ttproducts_basket_view.php b/view/class.tx_ttproducts_basket_view.php index b8f3e3608..1c1df82c2 100755 --- a/view/class.tx_ttproducts_basket_view.php +++ b/view/class.tx_ttproducts_basket_view.php @@ -342,7 +342,6 @@ public function getView ( $articleViewTagArray, $articleParentArray ); - $prodUidField = $cnf->getTableDesc($articleTable->getTableObj()->name, 'uid_product'); $fieldsArray = array_merge($fieldsArray, $articleFieldsArray); $uidKey = array_search($prodUidField, $fieldsArray); @@ -536,7 +535,6 @@ public function getView ( $bHtml, 'UTF-8' ); - $articleViewObj->getItemMarkerSubpartArrays( $t['item'], $articleViewObj->getModelObj()->getFuncTablename(), @@ -645,7 +643,6 @@ public function getView ( $subpartArray, $wrappedSubpartArray ); - $tempContent = $parser->substituteMarkerArray( $tempContent, $markerArray diff --git a/view/class.tx_ttproducts_list_view.php b/view/class.tx_ttproducts_list_view.php index afbe892ad..9f6046191 100755 --- a/view/class.tx_ttproducts_list_view.php +++ b/view/class.tx_ttproducts_list_view.php @@ -1896,8 +1896,10 @@ class_exists('t3lib_utility_Math') ? // use the product if no article row has been found if ($articleRow) { $itemTable->mergeAttributeFields($prodVariantRow, $articleRow, false); - } - + $prodVariantRow['ext']['tt_products_articles'][] = $articleRow; + } else { + $prodVariantRow['ext']['tt_products_articles'] = array(); + } $itemTableView->getModelMarkerArray( $prodVariantRow, $itemTableViewArray['article']->getMarker(), diff --git a/view/class.tx_ttproducts_product_view.php b/view/class.tx_ttproducts_product_view.php index a8e5928b7..ccf046c19 100755 --- a/view/class.tx_ttproducts_product_view.php +++ b/view/class.tx_ttproducts_product_view.php @@ -143,7 +143,7 @@ public function getModelMarkerArray ( $catTitle, $imageNum=0, $imageRenderObj='image', - &$tagArray, + $tagArray, $forminfoArray=array(), $theCode='', $basketExtra=array(), @@ -153,7 +153,7 @@ public function getModelMarkerArray ( $linkWrap='', $bHtml=true, $charset='' - ) { + ) { // Returns a markerArray ready for substitution with information for the tt_producst record, $row $tablesObj = GeneralUtility::makeInstance('tx_ttproducts_tables'); $modelObj = $this->getModelObj (); @@ -184,8 +184,7 @@ public function getModelMarkerArray ( $bHtml, $charset ); -// Todo: das mit datasheet hier löschen - +// Todo: remove datasheet part from here: $datafieldViewObj = $this->getFieldObj('datasheet'); if (isset($datafieldViewObj) && is_object($datafieldViewObj)) { $datafieldViewObj->getRowMarkerArray( @@ -400,5 +399,3 @@ public function getModelMarkerArray ( include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/tt_products/view/class.tx_ttproducts_product_view.php']); } - - diff --git a/view/class.tx_ttproducts_single_view.php b/view/class.tx_ttproducts_single_view.php index a5977fcba..8d2a77409 100755 --- a/view/class.tx_ttproducts_single_view.php +++ b/view/class.tx_ttproducts_single_view.php @@ -528,6 +528,14 @@ public function printView (&$templateCode, &$errorCode, $pageAsCategory, $templa $row['inStock'] = $articleRow['inStock']; } } + + if ( + !empty($articleRow) && + isset($prodVariantRow['ext']) && + !isset($prodVariantRow['ext']['tt_products_articles']) + ) { + $prodVariantRow['ext']['tt_products_articles'][] = $articleRow; + } $itemTableViewArray[$this->type]->getModelMarkerArray( $row, diff --git a/view/field/class.tx_ttproducts_field_image_view.php b/view/field/class.tx_ttproducts_field_image_view.php index fb22be0ea..aafa0f665 100755 --- a/view/field/class.tx_ttproducts_field_image_view.php +++ b/view/field/class.tx_ttproducts_field_image_view.php @@ -99,7 +99,6 @@ public function getRowMarkerArrayEnhanced ( if ($mediaNum > 0) { $imageNum = $mediaNum; } -// hack end $imageRow = $row; $bImages = false; @@ -300,7 +299,6 @@ public function getRowMarkerArrayEnhanced ( } } } - // empty all image fields with no available image foreach ($tagArray as $value => $k1) { $keyMarker = '###'.$value.'###'; diff --git a/view/field/class.tx_ttproducts_field_media_view.php b/view/field/class.tx_ttproducts_field_media_view.php index 5cc2aedd2..562a2e6ae 100755 --- a/view/field/class.tx_ttproducts_field_media_view.php +++ b/view/field/class.tx_ttproducts_field_media_view.php @@ -212,32 +212,62 @@ public function getCodeMarkerArray ( } foreach($imageArray as $c => $val) { - $imageConf = $imageConfStart; if ($c == $mediaNum) { break; } $bUseImage = false; $meta = false; - if ($val) { - $imageConf['file'] = $dirname.$val; - $bUseImage = true; + if (!empty($val)) { + $filename = ''; + if (is_array($val)) { + if (isset($val['name'])) { + $filename = 'fileadmin' . $val['identifier']; + } + } else { + $filename = $dirname . $val; + } + $imageConfFile = $filename; } if (!$this->conf['separateImage']) { $key = 0; // show all images together as one image + } else if (is_array($val)) { + $key = $val['name']; } else { - $key = ($val ? $val : $c); + $key = (!empty($val) ? $val : $c); } - $tagkey = ''; if ($val) { $tagkey = $this->getMarkerkey($imageMarkerArray, $markerKey, $key, $c + 1); } - + if (is_array($val)) { + $meta = $val; + } + $cObj->alternativeData = ($meta ? $meta : $imageRow); - $imageConf['params'] = preg_replace('/\s+/',' ',$imageConf['params']); - $this->replaceMarkerArray($markerArray, $imageConf, $cObj->alternativeData); + $imageConf['params'] = preg_replace('/\s+/', ' ', $imageConf['params']); + if (!isset($imageConf['altText']) && isset($cObj->alternativeData['alternative'])) { + $imageConf['altText'] = $cObj->alternativeData['alternative']; + } + if (!isset($imageConf['titleText']) && isset($cObj->alternativeData['title'])) { + $imageConf['titleText'] = $cObj->alternativeData['title']; + } + + $bGifBuilder = ($imageConf['file'] == 'GIFBUILDER'); + if (isset($imageConfFile)) { + $imageConf['file'] = $imageConfFile; + } + $filename = ''; + if (is_array($val)) { + $filename = $imageConfFile; + } else { + $filename = $val; + } + + $markerArray['###FILE###'] = $filename; + + $this->replaceMarkerArray($markerArray, $imageConf, $cObj->alternativeData); $tmpImgCode = $this->getImageCode($imageConf, $theCode); if ($tmpImgCode != '') { @@ -267,7 +297,6 @@ public function getCodeMarkerArray ( $imgCodeArray[0] = $cObj->stdWrap($imgCodeArray[0], $tableConf['joinedImagesWrap.']); } } - return $imgCodeArray; } @@ -412,7 +441,7 @@ private function getMediaMarkerArray ( } // if (!$bImages) { if (!$bImages) { - $imgs = $this->getModelObj()->getFileArray($theTablename, $imageRow, $fieldname, true); + $imgs = $this->getModelObj()->getFileArray($functablename, $imageRow, $fieldname, true); } $specialConf = array(); @@ -454,7 +483,6 @@ private function getMediaMarkerArray ( $c = 1; $countArray = array(); - foreach($theImgCode as $k1 => $val) { $bIsSpecial = true; @@ -558,7 +586,6 @@ public function getRowMarkerArray ( $fieldname, $theCode ); - if ($mediaNum) { $this->getMediaMarkerArray(