Ejemplo n.º 1
0
 protected function logSuccessfulOperation(Ess_M2ePro_Model_Marketplace $marketplace)
 {
     // M2ePro_TRANSLATIONS
     // The "Details" Action for %amazon% Marketplace: "%mrk%" has been successfully completed.
     $tempString = Mage::getModel('M2ePro/Log_Abstract')->encodeDescription('The "Details" Action for %amazon% Marketplace: "%mrk%" has been successfully completed.', array('!amazon' => Mage::helper('M2ePro/Component_Amazon')->getTitle(), 'mrk' => $marketplace->getTitle()));
     $this->getLog()->addMessage($tempString, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
 }
 protected function logSuccessfulOperation(Ess_M2ePro_Model_Marketplace $marketplace)
 {
     // M2ePro_TRANSLATIONS
     // The "Categories" action for Rakuten Marketplace: "%mrk%" has been successfully completed.
     $tempString = Mage::getModel('M2ePro/Log_Abstract')->encodeDescription('The "Categories" action for Rakuten Marketplace: "%mrk%" has been successfully completed.', array('mrk' => $marketplace->getTitle()));
     $this->getLog()->addMessage($tempString, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
 }
Ejemplo n.º 3
0
 private function updateAccountMarketplace(Ess_M2ePro_Model_Account $accountObj, Ess_M2ePro_Model_Marketplace $marketplaceObj)
 {
     $this->_profiler->addTitle('Starting account "' . $accountObj->getTitle() . '" and marketplace "' . $marketplaceObj->getTitle() . '"');
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $accountObj->getId(), 'Get inventory from Amazon');
     $tempString = 'Task "3rd Party Listings Synchronization" for Amazon account: ';
     $tempString .= '"%s" and marketplace "%s" is started. Please wait...';
     $this->_lockItem->setStatus(Mage::helper('M2ePro')->__($tempString, $accountObj->getTitle(), $marketplaceObj->getTitle()));
     // Get all changes on Amazon for account
     //---------------------------
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Amazon_Dispatcher');
     $dispatcherObject->processConnector('tasks', 'otherListings', 'requester', array(), $marketplaceObj, $accountObj, 'Ess_M2ePro_Model_Amazon_Synchronization');
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $accountObj->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 4
0
 private function updateAccountMarketplace(Ess_M2ePro_Model_Account $accountObj, Ess_M2ePro_Model_Marketplace $marketplaceObj)
 {
     $this->_profiler->addTitle('Starting account "' . $accountObj->getTitle() . '" and marketplace "' . $marketplaceObj->getTitle() . '"');
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $accountObj->getId(), 'Get orders from Amazon');
     //->__('Task "Orders Synchronization" for Amazon account: "%s" and marketplace "%s" is started. Please wait...')
     $tempString = 'Task "Orders Synchronization" for Amazon account: ';
     $tempString .= '"%s" and marketplace "%s" is started. Please wait...';
     $this->_lockItem->setStatus(Mage::helper('M2ePro')->__($tempString, $accountObj->getTitle(), $marketplaceObj->getTitle()));
     // Get orders from Amazon for account
     //---------------------------
     $fromDate = $this->prepareFromDate($accountObj->getData('orders_last_synchronization'));
     $params = array('from_date' => $fromDate);
     if (is_null($accountObj->getData('orders_last_synchronization'))) {
         $accountObj->setData('orders_last_synchronization', $fromDate)->save();
     }
     $dispatcherObject = Mage::getModel('M2ePro/Amazon_Connector')->getDispatcher();
     $dispatcherObject->processConnector('tasks', 'orders', 'requester', $params, $marketplaceObj, $accountObj, 'Ess_M2ePro_Model_Amazon_Synchronization');
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $accountObj->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 5
0
 private function processAccountMarketplaceInventoryTitle(Ess_M2ePro_Model_Account $accountObj, Ess_M2ePro_Model_Marketplace $marketplaceObj)
 {
     $firstSynchronizationTime = $accountObj->getChildObject()->getOtherListingsFirstSynchronization();
     if (is_null($firstSynchronizationTime) || strtotime($firstSynchronizationTime) + 3 * 3600 > Mage::helper('M2ePro')->getCurrentGmtDate(true)) {
         return;
     }
     $this->_profiler->addTitle('Starting account "' . $accountObj->getTitle() . '" and marketplace "' . $marketplaceObj->getTitle() . '"');
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $accountObj->getId(), 'Get inventory from Buy');
     $tempString = Mage::helper('M2ePro')->__('Task "3rd Party Listings Synchronization" for Rakuten.com account: ');
     $tempString .= Mage::helper('M2ePro')->__('"%s" and marketplace "%s" is started. Please wait...', $accountObj->getTitle(), Mage::helper('M2ePro')->__($marketplaceObj->getTitle()));
     $this->_lockItem->setStatus($tempString);
     $updateByPagesSettings = $accountObj->getChildObject()->getDecodedOtherListingsUpdateTitlesSettings();
     if (is_null($updateByPagesSettings) || (int) $updateByPagesSettings['next_status'] <= 2 && (int) $updateByPagesSettings['next_page'] < 10000) {
         $this->updateInventoryTitlesByPages($accountObj, $marketplaceObj);
     } else {
         $this->updateInventoryTitlesBySkus($accountObj, $marketplaceObj);
     }
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $accountObj->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 6
0
 private function processAccountMarketplace(Ess_M2ePro_Model_Account $account, Ess_M2ePro_Model_Marketplace $marketplace)
 {
     $title = 'Starting account "' . $account->getTitle() . '" and marketplace "' . $marketplace->getTitle() . '"';
     $this->_profiler->addTitle($title);
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Update orders on Buy');
     $statusString = 'Task "Orders Update Synchronization" for Rakuten.com "%s" Account and "%s" marketplace ';
     $statusString .= 'is started. Please wait...';
     $status = Mage::helper('M2ePro')->__($statusString, $account->getTitle(), $marketplace->getTitle());
     $this->_lockItem->setStatus($status);
     $changesCollection = Mage::getModel('M2ePro/Order_Change')->getCollection();
     $changesCollection->addAccountFilter($account->getId());
     $changesCollection->addFieldToFilter('action', Ess_M2ePro_Model_Order_Change::ACTION_UPDATE_SHIPPING);
     if ($changesCollection->getSize() == 0) {
         return;
     }
     // Update orders shipping status on Rakuten.com
     //---------------------------
     $params = array();
     foreach ($changesCollection as $change) {
         $changeParams = $change->getParams();
         $params[] = array('order_id' => $change->getOrderId(), 'buy_order_id' => $changeParams['buy_order_id'], 'buy_order_item_id' => $changeParams['buy_order_item_id'], 'qty' => $changeParams['qty'], 'tracking_type' => $changeParams['tracking_type'], 'tracking_number' => $changeParams['tracking_number'], 'ship_date' => $changeParams['ship_date']);
     }
     /** @var $dispatcherObject Ess_M2ePro_Model_Connector_Server_Buy_Dispatcher */
     $dispatcherObject = Mage::getModel('M2ePro/Buy_Connector')->getDispatcher();
     $dispatcherObject->processConnector('orders', 'update', 'shipping', $params, $marketplace, $account);
     $changesCollection->walk('delete');
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 7
0
 private function updateAccountMarketplace(Ess_M2ePro_Model_Account $accountObj, Ess_M2ePro_Model_Marketplace $marketplaceObj)
 {
     $this->_profiler->addTitle('Starting account "' . $accountObj->getTitle() . '" and marketplace "' . $marketplaceObj->getTitle() . '"');
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $accountObj->getId(), 'Get inventory from Buy');
     $status = 'Task "Update Listings Products" for Rakuten.com account: "%s" and marketplace "%s" ';
     $status .= 'is started. Please wait...';
     $this->_lockItem->setStatus(Mage::helper('M2ePro')->__($status, $accountObj->getTitle(), $marketplaceObj->getTitle()));
     // Get all changes on Buy for account
     //---------------------------
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Buy_Dispatcher');
     $dispatcherObject->processConnector('defaults', 'updateListingsProducts', 'requester', array(), $marketplaceObj, $accountObj, 'Ess_M2ePro_Model_Buy_Synchronization_Tasks');
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $accountObj->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 8
0
 protected function logSuccessfulOperation(Ess_M2ePro_Model_Marketplace $marketplace)
 {
     // ->__('The "Specifics" Action for Amazon Marketplace: "%mrk%" has been successfully completed.');
     $tempString = Mage::getModel('M2ePro/Log_Abstract')->encodeDescription('The "Specifics" Action for Amazon Marketplace: "%mrk%" has been successfully completed.', array('mrk' => $marketplace->getTitle()));
     $this->getLog()->addMessage($tempString, Ess_M2ePro_Model_Log_Abstract::TYPE_SUCCESS, Ess_M2ePro_Model_Log_Abstract::PRIORITY_LOW);
 }
Ejemplo n.º 9
0
 private function processAccountMarketplaceLinks(Ess_M2ePro_Model_Account $accountObj, Ess_M2ePro_Model_Marketplace $marketplaceObj)
 {
     $config = Mage::helper('M2ePro/Module')->getSynchronizationConfig();
     $syncGroup = '/other_listings/';
     $playSyncGroup = '/play/other_listings/';
     $isGlobalSyncEnabled = (bool) $config->getGroupValue($syncGroup, 'mode');
     $isPlaySyncEnabled = (bool) $config->getGroupValue($playSyncGroup, 'mode');
     $firstOtherListingsSyncTime = $accountObj->getChildObject()->getOtherListingsFirstSynchronization();
     $currentGmtDate = Mage::helper('M2ePro')->getCurrentGmtDate(true);
     $accountCreateDate = $accountObj->getData('create_date');
     if ($isGlobalSyncEnabled && $isPlaySyncEnabled && strtotime($accountCreateDate) + 24 * 3600 > $currentGmtDate && (is_null($firstOtherListingsSyncTime) || strtotime($firstOtherListingsSyncTime) + 3 * 3600 > $currentGmtDate)) {
         return;
     }
     $this->_profiler->addTitle('Starting account "' . $accountObj->getTitle() . '" and marketplace "' . $marketplaceObj->getTitle() . '"');
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $accountObj->getId(), 'Get Product Links from Play');
     $status = 'Task "Getting Products Links" for Play.com account: "%s" and marketplace "%s" ';
     $status .= 'is started. Please wait...';
     $this->_lockItem->setStatus(Mage::helper('M2ePro')->__($status, $accountObj->getTitle(), $marketplaceObj->getTitle()));
     $updateByPagesSettings = $accountObj->getChildObject()->getDecodedListingsUpdateLinksSettings();
     if (is_null($updateByPagesSettings) || (int) $updateByPagesSettings['next_status'] <= 3 && (int) $updateByPagesSettings['next_page'] < 10000) {
         $this->updateInventoryLinksByPages($accountObj, $marketplaceObj);
     } else {
         $this->updateInventoryLinksByListingsIds($accountObj, $marketplaceObj);
     }
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $accountObj->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 10
0
 private function updateAccountMarketplace(Ess_M2ePro_Model_Account $account, Ess_M2ePro_Model_Marketplace $marketplace)
 {
     $this->_profiler->addTitle('Starting account "' . $account->getTitle() . '" and marketplace "' . $marketplace->getTitle() . '"');
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Get orders from Amazon');
     //->__('Task "%s" for Amazon account: "%s" and marketplace "%s" is started. Please wait...')
     $status = 'Task "%s" for Amazon account: "%s" and marketplace "%s" is started. Please wait...';
     $status = Mage::helper('M2ePro')->__($status, $this->name, $account->getTitle(), $marketplace->getTitle());
     $this->_lockItem->setStatus($status);
     // Get orders from Amazon for account
     //---------------------------
     $fromDate = $this->prepareFromDate($account->getData('orders_last_synchronization'));
     $params = array('from_date' => $fromDate);
     if (is_null($account->getData('orders_last_synchronization'))) {
         $account->setData('orders_last_synchronization', $fromDate)->save();
     }
     $entity = 'tasks';
     $type = 'orders';
     $name = 'requester';
     $prefix = 'Ess_M2ePro_Model_Amazon_Synchronization';
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Amazon_Dispatcher');
     $dispatcherObject->processConnector($entity, $type, $name, $params, $marketplace, $account, $prefix);
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 11
0
 private function processAccountMarketplace(Ess_M2ePro_Model_Account $account, Ess_M2ePro_Model_Marketplace $marketplace)
 {
     $title = 'Starting account "' . $account->getTitle() . '" and marketplace "' . $marketplace->getTitle() . '"';
     $this->_profiler->addTitle($title);
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Update orders on Amazon');
     $status = 'Task "%s" for Amazon "%s" Account and "%s" marketplace is started. Please wait...';
     $status = Mage::helper('M2ePro')->__($status, $this->name, $account->getTitle(), $marketplace->getTitle());
     $this->_lockItem->setStatus($status);
     $changesCollection = Mage::getModel('M2ePro/Order_Change')->getCollection();
     $changesCollection->addAccountFilter($account->getId());
     $changesCollection->addProcessingAttemptDateFilter();
     $changesCollection->addFieldToFilter('component', Ess_M2ePro_Helper_Component_Amazon::NICK);
     $changesCollection->addFieldToFilter('action', Ess_M2ePro_Model_Order_Change::ACTION_UPDATE_SHIPPING);
     $changesCollection->setPageSize(self::MAX_UPDATES_PER_TIME);
     $changesCollection->getSelect()->group(array('order_id'));
     if ($changesCollection->getSize() == 0) {
         return;
     }
     // Update orders shipping status on Rakuten.com
     //---------------------------
     $items = array();
     foreach ($changesCollection as $change) {
         $changeParams = $change->getParams();
         $items[] = array('order_id' => $change->getOrderId(), 'change_id' => $change->getId(), 'amazon_order_id' => $changeParams['amazon_order_id'], 'tracking_number' => $changeParams['tracking_number'], 'carrier_name' => $changeParams['carrier_name'], 'fulfillment_date' => $changeParams['fulfillment_date'], 'shipping_method' => isset($changeParams['shipping_method']) ? $changeParams['shipping_method'] : null, 'items' => $changeParams['items']);
     }
     if (count($items) == 0) {
         return;
     }
     Mage::getResourceModel('M2ePro/Order_Change')->incrementAttemptCount($changesCollection->getAllIds());
     /** @var $dispatcherObject Ess_M2ePro_Model_Connector_Server_Amazon_Dispatcher */
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Amazon_Dispatcher');
     $dispatcherObject->processConnector('orders', 'update', 'items', array('items' => $items), $marketplace, $account);
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 12
0
 private function processAccountMarketplace(Ess_M2ePro_Model_Account $account, Ess_M2ePro_Model_Marketplace $marketplace)
 {
     $title = 'Starting account "%s" and marketplace "%s%';
     $title = sprintf($title, $account->getTitle(), $marketplace->getTitle());
     $this->_profiler->addTitle($title);
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Get orders from Play');
     $status = 'Task "%s" for Play.com "%s" Account and "%s" marketplace is started. Please wait...';
     $status = Mage::helper('M2ePro')->__($status, $this->name, $account->getTitle(), $marketplace->getTitle());
     $this->_lockItem->setStatus($status);
     //------------------------------
     $fromDate = $this->prepareFromDate($account->getData('orders_last_synchronization'));
     $params = array('from_date' => $fromDate);
     if (is_null($account->getData('orders_last_synchronization'))) {
         $account->setData('orders_last_synchronization', $fromDate)->save();
     }
     //------------------------------
     // Get open orders from Play.com for account
     //---------------------------
     /** @var $dispatcherObject Ess_M2ePro_Model_Connector_Server_Play_Dispatcher */
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Play_Dispatcher');
     $prefix = 'Ess_M2ePro_Model_Play_Synchronization';
     $dispatcherObject->processConnector('tasks', 'orders_receive', 'requester', $params, $marketplace, $account, $prefix);
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 13
0
 private function processAccountMarketplace(Ess_M2ePro_Model_Account $account, Ess_M2ePro_Model_Marketplace $marketplace)
 {
     $title = 'Starting account "' . $account->getTitle() . '" and marketplace "' . $marketplace->getTitle() . '"';
     $this->_profiler->addTitle($title);
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Get orders from Buy');
     $status = 'Task "%s" for Rakuten.com "%s" Account and "%s" marketplace is started. Please wait...';
     $status = Mage::helper('M2ePro')->__($status, $this->name, $account->getTitle(), $marketplace->getTitle());
     $this->_lockItem->setStatus($status);
     // Get open orders from Rakuten.com for account
     //---------------------------
     $entity = 'tasks';
     $type = 'orders_receive';
     $name = 'requester';
     $prefix = 'Ess_M2ePro_Model_Buy_Synchronization';
     /** @var $dispatcherObject Ess_M2ePro_Model_Connector_Server_Buy_Dispatcher */
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Buy_Dispatcher');
     $dispatcherObject->processConnector($entity, $type, $name, array(), $marketplace, $account, $prefix);
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
     $this->_profiler->addEol();
 }
Ejemplo n.º 14
0
 private function processAccountMarketplace(Ess_M2ePro_Model_Account $account, Ess_M2ePro_Model_Marketplace $marketplace)
 {
     $title = 'Starting account "%s" and marketplace "%s"';
     $title = sprintf($title, $account->getTitle(), $marketplace->getTitle());
     $this->_profiler->addTitle($title);
     $this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Update orders on Rakuten.com');
     $status = 'Task "%s" for Rakuten.com "%s" Account and "%s" marketplace is started. Please wait...';
     $status = Mage::helper('M2ePro')->__($status, $this->name, $account->getTitle(), $marketplace->getTitle());
     $this->_lockItem->setStatus($status);
     $changesCollection = Mage::getModel('M2ePro/Order_Change')->getCollection();
     $changesCollection->addAccountFilter($account->getId());
     $changesCollection->addProcessingAttemptDateFilter();
     $changesCollection->addFieldToFilter('component', Ess_M2ePro_Helper_Component_Buy::NICK);
     $changesCollection->addFieldToFilter('action', Ess_M2ePro_Model_Order_Change::ACTION_UPDATE_SHIPPING);
     $changesCollection->getSelect()->group(array('order_id'));
     if ($changesCollection->getSize() == 0) {
         return;
     }
     // Update orders shipping status on Rakuten.com
     //---------------------------
     $params = array();
     foreach ($changesCollection as $change) {
         $changeParams = $change->getParams();
         $params[] = array('change_id' => $change->getId(), 'order_id' => $change->getOrderId(), 'buy_order_id' => $changeParams['buy_order_id'], 'buy_order_item_id' => $changeParams['buy_order_item_id'], 'qty' => $changeParams['qty'], 'tracking_type' => $changeParams['tracking_type'], 'tracking_number' => $changeParams['tracking_number'], 'ship_date' => $changeParams['ship_date']);
     }
     if (count($params) == 0) {
         return;
     }
     Mage::getResourceModel('M2ePro/Order_Change')->incrementAttemptCount($changesCollection->getAllIds());
     $entity = 'orders';
     $type = 'update';
     $name = 'shipping';
     /** @var $dispatcherObject Ess_M2ePro_Model_Connector_Server_Buy_Dispatcher */
     $dispatcherObject = Mage::getModel('M2ePro/Connector_Server_Buy_Dispatcher');
     $dispatcherObject->processConnector($entity, $type, $name, $params, $marketplace, $account);
     //---------------------------
     $this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
     $this->_profiler->addEol();
 }