Error ShopContext::getPriceGroups() - SW 5.1.5

Hallo,

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

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

 

$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);

 

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 $context->getPriceGroups();

Hat jemand eine Idee woran es liegen kann?

Danke & Gruß

Ottscho

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

Viele Grüße

oh man, ich danke dir. So ist es.

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