# Staffelpreise im Listing

**URL:** https://forum.shopware.com/t/staffelpreise-im-listing/12468
**Category:** Shopware 3.5
**Tags:** programming
**Created:** [2. April 2013 um 18:27 UTC](https://forum.shopware.com/t/staffelpreise-im-listing/12468 "2013-04-02T18:27:17Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![premidor](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@premidor](https://forum.shopware.com/u/premidor)
#### Post date: [2. April 2013 um 18:27 UTC](https://forum.shopware.com/t/staffelpreise-im-listing/12468/1 "2013-04-02T18:27:17Z")

</div>

Hallo, ich würde gerne im Artikel-Listing bereits die Staffelpreis-Tabelle ausgeben. Allerdings scheint $sArticle.sBlockPrices im Listing nicht gefüllt zu sein. Ich habe bereits ein wenig rumprobiert, ein Hook/Event erstellt um die sGetArticlesByCategory() zu modifizieren, wie es in den folgenden Threads angedeutet wurde: [programmierung-f13/gelost-niedrigsten-staffelpreis-in-der-listenansicht-aus-t6219.html](http://forum.shopware.de/programmierung-f13/gelost-niedrigsten-staffelpreis-in-der-listenansicht-aus-t6219.html) [templates-und-design-f57/staffelpreise-im-listing-t10173.html](http://forum.shopware.de/templates-und-design-f57/staffelpreise-im-listing-t10173.html) Allerdings ohne jeden Erfolg - die von mir erstellen Hooks (so wie in den Threads beschrieben) zeigen keine Wirkung. Konkrete Frage: wie kann ich die Staffelpreise im Artikel-Listing anzeigen? Vielen Dank für eure Hilfe!

---

<div class="post-metadata">

### Author: ![premidor](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@premidor](https://forum.shopware.com/u/premidor)
#### Post date: [3. April 2013 um 14:42 UTC](https://forum.shopware.com/t/staffelpreise-im-listing/12468/2 "2013-04-03T14:42:25Z")

</div>

Konnte nun die ersten Erfolge erzielen, indem ich folgendes direkt in der sArticles.php (Zeile 1327, innerhalb sGetArticlesByCategory())eingefügt habe: ` // Get blockpricing // =================================================. if ($articles[$articleKey]["pricegroupActive"]){ // SW 2.1 Pricegroups /\* If prices were calculated via an active pricegroup - build discount matrix dynamicly \*/ $articles[$articleKey]["sBlockPrices"] = $this-\>sGetPricegroupDiscount($this-\>sSYSTEM-\>sUSERGROUP,$articles[$articleKey]["pricegroupID"],$articles[$articleKey]["priceBeforePriceGroup"],1,true,$articles[$articleKey]); }else { /\* Load defined discount-rules -- Check if prices for this customergroup are available \*/ if ($articles[$articleKey]["pricegroup"]!=$this-\>sSYSTEM-\>sUSERGROUP){ $sql = " SELECT `from` AS valFrom,`to` AS valTo, price, pseudoprice FROM s\_articles\_prices WHERE articledetailsID={$articles[$articleKey]["articleDetailsID"]} AND (pricegroup='EK') ORDER BY id ASC "; }else { $sql = " SELECT `from` AS valFrom,`to` AS valTo, price, pseudoprice FROM s\_articles\_prices WHERE articledetailsID={$articles[$articleKey]["articleDetailsID"]} AND (pricegroup='".$this-\>sSYSTEM-\>sUSERGROUP."') ORDER BY id ASC "; } $getBlockPricings =$this-\>sSYSTEM-\>sDB\_CONNECTION-\>CacheGetAll($this-\>sSYSTEM-\>sCONFIG['sCACHEARTICLE'],$sql,false,"article\_".$articles[$articleKey]["articleID"]); // If more then one row, there are block-prices if (count($getBlockPricings)\>1){ foreach ($getBlockPricings as $blockPriceKey =\> $blockPriceValue){ $getBlockPricings[$blockPriceKey]["from"] = $blockPriceValue["valFrom"]; $getBlockPricings[$blockPriceKey]["to"] = $blockPriceValue["valTo"]; $getBlockPricings[$blockPriceKey]["price"] = $this-\>sCalculatingPrice($blockPriceValue["price"],$articles[$articleKey]["tax"],$articles[$articleKey]); $getBlockPricings[$blockPriceKey]["pseudoprice"] = $this-\>sCalculatingPrice($blockPriceValue["pseudoprice"],$articles[$articleKey]["tax"],$articles[$articleKey]); } $articles[$articleKey]["sBlockPrices"] = $getBlockPricings; } // block pricing else { $articles[$articleKey]["sBlockPrices"] = array(); } } ` Damit kann ich im Artikel-Listing auf $sArticles.sBlockPrices auf die Staffelpreise zugreifen. Allerdings ist eine direkte Änderung der sArticles.php nicht die feine Englische. Deshalb habe ich versucht folgenden Hook zu erstellen: [code]\<?php class Shopware\_Plugins\_Frontend\_ListingShit\_Bootstrap extends Shopware\_Components\_Plugin\_Bootstrap  
{

```
public function install()
{
	$this->subscribeEvent( 'sArticles::sGetArticlesByCategory::after', 'getBlockPricingInListing' ); return true; } public static function getBlockPricingInListing(Enlight\_Hook\_HookArgs $args) { $result = $args-\>getReturn(); foreach ($result['sArticles'] as $article){ $result['sArticles'][$article['articleID']]['test'] = 'foobar'; } $args-\>setReturn($result); } } ?\>[/code] Wenn ich nun im Artikel-Listing auf $sArticles.test zugreife, passiert...nichts :( Wo liegt mein Fehler?
```

---

<div class="post-metadata">

### Author: ![Stefan\_Hamann](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Stefan\_Hamann](https://forum.shopware.com/u/Stefan_Hamann)
#### Post date: [3. April 2013 um 15:09 UTC](https://forum.shopware.com/t/staffelpreise-im-listing/12468/3 "2013-04-03T15:09:15Z")

</div>

Springt er denn überhaupt in die Funktion rein? Also wenn du oben in deinem Hook direkt mit die(„test“); aussteigst, wird das ausgeführt?

---

<div class="post-metadata">

### Author: ![premidor](https://avatars.discourse-cdn.com/v4/letter/p/c77e96/32.png) [@premidor](https://forum.shopware.com/u/premidor)
#### Post date: [3. April 2013 um 19:49 UTC](https://forum.shopware.com/t/staffelpreise-im-listing/12468/4 "2013-04-03T19:49:44Z")

</div>

Mir fällt grad auf, dass ich Shopware 3.5 mit Shopware 4 gemischt hab. Könntet ihr den Thread bitte in das passende Forum schieben? Ich hab außerdem den Hook entsprechend angepasst: `<?php class Shopware_Plugins_Frontend_ListingShit_Bootstrap extends Shopware_Components_Plugin_Bootstrap
{
   public function install()
   {
       $hook = $this->createHook( 'sArticles', 'sGetArticlesByCategory', 'getBlockPricing', Enlight\_Hook\_HookHandler::TypeAfter, 0 ); $this-\>subscribeHook($hook); return true; } static function getBlockPricing(Enlight\_Hook\_HookArgs $args) { die("test"); } }` Leider wird die Funktion nicht ausgeführt ☹

---

<div class="post-metadata">

### Author: ![Stefan\_Hamann](https://avatars.discourse-cdn.com/v4/letter/s/5e9695/32.png) [@Stefan\_Hamann](https://forum.shopware.com/u/Stefan_Hamann)
#### Post date: [4. April 2013 um 08:16 UTC](https://forum.shopware.com/t/staffelpreise-im-listing/12468/5 "2013-04-04T08:16:43Z")

</div>

Installiert ist das aber definitiv? Welche Version von Shopware hast du denn genau im Einsatz? Sind Schreibrechte auf /engine/Shopware/Proxies vorhanden?
