/** * Get all items shipping to a given address. For billing addresses, this * will be all virtual items in the order. For shipping addresses, any * non-virtual items. Only items that are to be included in the order create * request should be returned. * * @param Mage_Customer_Model_Address_Abstract * @param Mage_Sales_Model_Resource_Order_Item_Collection * @return Mage_Sales_Model_Order_Item[] */ protected function _getItemsForAddress(Mage_Customer_Model_Address_Abstract $address, Mage_Sales_Model_Resource_Order_Item_Collection $orderItems) { // All items will have an `order_address_id` matching the id of the // address the item ships to (including virtual items which "ship" to // the billing address). // Filter the given collection instead of using address methods to get // items to prevent loading separate item collections for each address. return $this->_itemSelection->selectFrom($orderItems->getItemsByColumnValue('order_address_id', $address->getId())); }
/** * Determine if the address is from the customers address book or is a new address * @param Mage_Customer_Model_Address_Abstract $address * @return bool */ protected function _isAddressFromAddressBook(Mage_Customer_Model_Address_Abstract $address) { return $address->getId() && $address->getCustomerId() && $address->getCustomerAddressId(); }