So schaut mein iso_reader template aus:
Code:
<?php
$arrSelects = array();
?>
<form action="<?php echo $this->action; ?>" id="<?php echo $this->formId; ?>" name="iso<?php echo rand(); ?>" method="post" enctype="<?php echo $this->enctype; ?>">
<div class="formbody" itemscope itemtype="http://schema.org/Product">
<input type="hidden" name="FORM_SUBMIT" value="<?php echo $this->formSubmit; ?>">
<input type="hidden" name="REQUEST_TOKEN" value="{{request_token}}">
<input type="hidden" name="AJAX_PRODUCT" value="<?php echo $this->product_id; ?>">
<input type="hidden" name="AJAX_MODULE" value="<?php echo $this->module_id; ?>">
<div class="galeriebilder"><?php echo $this->getGallery('images')->generateMainImage(); ?>
<span class="thumbnails"><?php echo $this->getGallery('images')->generateGallery(); ?></span></div>
<h2 itemprop="name"><?php echo $this->generateAttribute('name'); ?></h2>
<?php if ($this->sku): ?>
<div class="sku" itemprop="sku">Artikel-Nr.: <?php echo $this->generateAttribute('sku'); ?> - Lieferzeit 2-10 Werkttage</div><?php endif; if ($this->description): ?>
<div class="description" itemprop="description"><?php echo $this->generateAttribute('description'); ?></div><?php endif; ?>
<div class="offer" itemscope itemtype="http://schema.org/Offer">
<?php if($this->hasOptions): ?>
<?php
#$arrSelects = array();
?>
<div class="options">
<?php foreach( $this->options as $arrOption ): ?>
<?php
$preg = preg_match('/<select(.*?) id="(.*?)\"/', $arrOption['html'],$result);
if($preg)
{
$arrSelects[] = $result[2];
}
?>
<?php echo $arrOption['html']; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php if($this->baseprice): ?><div class="baseprice"><?php echo $this->generateAttribute('baseprice'); ?></div><?php endif; ?>
<div class="price" itemprop="price"><?php echo $this->generatePrice(); ?></div>
<div class="mwst">inkl. MwSt. zzgl. <a href="http://shop.julenhof.de/versandkosten.html" data-lightbox="versandkosten">Versandkosten</a></div>
</div>
<?php if($this->buttons): ?>
<div class="submit_container">
<?php if ($this->useQuantity): ?>
<div class="quantity_container">
<label for="quantity_requested_<?php echo $this->raw['id']; ?>"><?php echo $GLOBALS['TL_LANG']['MSC']['quantity']; ?>:</label> <input type="text" class="text" id="quantity_requested_<?php echo $this->raw['id']; ?>" name="quantity_requested" placeholder="<?php echo $this->minimum_quantity; ?>" maxlength="10">
</div>
<?php endif; ?>
<?php foreach( $this->buttons as $name => $button ): ?>
<input type="submit" class="submit <?php echo $name; ?>" name="<?php echo $name; ?>" value="<?php echo $button['label']; ?>">
<?php endforeach; ?>
</div>
<?php endif; ?>
</div>
</form>
<?php if(count($arrSelects) && !\Input::post('FORM_SUBMIT')): ?>
<?php
$jsSelects = json_encode($arrSelects);
?>
<script type="text/javascript">
/* <![CDATA[ */
/**
* Scripts
*/
window.addEvent('domready', function()
{
var selects = JSON.parse('<?php echo $jsSelects;?>');
if(selects == null || selects.length < 1)
{
return;
}
selects.each(function(elem, index)
{
$(elem).getElements('option')[0].set('selected','');
$(elem).getElements('option')[1].set('selected','selected');
});
//select.getElements('option')[0].set('selected','');
//select.getElements('option')[0].destroy();
//select.getElements('option')[1].set('selected','selected');
});
/* ]]> */
</script>
<?php endif; ?>
Die rot markierten Stellen sind einzufügen. Dann müsste das mit der Vorauswahl klappen. Danke an Tim G übrigens für den Code.
Lesezeichen