* All rights reserved * * Reuse or modification of this source code is not allowed * without written permission from creativestyle GmbH * * @category Creativestyle * @package Creativestyle_CheckoutByAmazon * @copyright Copyright (c) 2011 creativestyle GmbH (http://www.creativestyle.de) * @author Marek Zabrowarny / creativestyle GmbH */ class Creativestyle_CheckoutByAmazon_Model_Mysql4_Log_Feed_Collection extends Creativestyle_CheckoutByAmazon_Model_Mysql4_Log_Collection_Abstract { protected $_modelName = 'checkoutbyamazon/log_feed'; protected function _afterLoad() { parent::_afterLoad(); $feedsToUpdate = array(); $feedStatuses = array(); foreach ($this as $item) { if ($item->getProcessingStatus() != '_DONE_') { $feedsToUpdate[] = $item->getSubmissionId(); } } if (count($feedsToUpdate)) { $api = Mage::getModel('checkoutbyamazon/api_marketplace_feeds'); $feedSubmissionList = $api->getFeedSubmissionList($feedsToUpdate); if ($feedSubmissionList->issetFeedSubmissionInfo()) { $feedSubmissionInfo = $feedSubmissionList->getFeedSubmissionInfo(); if (is_array($feedSubmissionInfo)) { foreach ($feedSubmissionInfo as $_feed) { $feedStatuses[$_feed->getFeedSubmissionId()] = $_feed->getFeedProcessingStatus(); } } } } if (count($feedStatuses)) { foreach ($this as $item) { if (($item->getProcessingStatus() != '_DONE_') && isset($feedStatuses[$item->getSubmissionId()]) && $feedStatuses[$item->getSubmissionId()] != $item->getProcessingStatus()) { $item->setProcessingStatus($feedStatuses[$item->getSubmissionId()])->save(); } } } return $this; } }