<?php
$configArray = json_decode('{"nominal":{"class":"sales\/quote_address_total_nominal","before":["subtotal"],"renderer":"checkout\/total_nominal","after":[],"_code":"nominal"},"subtotal":{"class":"sales\/quote_address_total_subtotal","after":["nominal"],"before":["grand_total"],"renderer":"tax\/checkout_subtotal","admin_renderer":"adminhtml\/sales_order_create_totals_subtotal","_code":"subtotal"},"shipping":{"class":"sales\/quote_address_total_shipping","after":["subtotal","freeshipping","tax_subtotal"],"before":["grand_total"],"renderer":"tax\/checkout_shipping","admin_renderer":"adminhtml\/sales_order_create_totals_shipping","_code":"shipping"},"grand_total":{"class":"sales\/quote_address_total_grand","after":["subtotal"],"renderer":"tax\/checkout_grandtotal","admin_renderer":"adminhtml\/sales_order_create_totals_grandtotal","before":[],"_code":"grand_total"},"msrp":{"class":"sales\/quote_address_total_msrp","before":[],"after":[],"_code":"msrp"},"freeshipping":{"class":"salesrule\/quote_freeshipping","after":["subtotal"],"before":["tax_subtotal","shipping"],"_code":"freeshipping"},"discount":{"class":"salesrule\/quote_discount","after":["subtotal","shipping"],"before":["grand_total"],"renderer":"tax\/checkout_discount","admin_renderer":"adminhtml\/sales_order_create_totals_discount","_code":"discount"},"tax_subtotal":{"class":"tax\/sales_total_quote_subtotal","after":["freeshipping"],"before":["tax","discount"],"_code":"tax_subtotal"},"tax_shipping":{"class":"tax\/sales_total_quote_shipping","after":["shipping","tax_subtotal"],"before":["tax","discount"],"_code":"tax_shipping"},"tax":{"class":"tax\/sales_total_quote_tax","after":["subtotal","shipping","discount"],"before":["grand_total"],"renderer":"tax\/checkout_tax","admin_renderer":"adminhtml\/sales_order_create_totals_tax","_code":"tax"},"weee":{"class":"weee\/total_quote_weee","after":["subtotal","tax_subtotal"],"before":["shipping","tax","discount"],"_code":"weee"}}', true);
foreach ($configArray as $code => $data) {
foreach ($data['before'] as $beforeCode) {
if (!isset($configArray[$beforeCode])) {
continue;
}
$configArray[$code]['before'] = array_unique(array_merge(
$configArray[$code]['before'], $configArray[$beforeCode]['before']
));
$configArray[$beforeCode]['after'] = array_merge(
$configArray[$beforeCode]['after'], array($code), $data['after']
);
$configArray[$beforeCode]['after'] = array_unique($configArray[$beforeCode]['after']);
}
foreach ($data['after'] as $afterCode) {
if (!isset($configArray[$afterCode])) {
continue;
}
$configArray[$code]['after'] = array_unique(array_merge(
$configArray[$code]['after'], $configArray[$afterCode]['after']
));
$configArray[$afterCode]['before'] = array_merge(
$configArray[$afterCode]['before'], array($code), $data['before']
);
$configArray[$afterCode]['before'] = array_unique($configArray[$afterCode]['before']);
}
}
uasort($configArray, function($a, $b) {
$aCode = $a['_code'];
$bCode = $b['_code'];
if (in_array($aCode, $b['after']) || in_array($bCode, $a['before'])) {
$res = -1;
} elseif (in_array($bCode, $a['after']) || in_array($aCode, $b['before'])) {
$res = 1;
} else {
$res = 0;
}
return $res;
});
print_r($configArray);
- Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.4, 8.3.6
- Array
(
[nominal] => Array
(
[class] => sales/quote_address_total_nominal
[before] => Array
(
[0] => subtotal
[1] => grand_total
)
[renderer] => checkout/total_nominal
[after] => Array
(
)
[_code] => nominal
)
[subtotal] => Array
(
[class] => sales/quote_address_total_subtotal
[after] => Array
(
[0] => nominal
)
[before] => Array
(
[0] => grand_total
[1] => shipping
[2] => freeshipping
[3] => tax_subtotal
[4] => discount
[5] => tax
[6] => weee
)
[renderer] => tax/checkout_subtotal
[admin_renderer] => adminhtml/sales_order_create_totals_subtotal
[_code] => subtotal
)
[shipping] => Array
(
[class] => sales/quote_address_total_shipping
[after] => Array
(
[0] => subtotal
[1] => freeshipping
[2] => tax_subtotal
[3] => nominal
[4] => weee
)
[before] => Array
(
[0] => grand_total
[1] => discount
[2] => tax_shipping
[3] => tax
)
[renderer] => tax/checkout_shipping
[admin_renderer] => adminhtml/sales_order_create_totals_shipping
[_code] => shipping
)
[grand_total] => Array
(
[class] => sales/quote_address_total_grand
[after] => Array
(
[0] => subtotal
[1] => nominal
[2] => shipping
[3] => freeshipping
[4] => tax_subtotal
[5] => discount
[6] => tax
)
[renderer] => tax/checkout_grandtotal
[admin_renderer] => adminhtml/sales_order_create_totals_grandtotal
[before] => Array
(
)
[_code] => grand_total
)
[msrp] => Array
(
[class] => sales/quote_address_total_msrp
[before] => Array
(
)
[after] => Array
(
)
[_code] => msrp
)
[freeshipping] => Array
(
[class] => salesrule/quote_freeshipping
[after] => Array
(
[0] => subtotal
[1] => nominal
)
[before] => Array
(
[0] => tax_subtotal
[1] => shipping
[2] => grand_total
[3] => tax
[4] => discount
)
[_code] => freeshipping
)
[tax_subtotal] => Array
(
[class] => tax/sales_total_quote_subtotal
[after] => Array
(
[0] => freeshipping
[1] => subtotal
[3] => nominal
)
[before] => Array
(
[0] => tax
[1] => discount
[2] => shipping
[3] => grand_total
[4] => tax_shipping
[5] => weee
)
[_code] => tax_subtotal
)
[weee] => Array
(
[class] => weee/total_quote_weee
[after] => Array
(
[0] => subtotal
[1] => tax_subtotal
[2] => nominal
[3] => freeshipping
)
[before] => Array
(
[0] => shipping
[1] => tax
[2] => discount
[3] => grand_total
[4] => tax_shipping
)
[_code] => weee
)
[tax_shipping] => Array
(
[class] => tax/sales_total_quote_shipping
[after] => Array
(
[0] => shipping
[1] => tax_subtotal
[2] => subtotal
[3] => freeshipping
[4] => nominal
)
[before] => Array
(
[0] => tax
[1] => discount
[2] => grand_total
)
[_code] => tax_shipping
)
[discount] => Array
(
[class] => salesrule/quote_discount
[after] => Array
(
[0] => subtotal
[1] => shipping
[2] => nominal
[3] => freeshipping
[4] => tax_subtotal
[5] => tax_shipping
[6] => weee
)
[before] => Array
(
[0] => grand_total
[1] => tax
)
[renderer] => tax/checkout_discount
[admin_renderer] => adminhtml/sales_order_create_totals_discount
[_code] => discount
)
[tax] => Array
(
[class] => tax/sales_total_quote_tax
[after] => Array
(
[0] => subtotal
[1] => shipping
[2] => discount
[3] => tax_subtotal
[4] => freeshipping
[5] => tax_shipping
[6] => nominal
[7] => weee
)
[before] => Array
(
[0] => grand_total
)
[renderer] => tax/checkout_tax
[admin_renderer] => adminhtml/sales_order_create_totals_tax
[_code] => tax
)
)
- Output for 8.3.5
- Warning: PHP Startup: Unable to load dynamic library 'sodium.so' (tried: /usr/lib/php/8.3.5/modules/sodium.so (libsodium.so.23: cannot open shared object file: No such file or directory), /usr/lib/php/8.3.5/modules/sodium.so.so (/usr/lib/php/8.3.5/modules/sodium.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
Array
(
[nominal] => Array
(
[class] => sales/quote_address_total_nominal
[before] => Array
(
[0] => subtotal
[1] => grand_total
)
[renderer] => checkout/total_nominal
[after] => Array
(
)
[_code] => nominal
)
[subtotal] => Array
(
[class] => sales/quote_address_total_subtotal
[after] => Array
(
[0] => nominal
)
[before] => Array
(
[0] => grand_total
[1] => shipping
[2] => freeshipping
[3] => tax_subtotal
[4] => discount
[5] => tax
[6] => weee
)
[renderer] => tax/checkout_subtotal
[admin_renderer] => adminhtml/sales_order_create_totals_subtotal
[_code] => subtotal
)
[shipping] => Array
(
[class] => sales/quote_address_total_shipping
[after] => Array
(
[0] => subtotal
[1] => freeshipping
[2] => tax_subtotal
[3] => nominal
[4] => weee
)
[before] => Array
(
[0] => grand_total
[1] => discount
[2] => tax_shipping
[3] => tax
)
[renderer] => tax/checkout_shipping
[admin_renderer] => adminhtml/sales_order_create_totals_shipping
[_code] => shipping
)
[grand_total] => Array
(
[class] => sales/quote_address_total_grand
[after] => Array
(
[0] => subtotal
[1] => nominal
[2] => shipping
[3] => freeshipping
[4] => tax_subtotal
[5] => discount
[6] => tax
)
[renderer] => tax/checkout_grandtotal
[admin_renderer] => adminhtml/sales_order_create_totals_grandtotal
[before] => Array
(
)
[_code] => grand_total
)
[msrp] => Array
(
[class] => sales/quote_address_total_msrp
[before] => Array
(
)
[after] => Array
(
)
[_code] => msrp
)
[freeshipping] => Array
(
[class] => salesrule/quote_freeshipping
[after] => Array
(
[0] => subtotal
[1] => nominal
)
[before] => Array
(
[0] => tax_subtotal
[1] => shipping
[2] => grand_total
[3] => tax
[4] => discount
)
[_code] => freeshipping
)
[tax_subtotal] => Array
(
[class] => tax/sales_total_quote_subtotal
[after] => Array
(
[0] => freeshipping
[1] => subtotal
[3] => nominal
)
[before] => Array
(
[0] => tax
[1] => discount
[2] => shipping
[3] => grand_total
[4] => tax_shipping
[5] => weee
)
[_code] => tax_subtotal
)
[weee] => Array
(
[class] => weee/total_quote_weee
[after] => Array
(
[0] => subtotal
[1] => tax_subtotal
[2] => nominal
[3] => freeshipping
)
[before] => Array
(
[0] => shipping
[1] => tax
[2] => discount
[3] => grand_total
[4] => tax_shipping
)
[_code] => weee
)
[tax_shipping] => Array
(
[class] => tax/sales_total_quote_shipping
[after] => Array
(
[0] => shipping
[1] => tax_subtotal
[2] => subtotal
[3] => freeshipping
[4] => nominal
)
[before] => Array
(
[0] => tax
[1] => discount
[2] => grand_total
)
[_code] => tax_shipping
)
[discount] => Array
(
[class] => salesrule/quote_discount
[after] => Array
(
[0] => subtotal
[1] => shipping
[2] => nominal
[3] => freeshipping
[4] => tax_subtotal
[5] => tax_shipping
[6] => weee
)
[before] => Array
(
[0] => grand_total
[1] => tax
)
[renderer] => tax/checkout_discount
[admin_renderer] => adminhtml/sales_order_create_totals_discount
[_code] => discount
)
[tax] => Array
(
[class] => tax/sales_total_quote_tax
[after] => Array
(
[0] => subtotal
[1] => shipping
[2] => discount
[3] => tax_subtotal
[4] => freeshipping
[5] => tax_shipping
[6] => nominal
[7] => weee
)
[before] => Array
(
[0] => grand_total
)
[renderer] => tax/checkout_tax
[admin_renderer] => adminhtml/sales_order_create_totals_tax
[_code] => tax
)
)
- Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
- Array
(
[nominal] => Array
(
[class] => sales/quote_address_total_nominal
[before] => Array
(
[0] => subtotal
[1] => grand_total
)
[renderer] => checkout/total_nominal
[after] => Array
(
)
[_code] => nominal
)
[subtotal] => Array
(
[class] => sales/quote_address_total_subtotal
[after] => Array
(
[0] => nominal
)
[before] => Array
(
[0] => grand_total
[1] => shipping
[2] => freeshipping
[3] => tax_subtotal
[4] => discount
[5] => tax
[6] => weee
)
[renderer] => tax/checkout_subtotal
[admin_renderer] => adminhtml/sales_order_create_totals_subtotal
[_code] => subtotal
)
[msrp] => Array
(
[class] => sales/quote_address_total_msrp
[before] => Array
(
)
[after] => Array
(
)
[_code] => msrp
)
[freeshipping] => Array
(
[class] => salesrule/quote_freeshipping
[after] => Array
(
[0] => subtotal
[1] => nominal
)
[before] => Array
(
[0] => tax_subtotal
[1] => shipping
[2] => grand_total
[3] => tax
[4] => discount
)
[_code] => freeshipping
)
[tax_subtotal] => Array
(
[class] => tax/sales_total_quote_subtotal
[after] => Array
(
[0] => freeshipping
[1] => subtotal
[3] => nominal
)
[before] => Array
(
[0] => tax
[1] => discount
[2] => shipping
[3] => grand_total
[4] => tax_shipping
[5] => weee
)
[_code] => tax_subtotal
)
[weee] => Array
(
[class] => weee/total_quote_weee
[after] => Array
(
[0] => subtotal
[1] => tax_subtotal
[2] => nominal
[3] => freeshipping
)
[before] => Array
(
[0] => shipping
[1] => tax
[2] => discount
[3] => grand_total
[4] => tax_shipping
)
[_code] => weee
)
[shipping] => Array
(
[class] => sales/quote_address_total_shipping
[after] => Array
(
[0] => subtotal
[1] => freeshipping
[2] => tax_subtotal
[3] => nominal
[4] => weee
)
[before] => Array
(
[0] => grand_total
[1] => discount
[2] => tax_shipping
[3] => tax
)
[renderer] => tax/checkout_shipping
[admin_renderer] => adminhtml/sales_order_create_totals_shipping
[_code] => shipping
)
[tax_shipping] => Array
(
[class] => tax/sales_total_quote_shipping
[after] => Array
(
[0] => shipping
[1] => tax_subtotal
[2] => subtotal
[3] => freeshipping
[4] => nominal
)
[before] => Array
(
[0] => tax
[1] => discount
[2] => grand_total
)
[_code] => tax_shipping
)
[discount] => Array
(
[class] => salesrule/quote_discount
[after] => Array
(
[0] => subtotal
[1] => shipping
[2] => nominal
[3] => freeshipping
[4] => tax_subtotal
[5] => tax_shipping
[6] => weee
)
[before] => Array
(
[0] => grand_total
[1] => tax
)
[renderer] => tax/checkout_discount
[admin_renderer] => adminhtml/sales_order_create_totals_discount
[_code] => discount
)
[tax] => Array
(
[class] => tax/sales_total_quote_tax
[after] => Array
(
[0] => subtotal
[1] => shipping
[2] => discount
[3] => tax_subtotal
[4] => freeshipping
[5] => tax_shipping
[6] => nominal
[7] => weee
)
[before] => Array
(
[0] => grand_total
)
[renderer] => tax/checkout_tax
[admin_renderer] => adminhtml/sales_order_create_totals_tax
[_code] => tax
)
[grand_total] => Array
(
[class] => sales/quote_address_total_grand
[after] => Array
(
[0] => subtotal
[1] => nominal
[2] => shipping
[3] => freeshipping
[4] => tax_subtotal
[5] => discount
[6] => tax
)
[renderer] => tax/checkout_grandtotal
[admin_renderer] => adminhtml/sales_order_create_totals_grandtotal
[before] => Array
(
)
[_code] => grand_total
)
)
preferences:
251.22 ms | 417 KiB | 212 Q