# Sortierung nach Lagerbestand auf der Übersichtsseite

**URL:** <https://forum.shopware.com/t/sortierung-nach-lagerbestand-auf-der-ubersichtsseite/30061>\
**Category:** Shopware 3.5\
**Tags:** themes--design\
**Created:** [28. August 2015 um 16:10 UTC](https://forum.shopware.com/t/sortierung-nach-lagerbestand-auf-der-ubersichtsseite/30061 "2015-08-28T16:10:54Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![o00o](https://avatars.discourse-cdn.com/v4/letter/o/f475e1/32.png) [@o00o](https://forum.shopware.com/u/o00o)\
**Post date:** [28. August 2015 um 16:10 UTC](https://forum.shopware.com/t/sortierung-nach-lagerbestand-auf-der-ubersichtsseite/30061/1 "2015-08-28T16:10:54Z")

</div>

Ich möchte in Shopware 4.3.2 die Sortierung nach Lagerbestand sortieren. Die Datei listing\_actions.tpl habe ich schon erweitert: [code]

{s name=‘ListingLabelSort’}{/s}{s name=‘ListingSortRelease’}{/s} {s name=‘ListingSortRating’}{/s} {s name=‘ListingSortPriceLowest’}{/s} {s name=‘ListingSortPriceHighest’}{/s} {s name=‘ListingSortName’}{/s} {block name=‘frontend\_listing\_actions\_sort\_values’}{/block}[/code] Was muss ich im Backend unter Standardsortierung Listings eintragen damit er das nach Lagerbestand sortiert? Ich habe einfach aDetails.instock eingegeben es passiert aber nichts. Ist aDetails.instock überhaupt richtig?

---

<div class="post-metadata">

**Author:** ![o00o](https://avatars.discourse-cdn.com/v4/letter/o/f475e1/32.png) [@o00o](https://forum.shopware.com/u/o00o)\
**Post date:** [31. August 2015 um 16:02 UTC](https://forum.shopware.com/t/sortierung-nach-lagerbestand-auf-der-ubersichtsseite/30061/2 "2015-08-31T16:02:19Z")

</div>

das ist eine Shopware 4 Frage. Kann die jemand bitte ins Shopware 4 Forum verschieben?

---

<div class="post-metadata">

**Author:** ![o00o](https://avatars.discourse-cdn.com/v4/letter/o/f475e1/32.png) [@o00o](https://forum.shopware.com/u/o00o)\
**Post date:** [1. September 2015 um 15:23 UTC](https://forum.shopware.com/t/sortierung-nach-lagerbestand-auf-der-ubersichtsseite/30061/3 "2015-09-01T15:23:55Z")

</div>

Das ist doch jetzt keine schwere Frage wie man nach Lagerbestand sortiert??!! Kann da keiner helfen??!!

---

<div class="post-metadata">

**Author:** ![o00o](https://avatars.discourse-cdn.com/v4/letter/o/f475e1/32.png) [@o00o](https://forum.shopware.com/u/o00o)\
**Post date:** [13. Oktober 2015 um 14:04 UTC](https://forum.shopware.com/t/sortierung-nach-lagerbestand-auf-der-ubersichtsseite/30061/4 "2015-10-13T14:04:23Z")

</div>

ok ich habe jetzt raus gefunden, dass man die sArticles.php anpassen muss um hier ein neues Sortierfeld greifen zu lassen: ` $groupBy = 'a.id'; switch ($sSort) { case 1: $groupBy = "a.datum, a.changetime, a.id"; $orderBy = "a.datum DESC, a.changetime DESC, a.id DESC"; break; case 2: $groupBy = "atop.sales, aDetails.articleID"; $orderBy = "atop.sales DESC, aDetails.articleID DESC"; //if the customer want to sort the listing by most sales, we have to use the s\_articles\_details as base table $sqlFromPath = " FROM s\_articles\_details aDetails INNER JOIN s\_articles a ON aDetails.id = a.main\_detail\_id LEFT JOIN s\_articles\_top\_seller\_ro atop ON a.id = atop.article\_id "; break; case 3: $orderBy = "price ASC, a.id"; break; case 4: $orderBy = "price DESC, a.id DESC"; break; case 5: $groupBy = "a.name, a.id"; $orderBy = "a.name ASC, a.id"; $sqlFromPath = " FROM s\_articles AS a FORCE INDEX (articles\_by\_category\_sort\_name) INNER JOIN s\_articles\_details AS aDetails ON aDetails.id = a.main\_detail\_id "; break; case 6: $groupBy = "a.name, a.id"; $orderBy = "a.name DESC, a.id DESC"; $sqlFromPath = " FROM s\_articles AS a FORCE INDEX (articles\_by\_category\_sort\_name) INNER JOIN s\_articles\_details AS aDetails ON aDetails.id = a.main\_detail\_id "; break;` ich werde mir jetzt ein plugin schreiben, dass die sArticles.php um case 7 erweitert der dann die Lagerbestände sortiert.
