Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
module-backend
Model
Widget
Grid
Totals.php
Go to the documentation of this file.
1
<?php
6
namespace
Magento\Backend\Model\Widget\Grid
;
7
12
class
Totals
extends
\Magento\Backend\Model\Widget\Grid\AbstractTotals
13
{
21
protected
function
_countSum
(
$index
,
$collection
)
22
{
23
$sum = 0;
24
foreach
(
$collection
as
$item
) {
25
if
(!
$item
->hasChildren()) {
26
$sum +=
$item
[
$index
];
27
}
else
{
28
$sum += $this->
_countSum
(
$index
, $item->getChildren());
29
}
30
}
31
return
$sum;
32
}
33
41
protected
function
_countAverage
(
$index
,
$collection
)
42
{
43
$itemsCount = 0;
44
foreach
(
$collection
as
$item
) {
45
if
(!
$item
->hasChildren()) {
46
$itemsCount += 1;
47
}
else
{
48
$itemsCount += count(
$item
->getChildren());
49
}
50
}
51
52
return
$itemsCount ? $this->
_countSum
(
$index
,
$collection
) / $itemsCount : $itemsCount;
53
}
54
}
Magento\Backend\Model\Widget\Grid\Totals
Definition:
Totals.php:12
Magento\Backend\Model\Widget\Grid\AbstractTotals
Definition:
AbstractTotals.php:13
$item
$item
Definition:
partial_invoice.php:27
Magento\Backend\Model\Widget\Grid\Totals\_countAverage
_countAverage($index, $collection)
Definition:
Totals.php:41
Magento\Backend\Model\Widget\Grid\Totals\_countSum
_countSum($index, $collection)
Definition:
Totals.php:21
Magento\Backend\Model\Widget\Grid
Definition:
AbstractTotals.php:7
$index
$index
Definition:
list.phtml:44
$collection
$collection
Definition:
catalog_category_with_apostrophe_rollback.php:17