private function addAmazonMarketplacesNotUpdatedNotificationMessage(Ess_M2ePro_Controller_Adminhtml_BaseController $controller) { $outdatedMarketplaces = Mage::helper('M2ePro/Data_Cache_Permanent')->getValue('amazon_outdated_marketplaces'); if ($outdatedMarketplaces === false) { $resource = Mage::getSingleton('core/resource'); $readConn = $resource->getConnection('core_read'); $dictionaryTable = $resource->getTableName('m2epro_amazon_dictionary_marketplace'); $rows = $readConn->select()->from($dictionaryTable, 'marketplace_id')->where('client_details_last_update_date IS NOT NULL')->where('server_details_last_update_date IS NOT NULL')->where('client_details_last_update_date < server_details_last_update_date')->query(); $ids = array(); foreach ($rows as $row) { $ids[] = $row['marketplace_id']; } $marketplacesCollection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Marketplace')->addFieldToFilter('status', Ess_M2ePro_Model_Marketplace::STATUS_ENABLE)->addFieldToFilter('id', array('in' => $ids))->setOrder('sorder', 'ASC'); $outdatedMarketplaces = array(); /* @var $marketplace Ess_M2ePro_Model_Marketplace */ foreach ($marketplacesCollection as $marketplace) { $outdatedMarketplaces[] = $marketplace->getTitle(); } Mage::helper('M2ePro/Data_Cache_Permanent')->setValue('amazon_outdated_marketplaces', $outdatedMarketplaces, array('amazon', 'marketplace'), 60 * 60 * 24); } if (count($outdatedMarketplaces) <= 0) { return; } // M2ePro_TRANSLATIONS // %marketplace_title% data was changed on Amazon. You need to synchronize it the Extension works properly. Please, go to %menu_label% > <a href="%url%" target="_blank">Marketplaces</a> and click the Update All Button. $message = '%marketplace_title% data was changed on Amazon. You need to synchronize it ' . 'the Extension works properly. Please, go to %menu_path% > ' . '<a href="%url%" target="_blank">Marketplaces</a> and click the Update All Button.'; $controller->getSession()->addNotice(Mage::helper('M2ePro')->__($message, implode(', ', $outdatedMarketplaces), Mage::helper('M2ePro/View_Common')->getMenuPath('configuration'), $controller->getUrl('*/adminhtml_common_marketplace', array('tab' => Ess_M2ePro_Helper_Component_Amazon::NICK)))); }
private function addMarketplacesCategoriesVersionNotificationMessage(Ess_M2ePro_Controller_Adminhtml_BaseController $controller) { $outdatedMarketplaces = Mage::helper('M2ePro/Data_Cache')->getValue('outdated_marketplaces'); if ($outdatedMarketplaces === false) { $readConn = Mage::getSingleton('core/resource')->getConnection('core_read'); $dictionaryTable = Mage::getSingleton('core/resource')->getTableName('m2epro_ebay_dictionary_marketplace'); $rows = $readConn->select()->from($dictionaryTable, 'marketplace_id')->where('client_categories_version IS NOT NULL')->where('server_categories_version IS NOT NULL')->where('client_categories_version < server_categories_version')->query(); $ids = array(); foreach ($rows as $row) { $ids[] = $row['marketplace_id']; } $marketplacesCollection = Mage::helper('M2ePro/Component_Ebay')->getCollection('Marketplace')->addFieldToFilter('id', array('in' => $ids)); $outdatedMarketplaces = array(); /* @var $marketplace Ess_M2ePro_Model_Marketplace */ foreach ($marketplacesCollection as $marketplace) { $outdatedMarketplaces[] = $marketplace->getTitle(); } Mage::helper('M2ePro/Data_Cache')->setValue('outdated_marketplaces', $outdatedMarketplaces, array('ebay', 'marketplace'), 60 * 60 * 24); } if (count($outdatedMarketplaces) <= 0) { return; } $message = '%s data was changed on eBay. You need to synchronize it the extension works properly. Please, go to %s > Configuration > <a href="%s" target="_blank">eBay Sites</a> and click the Save And Update button.'; $controller->getSession()->addNotice(Mage::helper('M2ePro')->__($message, implode(', ', $outdatedMarketplaces), Mage::helper('M2ePro/View_Ebay')->getMenuRootNodeLabel(), $controller->getUrl('*/adminhtml_ebay_marketplace', array('tab' => Ess_M2ePro_Block_Adminhtml_Ebay_Configuration_Tabs::TAB_ID_MARKETPLACE)))); }