Also: Bau dir im Kickstarter ein Grundgerüst für eine Extension, zb.: my_commerce_images
In die ext_localconf.php kommt:
PHP-Code:
# additionalMarkerProduct Hook
$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['commerce/lib/class.tx_commerce_pibase.php']['product'][] = 'EXT:my_commerce_images/class.tx_mycommerceimages.php:tx_mycommerceimages';
Und die aufgerufene Datei class.tx_mycommerceimages.php wird im Plugin neu angelegt:
PHP-Code:
<?php
class tx_mycommerceimages{
function additionalMarkerProduct($markerArray,$myProduct,$piObj){
$images = explode(',', $myProduct->getField('images'));
if ($piObj->piVars['showUid']) {
# single
$imgConf = $piObj->conf['singleView.']['products.']['fields.']['images.'];
$thumbConf = $piObj->conf['singleView.']['products.']['fields.']['additionalImgs.'];
} else {
# listView
$imgConf = $piObj->conf['listView.']['products.']['fields.']['images.'];
$thumbConf = $piObj->conf['listView.']['products.']['fields.']['additionalImgs.'];
}
# The first Image
$piObj->cObj->setCurrentVal($images[0]);
$markerArray['###PRODUCT_IMAGES###'] = $piObj->renderValue($images[0], 'IMAGE',$imgConf);
# additional Images in new Marker
$markerArray['###PRODUCT_ADDITIONALIMGS###'] = '';
for ($i=1; $i<sizeof($images); $i++) {
$piObj->cObj->data['tx_wccomextimgs_imgnr'] = $i;
$markerArray['###PRODUCT_ADDITIONALIMGS###'] .= $piObj->renderValue($images[$i], 'IMAGE',$thumbConf);
}
return($markerArray);
}
}
if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/my_commerce_images/class.tx_mycommerceimages.php']) {
include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/my_commerce_images/class.tx_mycommerceimages.php']);
}
?>
In dem Fall bau ich das 1. Bild mit der Standard-Config, alle Weiteren mit einer eigenen Config in einen zusätzlichen Marker ###PRODUCT_ADDITIONALIMGS###.
Auch das entsprechende Typoscript:
plugin.tx_commerce_pi1.singleView.products.fields.additionalImgs
ist natürlich erst anzulegen.
Ich _hoffe_ mal, daß das auch im aktuellem commerce so läuft - Die Installation wo ich das eingebaut hab ist eine etwas ältere und außerdem noch ziemlich gepatchte Version von commerce.
Hätte das Ganze auch als fertige Extension mit weitern Features (Img-Popup mit Thumbs) herumliegen, bin aber bis jetzt noch nicht dazu gekommen das Ding auf einem aktuellem "vanilla"-commerce zu testen, und auch zumindest Ansätze von Doku möchten noch geschrieben werden bevor ich das ins TER stelle. Aber bei Interesse melden.