swag-docs-bundle-example icon indicating copy to clipboard operation
swag-docs-bundle-example copied to clipboard

getCurrencyPrecision not available since shopware 6.4.0

Open Nico-Schaefer-2111 opened this issue 3 years ago • 7 comments

https://github.com/shopware/swag-docs-bundle-example/blob/4d787fd898a2c7c2d1b7edf403183668cd46c6c9/src/Core/Checkout/Bundle/Cart/BundleCartProcessor.php

the method 'getCurrencyPrecision' is not part of the context class anymore.

Nico-Schaefer-2111 avatar Jun 22 '21 07:06 Nico-Schaefer-2111

same here

fgiering avatar Jun 23 '21 12:06 fgiering

@fgiering you can just leave it out.

Nico-Schaefer-2111 avatar Jun 23 '21 12:06 Nico-Schaefer-2111

@fgiering you can just leave it out.

You mean like: $priceDefinition = new AbsolutePriceDefinition($bundleData->getDiscount() * -1); instead of $priceDefinition = new AbsolutePriceDefinition($bundleData->getDiscount() * -1, $context->getContext()->getCurrencyPrecision()); ?

fgiering avatar Jun 24 '21 06:06 fgiering

yep, exactly

Nico-Schaefer-2111 avatar Jun 24 '21 07:06 Nico-Schaefer-2111

Then I get a RuntimeException Product "" has invalid price definition

fgiering avatar Jun 24 '21 12:06 fgiering

Can you Debug it a bit more, which value is set there? In Shopware 6.4.0 I used it with a static integer like:

$lineItem->setPriceDefinition( new AbsolutePriceDefinition(5) )

This works fine for me Maybe you got there a float with more than 2 decimal places ?

Nico-Schaefer-2111 avatar Jun 25 '21 07:06 Nico-Schaefer-2111

Got it. There was an inactive Product in the Bundle.

fgiering avatar Jun 25 '21 13:06 fgiering