Sortierung des Bundleinhalts aus dem Produkt übernommen. Zu früher umbruch bei Level >1 gefixt
This commit is contained in:
@@ -402,18 +402,31 @@ $indentMm = max(0, ($lvl - 1) * $INDENT_MM_PER_LVL);
|
||||
|
||||
// Name-Spalte: ohne Spacer-Tabelle bei Level 1 (indent=0), sonst mit
|
||||
if ($indentMm > 0) {
|
||||
$nameCellHtml = '
|
||||
/*$nameCellHtml = '
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td style="width:'.$indentMm.'mm; padding:0; margin:0;"></td>
|
||||
<td style="font-size:'.$textFontPx.'px; line-height:'.$lineHeight.'; padding:0; margin:0;">'.$text.'</td>
|
||||
</tr>
|
||||
</table>';
|
||||
</table>';*/
|
||||
|
||||
$indentMm = max(0, ($lvl - 1) * $INDENT_MM_PER_LVL);
|
||||
$indentSpaces = str_repeat(' ', max(0, ($lvl - 1) * 4));
|
||||
|
||||
$nameCellHtml = '
|
||||
<span style="
|
||||
font-size:'.$textFontPx.'px;
|
||||
line-height:'.$lineHeight.';
|
||||
">'.$indentSpaces.$text.'</span>';
|
||||
|
||||
//Ende ersetzter Teil
|
||||
|
||||
} else {
|
||||
// Level 1: direkt rendern
|
||||
$nameCellHtml = '<span style="font-size:'.$textFontPx.'px; line-height:'.$lineHeight.';">'.$text.'</span>';
|
||||
}
|
||||
|
||||
|
||||
$bundleRows .= '
|
||||
<tr>
|
||||
<!-- Anzahl -->
|
||||
@@ -429,7 +442,7 @@ if ($indentMm > 0) {
|
||||
|
||||
<!-- Name mit Einrückung -->
|
||||
<td style="
|
||||
width:68%;
|
||||
width:78%;
|
||||
vertical-align:middle;
|
||||
padding:'.$ROW_PAD_V_MM.'mm '.$ROW_PAD_H_MM.'mm;">
|
||||
'.$nameCellHtml.'
|
||||
@@ -437,7 +450,7 @@ if ($indentMm > 0) {
|
||||
|
||||
<!-- Gewicht rechts mit extra Innenabstand -->
|
||||
<td style="
|
||||
width:20%;
|
||||
width:10%;
|
||||
text-align:right;
|
||||
vertical-align:middle;
|
||||
font-size:'.$weightFontPx.'px;
|
||||
@@ -779,6 +792,12 @@ function addMaterialsRecursive($Epi, array $materials, int $level, array &$bundl
|
||||
if ($level > $MAX_BUNDLE_LEVEL || empty($materials)) {
|
||||
return;
|
||||
}
|
||||
// Nach "position" aufsteigend sortieren (pro Level)
|
||||
usort($materials, function ($a, $b) {
|
||||
$posA = isset($a->position) ? (int)$a->position : PHP_INT_MAX;
|
||||
$posB = isset($b->position) ? (int)$b->position : PHP_INT_MAX;
|
||||
return $posA <=> $posB;
|
||||
});
|
||||
|
||||
foreach ($materials as $mat) {
|
||||
$isFree = !empty($mat->is_free_material);
|
||||
|
||||
Reference in New Issue
Block a user