Dolibarr-Modul: Produktbilder in ODT/PDF-Vorlagen über Hook-System einbetten
Find a file
Eduard Wisch 8cd8ec58ab
All checks were successful
Deploy ProductImageTags / deploy (push) Successful in 9s
Initiales Commit — ProductImageTags v0.1.0 [deploy]
Produktbilder via Hook-System in ODT/PDF-Vorlagen einbetten.
Vollständiges Modul mit Admin-UI, Cache, Mehrsprachigkeit (de/en).
2026-04-26 17:41:36 +02:00
.forgejo/workflows Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
admin Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
class Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
core Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
doc Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
langs Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
lib Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
.gitignore Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
about.html Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
CHANGELOG.md Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
COPYING Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
modulebuilder.txt Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
productimagetagsindex.php Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
README.md Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00
tags.txt Initiales Commit — ProductImageTags v0.1.0 [deploy] 2026-04-26 17:41:36 +02:00

ProductImageTags

Dolibarr-Modul, das Produktbilder in Angebots- und Auftrags-ODTs einbindet — damit der Kunde mit den Augen kauft.

Funktionen

  • Zeilen-Platzhalter {line_product_image_path} und {line_product_has_image} innerhalb [!-- BEGIN lines --]
  • Eigenes Detailseiten-Segment [!-- BEGIN product_details --] mit einem großen und bis zu 4 kleinen Bildern je Produkt, Beschreibung, Preisen, Maßen
  • On-the-fly Skalierung der Bilder auf konfigurierbare Maximalgröße, gecacht (Bildtausch invalidiert den Cache automatisch)
  • Konfigurierbar über Admin-UI (Bildgrößen, Anzahl, Cache-Dauer, Skip-Empty)
  • Greift für Angebot (propal) und Auftrag (commande); Rechnung/Lieferschein technisch vorbereitet, kann später freigeschaltet werden

Installation

  1. Repo nach htdocs/custom/productimagetags/ kopieren oder symlinken
  2. Home → Setup → Module → ProductImageTags aktivieren
  3. Einstellungen unter Setup anpassen (Bildgrößen, Cache)
  4. ODT-Template anpassen (siehe doc/TEMPLATE_ANLEITUNG.md)

Verfügbare Platzhalter

Innerhalb [!-- BEGIN lines --]

Platzhalter Bedeutung
{line_product_image} Echtes Bild (draw:frame), wird pro Zeile automatisch eingefügt. Im Template nicht als Dummy-Bild setzen — als Text-Platzhalter lassen. Das Bild erscheint an der Stelle des Platzhalters in der Größe des Originals × PRODUCTIMAGETAGS_LINE_RATIO.
{line_product_image_path} Absoluter Dateisystem-Pfad zum skalierten Hauptbild (als Text, falls du den Pfad irgendwo brauchst)
{line_product_has_image} 1 wenn ein Bild existiert, sonst 0 (für IF-Blöcke)

Das Zeilen-Bild nutzt einen Marker+Post-Processing-Workaround, weil Dolibarrs odfphp-Library Segment-Bilder beim mergeSegment nicht sauber zum Odf-Handler propagiert. Wir ersetzen den Marker im content.xml per Reflection nach dem Core-Merge durch ein echtes <draw:frame> und registrieren das Bild direkt am Odf-Handler — funktioniert ohne Core-Patch.

Innerhalb [!-- BEGIN product_details --] (eigener Loop)

Platzhalter Bedeutung
{pd_position} Laufende Nummer auf der Detailseite
{pd_ref} Produkt-Referenz
{pd_label} Produkt-Bezeichnung
{pd_description} Beschreibung (HTML-getrimmt)
{pd_price_ht} / {pd_price_ttc} Preise formatiert
{pd_qty} Menge aus der Angebots-/Auftragszeile
{pd_weight} Gewicht + Einheit
{pd_dimensions} L × B × H mit Einheit
{pd_image_count} Anzahl der tatsächlich vorhandenen Bilder
{pd_image_large} Großes Hauptbild (Dummy-Frame im Template)
{pd_image_1}{pd_image_4} Bis zu 4 kleine Bilder
{pd_has_image_1}{pd_has_image_4} 1/0 Flags für IF-Blöcke

Konfiguration

  • PRODUCTIMAGETAGS_LINE_MAXPX — Langseite Zeilen-Bild (Default 300)
  • PRODUCTIMAGETAGS_LINE_RATIO — setImage-Ratio Zeilen-Bild (Default 1.0)
  • PRODUCTIMAGETAGS_DETAIL_COUNT — Max. Anzahl kleiner Detailbilder (Default 4)
  • PRODUCTIMAGETAGS_DETAIL_SMALL_MAXPX — Langseite kleine Bilder (Default 600)
  • PRODUCTIMAGETAGS_DETAIL_LARGE_MAXPX — Langseite großes Bild (Default 1200)
  • PRODUCTIMAGETAGS_DETAIL_SKIP_EMPTY — Produkte ohne Bilder im Loop überspringen (Default 1)
  • PRODUCTIMAGETAGS_CACHE_DAYS — Cache-Lebensdauer Tage (Default 30)

Bild-Auswahl

Das „Hauptbild" eines Produkts ist das alphabetisch erste in documents/produit/<ref-ordner>/photos/. Wer steuern will, welches Bild Hauptbild ist: Dateien mit Nummernprefix benennen, z.B. 01_front.jpg, 02_detail.jpg, …

Bekannte Limitationen

  • PDF-Skalierung: LibreOffice kann bei ODT→PDF-Konvertierung dünne Bildkanten wegglätten. Wir skalieren Originale, sodass das normalerweise kein Problem ist.
  • Anker des Zeilen-Bildes: aktuell fest as-char (wird als Zeichen in den Text eingebettet). Damit fließt das Bild mit der Zellhöhe mit. Für andere Anker-Typen wäre ein Template-eigener Dummy-Frame nötig — kommt bei Bedarf nach.

Lizenz

GPL v3+ (siehe COPYING)