I've been asked to reverse engineer some orders (from an Ebay Extension) and find out which store they really used.
To flesh out an example; we run several stores from one Magento backend selling various products. These are all sold on eBay using a single merchant account.
So what I need to do is load the order as it stands assigned against the eBay store, load the items attached to that order and then see what other stores that item is used on. Once I get that far I can simply filter out the admin storeID and the eBay storeID which will leave with the store I'm looking for.
this is what I have so far:
foreach($collection->getItems() as $order):
// need to do this to load correct order information
$order = Mage::getModel('sales/order')->loadByIncrementID($order->getIncrementId());
$items = $order->getItemsCollection();
foreach($items as $item) {
// need to do this to get the actual item, not the item on the order
$item = Mage::getModel('catalog/product')->load($item->getItemId());
// do something to get the other store ids
}
endforeach;