# Error ShopContext::getPriceGroups() - SW 5.1.5

**URL:** <https://forum.shopware.com/t/error-shopcontext-getpricegroups-sw-5-1-5/38231>\
**Category:** Programmierung\
**Created:** [14. Juli 2016 um 10:00 UTC](https://forum.shopware.com/t/error-shopcontext-getpricegroups-sw-5-1-5/38231 "2016-07-14T10:00:29Z")\
**Posts on this page:** 3\
**Page:** 1

<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:** [14. Juli 2016 um 10:00 UTC](https://forum.shopware.com/t/error-shopcontext-getpricegroups-sw-5-1-5/38231/1 "2016-07-14T10:00:29Z")

</div>

Hallo,

ich habe ein Problem und weiß nicht genau woher es kommt.

Ich bin per Plugin im Detail Controller (Post) und verwende folgenden Code:

&nbsp;

```
$contextService = Shopware()->Container()->get('shopware_storefront.context_service');
$productNumberService = Shopware()->Container()-get('shopware_storefront.product_number_service');
$productService = Shopware()->Container()->get('shopware_storefront.product_service');
$context = $contextService->getShopContext();

$legacyStructConverter = Shopware()->Container()->get('legacy_struct_converter');

$number = $productNumberService->getMainProductNumberById($sArticle['articleID']);

$productNumber = $productNumberService->getAvailableNumber(
	$number,
	$context,
	$ottSelection
);

$product = $productService->get($productNumber, $context);
								
$product = $legacyStructConverter->convertProductStruct($product);

```

&nbsp;

Das klappt bei mir in meinem Demo Shop unter SW 5.2.2 bestens…

In einem anderen Shop mit SW 5.1.5 erhalte ich folgende Meldung:

**Fatal error** : Call to undefined method Shopware\Bundle\StoreFrontBundle\Struct\ShopContext::getPriceGroups() in **/rahpdjhs/www.rahmen-shop.de/engine/Shopware/Bundle/StoreFrontBundle/Service/Core/GraduatedPricesService.php** on line **103**  
503 Service Unavailable

Hier wird auf $context zugegriffen mit&nbsp;$context-\>getPriceGroups();

Hat jemand eine Idee woran es liegen kann?

Danke & Gruß

Ottscho

---

<div class="post-metadata">

**Author:** ![EikeBrandtWarneke](https://avatars.discourse-cdn.com/v4/letter/e/cdc98d/32.png) [@EikeBrandtWarneke](https://forum.shopware.com/u/EikeBrandtWarneke)\
**Post date:** [14. Juli 2016 um 10:10 UTC](https://forum.shopware.com/t/error-shopcontext-getpricegroups-sw-5-1-5/38231/2 "2016-07-14T10:10:06Z")

</div>

Hat 5.1.5 nicht einen anderen context erwartet?! Shop context statt dem neuen “standard” context?

Viele Grüße

---

<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:** [14. Juli 2016 um 11:39 UTC](https://forum.shopware.com/t/error-shopcontext-getpricegroups-sw-5-1-5/38231/3 "2016-07-14T11:39:55Z")

</div>

oh man, ich danke dir. So ist es.

```
 //$context = $contextService-\>getShopContext(); //ab sw 5.2 $context = $contextService-\>getProductContext();

```

&nbsp;
