Skip to content

Commit 17c29af

Browse files
author
Roger
committed
Issue 35964: Bundle options decimal qty is rendered as an integer part only
1 parent 0f6dde0 commit 17c29af

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/Items/Renderer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66
namespace Magento\Bundle\Block\Adminhtml\Sales\Order\Items;
77

8+
use Magento\Catalog\Helper\Data as CatalogHelper;
89
use Magento\Catalog\Model\Product\Type\AbstractType;
9-
use Magento\Framework\Serialize\Serializer\Json;
1010
use Magento\Framework\App\ObjectManager;
11-
use Magento\Catalog\Helper\Data as CatalogHelper;
11+
use Magento\Framework\Serialize\Serializer\Json;
1212

1313
/**
1414
* Adminhtml sales order item renderer
@@ -19,7 +19,7 @@
1919
class Renderer extends \Magento\Sales\Block\Adminhtml\Items\Renderer\DefaultRenderer
2020
{
2121
/**
22-
* Serializer
22+
* Serializer interface instance.
2323
*
2424
* @var Json
2525
*/
@@ -248,7 +248,7 @@ public function getValueHtml($item)
248248
if (!$this->isShipmentSeparately($item)) {
249249
$attributes = $this->getSelectionAttributes($item);
250250
if ($attributes) {
251-
$result = sprintf('%d', $attributes['qty']) . ' x ' . $result;
251+
$result = (float) $attributes['qty'] . ' x ' . $result;
252252
}
253253
}
254254
if (!$this->isChildCalculated($item)) {

app/code/Magento/Bundle/Block/Adminhtml/Sales/Order/View/Items/Renderer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
*/
66
namespace Magento\Bundle\Block\Adminhtml\Sales\Order\View\Items;
77

8+
use Magento\Catalog\Helper\Data as CatalogHelper;
89
use Magento\Catalog\Model\Product\Type\AbstractType;
910
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\Serialize\Serializer\Json;
11-
use Magento\Catalog\Helper\Data as CatalogHelper;
1212

1313
/**
1414
* Adminhtml sales order item renderer
@@ -203,7 +203,7 @@ public function getValueHtml($item)
203203
if (!$this->isShipmentSeparately($item)) {
204204
$attributes = $this->getSelectionAttributes($item);
205205
if ($attributes) {
206-
$result = sprintf('%d', $attributes['qty']) . ' x ' . $result;
206+
$result = (float) $attributes['qty'] . ' x ' . $result;
207207
}
208208
}
209209
if (!$this->isChildCalculated($item)) {

app/code/Magento/Bundle/Block/Sales/Order/Items/Renderer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ public function getSelectionAttributes($item)
150150
public function getValueHtml($item)
151151
{
152152
if ($attributes = $this->getSelectionAttributes($item)) {
153-
return sprintf('%d', $attributes['qty']) . ' x ' . $this->escapeHtml($item->getName()) . " "
153+
return (float) $attributes['qty'] . ' x ' . $this->escapeHtml($item->getName()) . " "
154154
. $this->getOrder()->formatPrice($attributes['price']);
155155
}
156156
return $this->escapeHtml($item->getName());

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/AbstractItems.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
abstract class AbstractItems extends \Magento\Sales\Model\Order\Pdf\Items\AbstractItems
2424
{
2525
/**
26-
* Serializer
26+
* Serializer interface instance.
2727
*
2828
* @var Json
2929
*/
@@ -263,7 +263,8 @@ public function getValueHtml($item)
263263
if (!$this->isShipmentSeparately($item)) {
264264
$attributes = $this->getSelectionAttributes($item);
265265
if ($attributes) {
266-
$result = $this->filterManager->sprintf($attributes['qty'], ['format' => '%d']) . ' x ' . $result;
266+
$qty = $this->filterManager->sprintf($attributes['qty'], ['format' => '%f']);
267+
$result = (float) $qty . ' x ' . $result;
267268
}
268269
}
269270
if (!$this->isChildCalculated($item)) {

0 commit comments

Comments
 (0)