-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
35 changed files
with
962 additions
and
277 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
111 changes: 111 additions & 0 deletions
111
app/code/community/Ess/M2ePro/Block/Adminhtml/Notification/AbstractNotificationMessage.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
<?php | ||
|
||
/* | ||
* @author M2E Pro Developers Team | ||
* @copyright M2E LTD | ||
* @license Commercial use is forbidden | ||
*/ | ||
|
||
abstract class Ess_M2ePro_Block_Adminhtml_Notification_AbstractNotificationMessage extends Mage_Adminhtml_Block_Template | ||
{ | ||
/** @var string */ | ||
protected $sinceDate; | ||
/** @var int */ | ||
protected $failOrderCount; | ||
/** @var string */ | ||
protected $skipUrl; | ||
/** @var array */ | ||
protected $components; | ||
/** @var array */ | ||
protected $logLinkFilters; | ||
|
||
public function setSinceDate($date) | ||
{ | ||
/** @var Mage_Core_Helper_Data $coreHelper */ | ||
$coreHelper = Mage::helper('core'); | ||
|
||
$this->sinceDate = $coreHelper->formatDate($date, Mage_Core_Model_Locale::FORMAT_TYPE_LONG); | ||
} | ||
|
||
public function setFailOrderCount($count) | ||
{ | ||
$this->failOrderCount = $count; | ||
} | ||
|
||
public function setSkipUrl($skipUrl) | ||
{ | ||
$this->skipUrl = $skipUrl; | ||
} | ||
|
||
public function setComponents(array $components) | ||
{ | ||
$this->components = $components; | ||
} | ||
|
||
public function setLogLinkFilters(array $filters) | ||
{ | ||
$this->logLinkFilters = $filters; | ||
} | ||
|
||
abstract protected function renderHtml(); | ||
|
||
/** | ||
* @return string | ||
*/ | ||
protected function _toHtml() | ||
{ | ||
$this->getLayout() | ||
->getBlock('head') | ||
->addJs('M2ePro/Order/LogNotification.js'); | ||
|
||
return $this->renderHtml(); | ||
} | ||
|
||
protected function makeLinksHtmlToComponentLogs() | ||
{ | ||
/** @var $adminhtmlHelper */ | ||
$adminhtmlHelper = Mage::helper('adminhtml'); | ||
|
||
$componentLinks = array(); | ||
foreach ($this->components as $component) { | ||
$title = $route = ''; | ||
switch ($component) { | ||
case Ess_M2ePro_Helper_View_Amazon::NICK: | ||
$title = 'Amazon orders logs'; | ||
$route = 'M2ePro/adminhtml_amazon_log/order'; | ||
break; | ||
case Ess_M2ePro_Helper_View_Ebay::NICK: | ||
$title = 'eBay orders logs'; | ||
$route = 'M2ePro/adminhtml_ebay_log/order'; | ||
break; | ||
case Ess_M2ePro_Helper_View_Walmart::NICK: | ||
$title = 'Walmart orders logs'; | ||
$route = 'M2ePro/adminhtml_walmart_log/order'; | ||
break; | ||
} | ||
|
||
$filterHash = http_build_query($this->logLinkFilters); | ||
$filterHash = base64_encode($filterHash); | ||
|
||
$url = $adminhtmlHelper->getUrl($route, array('filter' => $filterHash)); | ||
|
||
$componentLinks[] = sprintf('<a href="%s" target="_blank">%s</a>', $url, $title); | ||
} | ||
|
||
return implode(' / ', $componentLinks); | ||
} | ||
|
||
protected function makeSkipLink() | ||
{ | ||
return <<<HTML | ||
<script> | ||
if (typeof LogNotificationObj == 'undefined') { | ||
LogNotificationObj = new LogNotification() | ||
} | ||
</script> | ||
<a href="javascript:void(0);" onclick="LogNotificationObj.skipLogToCurrentDate('{$this->skipUrl}')"> | ||
Skip this message | ||
</a> | ||
HTML; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/code/community/Ess/M2ePro/Block/Adminhtml/Notification/OrderNotCreated.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* @author M2E Pro Developers Team | ||
* @copyright M2E LTD | ||
* @license Commercial use is forbidden | ||
*/ | ||
|
||
class Ess_M2ePro_Block_Adminhtml_Notification_OrderNotCreated | ||
extends Ess_M2ePro_Block_Adminhtml_Notification_AbstractNotificationMessage | ||
{ | ||
protected function renderHtml() | ||
{ | ||
return <<<TEMPLATE | ||
Since {$this->sinceDate}, some Magento orders have not been created: {$this->failOrderCount}, | ||
check your {$this->makeLinksHtmlToComponentLogs()}.{$this->makeSkipLink()}. | ||
TEMPLATE; | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
app/code/community/Ess/M2ePro/Block/Adminhtml/Notification/OrderVatChanged.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?php | ||
|
||
/* | ||
* @author M2E Pro Developers Team | ||
* @copyright M2E LTD | ||
* @license Commercial use is forbidden | ||
*/ | ||
|
||
class Ess_M2ePro_Block_Adminhtml_Notification_OrderVatChanged | ||
extends Ess_M2ePro_Block_Adminhtml_Notification_AbstractNotificationMessage | ||
{ | ||
protected function renderHtml() | ||
{ | ||
return <<<MESAGE | ||
Since {$this->sinceDate}, Amazon has applied reverse charge (0% VAT) to {$this->failOrderCount} orders, | ||
check your {$this->makeLinksHtmlToComponentLogs()}. {$this->makeSkipLink()}. | ||
MESAGE; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.