getEvent()->getTrack(); $order = $track->getShipment()->getOrder(); $shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method' if (!$shippingMethod) { return; } // Process only Google Checkout internal methods /* @var $gcCarrier Mage_GoogleCheckout_Model_Shipping */ $gcCarrier = Mage::getModel('googlecheckout/shipping'); list($carrierCode, $methodCode) = explode('_', $shippingMethod); if ($gcCarrier->getCarrierCode() != $carrierCode) { return; } $internalMethods = $gcCarrier->getInternallyAllowedMethods(); if (!isset($internalMethods[$methodCode])) { return; } Mage::getModel('googlecheckout/api') ->setStoreId($order->getStoreId()) ->deliver($order->getExtOrderId(), $track->getCarrierCode(), $track->getNumber()); } /* * Performs specifical actions on Google Checkout internal shipments saving * * @param Varien_Event_Observer $observer * @return void */ public function salesOrderShipmentSaveAfter(Varien_Event_Observer $observer) { $shipment = $observer->getEvent()->getShipment(); $order = $shipment->getOrder(); $shippingMethod = $order->getShippingMethod(); // String in format of 'carrier_method' if (!$shippingMethod) { return; } // Process only Google Checkout internal methods /* @var $gcCarrier Mage_GoogleCheckout_Model_Shipping */ $gcCarrier = Mage::getModel('googlecheckout/shipping'); list($carrierCode, $methodCode) = explode('_', $shippingMethod); if ($gcCarrier->getCarrierCode() != $carrierCode) { return; } $internalMethods = $gcCarrier->getInternallyAllowedMethods(); if (!isset($internalMethods[$methodCode])) { return; } // Process this saving $items = array(); foreach ($shipment->getAllItems() as $item) { if ($item->getOrderItem()->getParentItemId()) { continue; } $items[] = $item->getSku(); } if ($items) { Mage::getModel('googlecheckout/api') ->setStoreId($order->getStoreId()) ->shipItems($order->getExtOrderId(), $items); } } }