I'm trying to add an oversized fee for large products. Most of what that entails is a little more complicated than I want to explain here. Basically, I've built a custom function to check if the product is oversized and assign the appropriate shipping cost. However, I can't figure out how to get that value added into the grand total at check out.
Magento automatically combines the subtotal and grandtotal of the addresses for you, see Mage_Sales_Model_Quote::collectTotals
$this->setSubtotal((float) $this->getSubtotal()+$address->getSubtotal()); $this->setBaseSubtotal((float) $this->getBaseSubtotal()+$address->getBaseSubtotal()); $this->setGrandTotal((float) $this->getGrandTotal()+$address->getGrandTotal()); $this->setBaseGrandTotal((float) $this->getBaseGrandTotal()+$address->getBaseGrandTotal());
Adding your extra charge to the address subtotal and grandtotal will ensure it is reflected in the overall grand total.
For more in depth reading on the checkout process I can thoroughly recommend this post by Chris @ Classy Llama.
Please have a look at http://www.excellencemagentoblog.com/magento-add-fee-discount-order-total
This tutorial may fulfill your requirement.
I will second @Fooman's recommendation of the blog series on collect totals... won't claim to not be biased though since I do, after all, work with the author of the series. ;)
That said, Web Shop Apps has pre-existing modules for almost anything shipping related. And from the sound of it, one perfectly suited to your needs. The Handling Fees Matrix module in particular sounds it could serve your needs well without any custom development. Simply install, setup the matrix rules to apply the added handling fee and voila!