Thanks to Joseph Mastey, I was able to create a module for Magento that calculated shipping by the heaviest item, rather than the total weight of a shopping cart.
Using this:
class MyNamespace_MyModule_Model_Shipping extends Mage_Shipping_Model_Shipping {
public function collectRates(Mage_Shipping_Model_Rate_Request $request) {
$maxWeight = 0;
foreach($request->getAllItems() as $item) {
$maxWeight = max($maxWeight, $item->getRowWeight());
}
$request->setPackageWeight($maxWeight);
return parent::collectRates($request);
}
}
However, now, it has stopped working, and it is back to calculating shipping based on total weight. I have run no updates, and was wondering if anyone had a clue as to why this function no longer works? Any ideas would be greatly appreciated.
I’ve just resolved this myself actually. Found some lines in the Matrixrate addon by Webshopapps that was overriding my hacked weight calculations. Namely: $request->setPackageWeight($request->getFreeMethodWeight()); I’ve commented this out, not the perfect solution I know, but it has restored my desired weight calculations.