forked from lovesttory/app
/
EbayOrdersLogs.php
58 lines (48 loc) · 1.51 KB
/
EbayOrdersLogs.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*
* @copyright Copyright (c) 2011 by ESS-UA.
*/
class Ess_M2ePro_Model_EbayOrdersLogs extends Mage_Core_Model_Abstract
{
const MESSAGE_CODE_NOTICE = 0;
const MESSAGE_CODE_WARNING = 1;
const MESSAGE_CODE_ERROR = 2;
public function _construct()
{
parent::_construct();
$this->_init('M2ePro/EbayOrdersLogs');
}
/**
* Adding log message to specific order
*
* @return void
*/
public function addLogMessage($orderId, $message, $messageTrace = null, $code = self::MESSAGE_CODE_NOTICE)
{
$logData = array(
'order_id' => $orderId,
'message' => $message,
'message_trace' => $messageTrace,
'code' => $code
);
$this->setData($logData)->setId(null)->save();
return $this->getId();
}
public function getLogDateHtml()
{
if (!$this->getId()) {
return false;
}
// $dateFormatIso = Mage::app()->getLocale()->getDateFormat(
// Mage_Core_Model_Locale::FORMAT_TYPE_SHORT
// );
return Mage::helper('M2ePro')->gmtDateToTimezone($this->getCreateDate());
}
public function deleteLogsForOrder($orderIdForRemove)
{
$this->getResource()
->getReadConnection()
->delete($this->getResource()->getMainTable(),
array('order_id = ?' => $orderIdForRemove));
}
}