我想在Magento网格的末尾添加总数,所以我使用了getTotals函数。此函数对所有列都工作得很好。但是有些栏目有渲染器,在这种情况下,我没有得到渲染器栏目的总数,请给出任何想法,我如何才能做到这一点?有关钙化,请参阅附件图像:


发布于 2019-09-26 20:39:49
在Grid.php中设置getTotals函数
public function getTotals()
{
$totals = new Varien_Object();
$fields = array(
'subtotal' => 0, //actual column index, see _prepareColumns()
'productargin' => 0
);
foreach ($this->getCollection() as $item) {
foreach($fields as $field=>$value){
$fields[$field]+=$item->getData($field);
}
}
//First column in the grid
$fields['entity_id']='Totals';
$totals->setData($fields);
return $totals;
}https://stackoverflow.com/questions/36477026
复制相似问题