Skip to content

Commit 7049df8

Browse files
author
Oleksii Korshenko
committed
MAGETWO-67509: Decimal to Float Convertion #9266
- Merge Pull Request #9266 from evgk/magento2:patch-4 - Merged commits: 1. 3983bec 2. b26c7cc 3. 553aa22 4. cbc6a67
2 parents f215f3d + cbc6a67 commit 7049df8

File tree

1 file changed

+25
-0
lines changed
  • app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product

1 file changed

+25
-0
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Link/Product/Collection.php

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,4 +362,29 @@ private function joinProductsToLinks()
362362
);
363363
}
364364
}
365+
366+
/**
367+
* After the collection has been loaded
368+
*
369+
* @SuppressWarnings(PHPMD.CamelCaseMethodName)
370+
* @return $this
371+
*/
372+
protected function _afterLoad()
373+
{
374+
if ($this->getLinkModel()) {
375+
$attributes = $this->getLinkAttributes();
376+
foreach ($this as $item) {
377+
foreach ($attributes as $attribute) {
378+
$code = $attribute['code'];
379+
$value = $item->getData($code);
380+
if ($value !== null) {
381+
if ($attribute['type'] == 'decimal') {
382+
$item->setData($code, (float)$value);
383+
}
384+
}
385+
}
386+
}
387+
}
388+
return parent::_afterLoad();
389+
}
365390
}

0 commit comments

Comments
 (0)