# BilderBug in Plugin &quot;Erweiterter Variantenwechsel&quot;

**URL:** https://forum.shopware.com/t/bilderbug-in-plugin-quot-erweiterter-variantenwechsel-quot/7404
**Category:** Shopware 3.5
**Tags:** templates--design
**Created:** [14. Juni 2012 um 16:09 UTC](https://forum.shopware.com/t/bilderbug-in-plugin-quot-erweiterter-variantenwechsel-quot/7404 "2012-06-14T16:09:07Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Alpine\_Swift](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@Alpine\_Swift](https://forum.shopware.com/u/Alpine_Swift)
#### Post date: [14. Juni 2012 um 16:09 UTC](https://forum.shopware.com/t/bilderbug-in-plugin-quot-erweiterter-variantenwechsel-quot/7404/1 "2012-06-14T16:09:07Z")

</div>

Moin! Leider hat’s da noch einen kleinen Bug in dem Plugin. Und zwar was die Vorschau-Bilder für die Varianten in der swag\_box angeht. Wir haben zu einigen Artikeln zwei Bilder angelegt, z. b. Vorder- und Rückseite des Artikels. In der swag\_box sollte das Bild der Vorderseite zu sehen sein. Es ist aber immer wieder das Bild der Rückseite dort. Ich denke, dass hier die Position des Bildes (Reihenfolge im backend, s\_articles\_img.position) nicht berücksichtigt wird und es so zu diesem Fehler kommt. LG, AS

---

<div class="post-metadata">

### Author: ![ottscho](https://avatars.discourse-cdn.com/v4/letter/o/7ba0ec/32.png) [@ottscho](https://forum.shopware.com/u/ottscho)
#### Post date: [16. Juni 2012 um 12:38 UTC](https://forum.shopware.com/t/bilderbug-in-plugin-quot-erweiterter-variantenwechsel-quot/7404/2 "2012-06-16T12:38:38Z")

</div>

So, hier die Lösung. Problem ist, dass bei der Zuordnung die Bildposition nicht beachtet wird. Boostrap.php [Zeile 79] Hier wird davon ausgegangen, dass es nicht mehr als 99 Bilder für den Artikel gibt. Diesen Wert brauchen wir einfach als Startwert zum vergleich der Position der Bilder: ` // Stripping slashes and spaces $option = str\_ireplace('/', '', $configValues['optionname']); $option = str\_ireplace(' ', '', $option); ` ersetzen durch. ` // Stripping slashes and spaces $option = str\_ireplace('/', '', $configValues['optionname']); $option = str\_ireplace(' ', '', $option); $posMin[strtolower($option)] = 99; ` [Zeile 96] Nun prüfen wird in der Schleife die Positionsnummer der Bilder pro Variante und ordnen nur den Bildlink der kleinsten Positionsnummer der Variante zu: `// if the optionname and the relation are exactly the same, add the image to the correct article if(strtolower($option) == strtolower($match)) { $configValues['image'] = $image['src'][1]; } ` ersetzen durch: ` // if the optionname and the relation are exactly the same, add the image to the correct article $pos[strtolower($option)] = intval($image["position"]); if(strtolower($option) == strtolower($match)) { if ($posMin[strtolower($option)] \> $pos[strtolower($option)]) { $configValues['image'] = $image['src'][1]; $posMin[strtolower($option)] = $image["position"]; } } `

---

<div class="post-metadata">

### Author: ![Alpine\_Swift](https://avatars.discourse-cdn.com/v4/letter/a/8dc957/32.png) [@Alpine\_Swift](https://forum.shopware.com/u/Alpine_Swift)
#### Post date: [16. Juni 2012 um 12:57 UTC](https://forum.shopware.com/t/bilderbug-in-plugin-quot-erweiterter-variantenwechsel-quot/7404/3 "2012-06-16T12:57:01Z")

</div>

Schade, dass man sich nur einmal bedanken kann … :thumbup: LG, AS
