本文整理汇总了PHP中Ess_M2ePro_Model_Account::setData方法的典型用法代码示例。如果您正苦于以下问题:PHP Ess_M2ePro_Model_Account::setData方法的具体用法?PHP Ess_M2ePro_Model_Account::setData怎么用?PHP Ess_M2ePro_Model_Account::setData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ess_M2ePro_Model_Account
的用法示例。
在下文中一共展示了Ess_M2ePro_Model_Account::setData方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateAccount
private function updateAccount(Ess_M2ePro_Model_Account $account)
{
$this->_profiler->addTitle('Starting account "' . $account->getTitle() . '"');
$this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Get orders from Amazon');
//->__('Task "%s" for Amazon account: "%s" is started. Please wait...')
$status = 'Task "%s" for Amazon account: "%s" is started. Please wait...';
$status = Mage::helper('M2ePro')->__($status, $this->name, $account->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_Amazon_Dispatcher');
$dispatcherObject->processConnector($entity, $type, $name, $params, $account, $prefix);
//---------------------------
$this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
$this->_profiler->addEol();
}
示例2: processAccount
private function processAccount(Ess_M2ePro_Model_Account $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();
}
Mage::getModel('M2ePro/Connector_Play_Dispatcher')->processConnector('orders', 'receive', 'requester', $params, $account, 'Ess_M2ePro_Model_Play_Synchronization');
}
示例3: updateAccountMarketplace
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();
}
示例4: processAccount
private function processAccount(Ess_M2ePro_Model_Account $account)
{
$title = 'Starting account "%s"';
$title = sprintf($title, $account->getTitle());
$this->_profiler->addTitle($title);
$this->_profiler->addTimePoint(__METHOD__ . 'send' . $account->getId(), 'Get orders from Play');
$status = 'Task "%s" for Play.com "%s" Account is started. Please wait...';
$status = Mage::helper('M2ePro')->__($status, $this->name, $account->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_Play_Dispatcher */
$dispatcherObject = Mage::getModel('M2ePro/Connector_Play_Dispatcher');
$prefix = 'Ess_M2ePro_Model_Play_Synchronization';
$dispatcherObject->processConnector('tasks', 'orders_receive', 'requester', $params, $account, $prefix);
//---------------------------
$this->_profiler->saveTimePoint(__METHOD__ . 'send' . $account->getId());
$this->_profiler->addEol();
}
示例5: getResponseBody
private function getResponseBody(Ess_M2ePro_Model_Account $account)
{
if ($account->getChildObject()->isFeedbacksAutoResponseCycled()) {
$lastUsedId = 0;
if ($account->getChildObject()->getFeedbacksLastUsedId() != null) {
$lastUsedId = (int) $account->getChildObject()->getFeedbacksLastUsedId();
}
$feedbackTemplatesIds = Mage::getModel('M2ePro/Ebay_Feedback_Template')->getCollection()->addFieldToFilter('account_id', $account->getId())->setOrder('id', 'ASC')->getAllIds();
if (!count($feedbackTemplatesIds)) {
return '';
}
$feedbackTemplate = Mage::getModel('M2ePro/Ebay_Feedback_Template');
if (max($feedbackTemplatesIds) > $lastUsedId) {
foreach ($feedbackTemplatesIds as $templateId) {
if ($templateId <= $lastUsedId) {
continue;
}
$feedbackTemplate->load($templateId);
break;
}
} else {
$feedbackTemplate->load(min($feedbackTemplatesIds));
}
if (!$feedbackTemplate->getId()) {
return '';
}
$account->setData('feedbacks_last_used_id', $feedbackTemplate->getId())->save();
return $feedbackTemplate->getBody();
}
if ($account->getChildObject()->isFeedbacksAutoResponseRandom()) {
$feedbackTemplatesIds = Mage::getModel('M2ePro/Ebay_Feedback_Template')->getCollection()->addFieldToFilter('account_id', $account->getId())->getAllIds();
if (!count($feedbackTemplatesIds)) {
return '';
}
$index = rand(0, count($feedbackTemplatesIds) - 1);
$feedbackTemplate = Mage::getModel('M2ePro/Ebay_Feedback_Template')->load($feedbackTemplatesIds[$index]);
if (!$feedbackTemplate->getId()) {
return '';
}
return $feedbackTemplate->getBody();
}
return '';
}
示例6: saveLastUpdateTime
private function saveLastUpdateTime(Ess_M2ePro_Model_Account $account, $lastUpdateTime)
{
$account->setData('orders_last_synchronization', $lastUpdateTime)->save();
}
示例7: processAccount
private function processAccount(Ess_M2ePro_Model_Account $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 = 'orders';
$type = 'receive';
$name = 'requester';
$prefix = 'Ess_M2ePro_Model_Amazon_Synchronization';
$dispatcherObject = Mage::getModel('M2ePro/Connector_Amazon_Dispatcher');
$dispatcherObject->processConnector($entity, $type, $name, $params, $account, $prefix);
}
示例8: processAccount
protected function processAccount(Ess_M2ePro_Model_Account $account, $percentsForAccount)
{
$this->_profiler->addEol();
$this->_profiler->addTitle('Starting account "' . $account->getTitle() . '"');
$this->_profiler->addEol();
$this->_profiler->addTimePoint(__METHOD__ . 'get' . $account->getId(), 'Get orders from eBay');
// ->__('Task "Orders Synchronization" for eBay account: "%s" is started. Please wait...')
$status = 'Task "Orders Synchronization" for eBay account: "%s" is started. Please wait...';
$tempString = Mage::helper('M2ePro')->__($status, $account->getTitle());
$this->_lockItem->setStatus($tempString);
$currentPercent = $this->_lockItem->getPercents();
// Get from time
//---------------------------
$fromTime = $this->prepareSinceTime($account->getData('orders_last_synchronization'));
//---------------------------
// Get orders from eBay
//---------------------------
$request = array('last_update' => $fromTime);
if (is_null($account->getData('orders_last_synchronization'))) {
$account->setData('orders_last_synchronization', $fromTime)->save();
}
$response = Mage::getModel('M2ePro/Connector_Server_Ebay_Dispatcher')->processVirtualAbstract('sales', 'get', 'list', $request, NULL, NULL, $account, NULL);
$ebayOrders = array();
$toTime = $fromTime;
if (isset($response['orders']) && isset($response['updated_to'])) {
$ebayOrders = $response['orders'];
$toTime = $response['updated_to'];
}
if (count($ebayOrders) == 0) {
return;
}
//---------------------------
$currentPercent = $currentPercent + $percentsForAccount * 0.15;
$this->_lockItem->setPercents($currentPercent);
$this->_lockItem->activate();
$this->_profiler->saveTimePoint(__METHOD__ . 'get' . $account->getId());
$this->_profiler->addTitle('Total count orders received from eBay: ' . count($ebayOrders));
$this->_profiler->addTimePoint(__METHOD__ . 'process' . $account->getId(), 'Processing received orders from eBay');
// ->__('Task "Orders Synchronization" for eBay account: "%acc%" is in data processing state. Please wait...')
$status = 'Task "Orders Synchronization" for eBay account: "%s" is in data processing state. Please wait...';
$tempString = Mage::helper('M2ePro')->__($status, $account->getTitle());
$this->_lockItem->setStatus($tempString);
// Save eBay orders
//---------------------------
$orders = array();
foreach ($ebayOrders as $ebayOrderData) {
/** @var $ebayOrder Ess_M2ePro_Model_Ebay_Order_Builder */
$ebayOrder = Mage::getModel('M2ePro/Ebay_Order_Builder');
$ebayOrder->initialize($account, $ebayOrderData);
$orders[] = $ebayOrder->process();
}
//---------------------------
$account->setData('orders_last_synchronization', $toTime)->save();
/** @var $orders Ess_M2ePro_Model_Order[] */
$orders = array_filter($orders);
if (count($orders) == 0) {
return;
}
$currentPercent = $currentPercent + $percentsForAccount * 0.05;
$this->_lockItem->setPercents($currentPercent);
$this->_lockItem->activate();
$this->_profiler->saveTimePoint(__METHOD__ . 'process' . $account->getId());
$this->_profiler->addEol();
$this->_profiler->addTimePoint(__METHOD__ . 'magento_orders_process' . $account->getId(), 'Creating magento orders');
// ->__('Task "Orders Synchronization" for eBay account: "%s" is in order creation state.. Please wait...')
$status = 'Task "Orders Synchronization" for eBay account: "%s" is in order creation state.. Please wait...';
$tempString = Mage::helper('M2ePro')->__($status, $account->getTitle());
$this->_lockItem->setStatus($tempString);
// Create magento orders
//---------------------------
$magentoOrders = $paymentTransactions = $invoices = $shipments = $tracks = 0;
$percentPerOrder = ($percentsForAccount - $currentPercent) / count($orders);
$tempPercent = 0;
foreach ($orders as $order) {
/** @var $order Ess_M2ePro_Model_Order */
if ($order->canCreateMagentoOrder()) {
try {
$order->createMagentoOrder();
$magentoOrders++;
} catch (Exception $e) {
Mage::helper('M2ePro/Exception')->process($e, true);
}
}
if ($order->getChildObject()->canCreatePaymentTransaction()) {
$order->getChildObject()->createPaymentTransactions() && $paymentTransactions++;
}
if ($order->getChildObject()->canCreateInvoice()) {
$order->createInvoice() && $invoices++;
}
if ($order->getChildObject()->canCreateShipment()) {
$order->createShipment() && $shipments++;
}
if ($order->getChildObject()->canCreateTracks()) {
$order->getChildObject()->createTracks() && $tracks++;
}
if ($order->getStatusUpdateRequired()) {
$order->updateMagentoOrderStatus();
}
$tempPercent += $percentPerOrder;
if (floor($tempPercent) > 0) {
//.........这里部分代码省略.........