Da im Standard bei Aufruf eines Artikels mit Attributen immer das erste Attribut vorausgewählt ist (ausgenommen man kommt vom Warenkorb) kommt es bei der Lagerampel bei Attributen mkt dem vorliegenden Modul zu Ungereimtheiten wenn ein Attribut keinen Lagerbestand hat aber das erste Attribut ist.
Mit folgendem File kann man das nächste Attribut in der Reihenfolge welches Lagerbestand hat vorausgewählt anzeigen lassen. Wohin das File geladen werden muß steht im Kopf des Files.
<?php/***************************************************************
* file: precheck_attr_depstock.php
* path: /includes/modules/products_attributes_data/
* use: precheck attribute if first is out of stock
*
* © copyright, 12-2020, noRiddle
***************************************************************/if(strpos($_GET['products_id'], '{') === false) { //exclude coming from shopping cart if($col == 0) $temp_cnt = 0; if($products_options['attributes_stock'] <= 0) { $temp_col = $col + 1; } if(($col == '0' || $col == $temp_col) && $products_options['attributes_stock'] > 0 && isset($temp_cnt)) { $products_options_data[$row]['DATA'][$col]['CHECKED'] = '1'; unset($temp_cnt); }}?> Bevor jemand sagt, daß das kompliziert gelöst ist: Es ist imho besser so als am Ende außerhalb des while-Lops durch das ganze Array zu loopen (also in einem File in
/includes/modules/products_attributes_end/).
Gruß,
noRiddle
*NACHTRAG*
Das klappt natürlich nur wenn im Template-File auch
$item_data.CHECKED == '1' abgefragt wird, wie es im Standard-Template
tpl_modified_responsive ist.