diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Grid/Column/Renderer/Price.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Grid/Column/Renderer/Price.php
index a5ae362da..b9c2398bd 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Grid/Column/Renderer/Price.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Grid/Column/Renderer/Price.php
@@ -95,10 +95,16 @@ class="m2epro-repricing-price-value"
$salePrice = $row->getData('online_regular_sale_price');
if ((float)$salePrice > 0) {
- $currentTimestamp = strtotime(Mage::helper('M2ePro')->getCurrentGmtDate(false, 'Y-m-d 00:00:00'));
-
- $startDateTimestamp = strtotime($row->getData('online_regular_sale_price_start_date'));
- $endDateTimestamp = strtotime($row->getData('online_regular_sale_price_end_date'));
+ /** @var Ess_M2ePro_Helper_Data $helper */
+ $helper = Mage::helper('M2ePro');
+ $currentTimestamp = (int)$helper->createGmtDateTime(
+ $helper->getCurrentGmtDate(false, 'Y-m-d 00:00:00')
+ )->format('U');
+
+ $startDateTimestamp = (int)$helper->createGmtDateTime($row->getData('online_regular_sale_price_start_date'))
+ ->format('U');
+ $endDateTimestamp = (int)$helper->createGmtDateTime($row->getData('online_regular_sale_price_end_date'))
+ ->format('U');
if ($currentTimestamp <= $endDateTimestamp) {
$iconHelpPath = $this->getSkinUrl('M2ePro/images/i_logo.png');
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Grid.php
index 7fcf4c2e6..64b138cff 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Grid.php
@@ -8,16 +8,10 @@
class Ess_M2ePro_Block_Adminhtml_Amazon_Listing_Grid extends Ess_M2ePro_Block_Adminhtml_Listing_Grid
{
- /** @var Ess_M2ePro_Model_Resource_Amazon_Listing */
- protected $_amazonListingResourceModel;
-
- //########################################
-
public function __construct()
{
parent::__construct();
$this->setId('amazonListingGrid');
- $this->_amazonListingResourceModel = Mage::getResourceModel('M2ePro/Amazon_Listing');
}
protected function _prepareCollection()
@@ -59,6 +53,32 @@ protected function _prepareCollection()
);
// ---------------------------------------
+ $structureHelper = Mage::helper('M2ePro/Module_Database_Structure');
+
+ $m2eproListing = $structureHelper->getTableNameWithPrefix('m2epro_listing');
+ $m2eproAmazonListing = $structureHelper->getTableNameWithPrefix('m2epro_amazon_listing');
+ $m2eproListingProduct = $structureHelper->getTableNameWithPrefix('m2epro_listing_product');
+
+ $sql = "SELECT
+ l.id AS listing_id,
+ COUNT(lp.id) AS products_total_count,
+ COUNT(CASE WHEN lp.status = 2 THEN lp.id END) AS products_active_count,
+ COUNT(CASE WHEN lp.status != 2 THEN lp.id END) AS products_inactive_count
+ FROM `{$m2eproListing}` AS `l`
+ INNER JOIN `{$m2eproAmazonListing}` AS `al` ON l.id = al.listing_id
+ LEFT JOIN `{$m2eproListingProduct}` AS `lp` ON l.id = lp.listing_id
+ GROUP BY listing_id";
+
+ $collection->getSelect()->joinLeft(
+ array('t' => new Zend_Db_Expr('('.$sql.')')),
+ 'main_table.id=t.listing_id',
+ array(
+ 'products_total_count' => 'products_total_count',
+ 'products_active_count' => 'products_active_count',
+ 'products_inactive_count' => 'products_inactive_count',
+ )
+ );
+
$this->setCollection($collection);
return parent::_prepareCollection();
@@ -248,45 +268,6 @@ protected function getColumnActionsItems()
//########################################
- public function callbackColumnTotalProducts($value, $row, $column, $isExport)
- {
- $value = $this->_amazonListingResourceModel->getStatisticTotalCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
- public function callbackColumnListedProducts($value, $row, $column, $isExport)
- {
- $value = $this->_amazonListingResourceModel->getStatisticActiveCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
- public function callbackColumnInactiveProducts($value, $row, $column, $isExport)
- {
- $value = $this->_amazonListingResourceModel->getStatisticInactiveCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
public function callbackColumnTitle($value, $row, $column, $isExport)
{
$value = '' .
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Search/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Search/Grid.php
index 9d4f5400a..4d8ebc7cc 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Search/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Search/Grid.php
@@ -459,10 +459,16 @@ class="m2epro-repricing-price-value"
$salePrice = $row->getData('online_regular_sale_price');
if (!$row->getData('is_variation_parent') && (float)$salePrice > 0 && !$row->getData('is_repricing')) {
- $currentTimestamp = strtotime(Mage::helper('M2ePro')->getCurrentGmtDate(false, 'Y-m-d 00:00:00'));
-
- $startDateTimestamp = strtotime($row->getData('online_regular_sale_price_start_date'));
- $endDateTimestamp = strtotime($row->getData('online_regular_sale_price_end_date'));
+ /** @var Ess_M2ePro_Helper_Data $helper */
+ $helper = Mage::helper('M2ePro');
+ $currentTimestamp = (int)$helper->createGmtDateTime(
+ $helper->getCurrentGmtDate(false, 'Y-m-d 00:00:00')
+ )->format('U');
+
+ $startDateTimestamp = (int)$helper->createGmtDateTime($row->getData('online_regular_sale_price_start_date'))
+ ->format('U');
+ $endDateTimestamp = (int)$helper->createGmtDateTime($row->getData('online_regular_sale_price_end_date'))
+ ->format('U');
if ($currentTimestamp <= $endDateTimestamp) {
$iconHelpPath = $this->getSkinUrl('M2ePro/images/i_logo.png');
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/View/Amazon/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/View/Amazon/Grid.php
index 90add0a96..2b1a26555 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/View/Amazon/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/View/Amazon/Grid.php
@@ -868,12 +868,16 @@ class="m2epro-repricing-price-value"
$salePrice = $row->getData('online_regular_sale_price');
if (!$row->getData('is_variation_parent') && (float)$salePrice > 0) {
- $currentTimestamp = strtotime(
- Mage::helper('M2ePro')->getCurrentGmtDate(false, 'Y-m-d 00:00:00')
- );
-
- $startDateTimestamp = strtotime($row->getData('online_regular_sale_price_start_date'));
- $endDateTimestamp = strtotime($row->getData('online_regular_sale_price_end_date'));
+ /** @var Ess_M2ePro_Helper_Data $helper */
+ $helper = Mage::helper('M2ePro');
+ $currentTimestamp = (int)$helper->createGmtDateTime(
+ $helper->getCurrentGmtDate(false, 'Y-m-d 00:00:00')
+ )->format('U');
+
+ $startDateTimestamp = (int)$helper->createGmtDateTime($row->getData('online_regular_sale_price_start_date'))
+ ->format('U');
+ $endDateTimestamp = (int)$helper->createGmtDateTime($row->getData('online_regular_sale_price_end_date'))
+ ->format('U');
if ($currentTimestamp <= $endDateTimestamp) {
$iconHelpPath = $this->getSkinUrl('M2ePro/images/i_logo.png');
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Order/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Order/Grid.php
index 475634936..103a60069 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Order/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Order/Grid.php
@@ -213,14 +213,18 @@ protected function _prepareColumns()
'filter_index' => 'second_table.status',
'type' => 'options',
'options' => array(
- Ess_M2ePro_Model_Amazon_Order::STATUS_PENDING => $helper->__('Pending'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_PENDING_RESERVED => $helper->__('Pending / QTY Reserved'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_UNSHIPPED => $helper->__('Unshipped'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_SHIPPED_PARTIALLY => $helper->__('Partially Shipped'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_SHIPPED => $helper->__('Shipped'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_INVOICE_UNCONFIRMED => $helper->__('Invoice Not Confirmed'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_UNFULFILLABLE => $helper->__('Unfulfillable'),
- Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELED => $helper->__('Canceled'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_PENDING => $helper->__('Pending'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_PENDING_RESERVED =>
+ $helper->__('Pending / QTY Reserved'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_UNSHIPPED => $helper->__('Unshipped'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_SHIPPED_PARTIALLY => $helper->__('Partially Shipped'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_SHIPPED => $helper->__('Shipped'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_INVOICE_UNCONFIRMED =>
+ $helper->__('Invoice Not Confirmed'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_UNFULFILLABLE => $helper->__('Unfulfillable'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELED => $helper->__('Canceled'),
+ Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELLATION_REQUESTED =>
+ $helper->__('Unshipped (Cancellation Requested)'),
),
'frame_callback' => array($this, 'callbackColumnStatus'),
'filter_condition_callback' => array($this, 'callbackFilterStatus')
@@ -577,9 +581,10 @@ public function callbackColumnStatus($value, $row, $column, $isExport)
$status = $row->getData('status');
$statusColors = array(
- Ess_M2ePro_Model_Amazon_Order::STATUS_PENDING => 'gray',
- Ess_M2ePro_Model_Amazon_Order::STATUS_SHIPPED => 'green',
- Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELED => 'red'
+ Ess_M2ePro_Model_Amazon_Order::STATUS_PENDING => 'gray',
+ Ess_M2ePro_Model_Amazon_Order::STATUS_SHIPPED => 'green',
+ Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELED => 'red',
+ Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELLATION_REQUESTED => 'red'
);
$color = isset($statusColors[$status]) ? $statusColors[$status] : 'black';
@@ -692,6 +697,12 @@ protected function callbackFilterStatus($collection, $column)
array(Ess_M2ePro_Model_Order_Reserve::STATE_PLACED)
);
break;
+ case Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELLATION_REQUESTED:
+ $collection->addFieldToFilter(
+ 'second_table.status',
+ array(Ess_M2ePro_Model_Amazon_Order::STATUS_CANCELLATION_REQUESTED)
+ );
+ break;
}
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template.php
index 422a00b70..7893ef52d 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template.php
@@ -14,36 +14,27 @@ public function __construct()
{
parent::__construct();
- // Initialization block
- // ---------------------------------------
$this->setId('amazonTemplate');
$this->_blockGroup = 'M2ePro';
$this->_controller = 'adminhtml_amazon_template';
- // ---------------------------------------
- // Set header text
- // ---------------------------------------
$this->_headerText = '';
- // ---------------------------------------
- // Set buttons actions
- // ---------------------------------------
$this->removeButton('back');
$this->removeButton('reset');
$this->removeButton('delete');
$this->removeButton('save');
$this->removeButton('edit');
- // ---------------------------------------
- // ---------------------------------------
$this->_addButton(
- 'add', array(
- 'label' => Mage::helper('M2ePro')->__('Add Policy'),
- 'onclick' => '',
- 'class' => 'add add-button-drop-down'
+ 'add',
+ array(
+ 'id' => 'add_policy',
+ 'label' => Mage::helper('M2ePro')->__('Add Policy'),
+ 'onclick' => '',
+ 'class' => 'add add-button-drop-down'
)
);
- // -------------------------------------
}
public function getHeaderHtml()
@@ -52,6 +43,7 @@ public function getHeaderHtml()
'target_css_class' => 'add-button-drop-down',
'items' => array(
array(
+ 'id' => 'add_policy_selling',
'url' => $this->getUrl(
'*/adminhtml_amazon_template/new',
array(
@@ -61,6 +53,7 @@ public function getHeaderHtml()
'label' => Mage::helper('M2ePro')->__('Selling')
),
array(
+ 'id' => 'add_policy_description',
'url' => $this->getUrl(
'*/adminhtml_amazon_template/new',
array(
@@ -70,6 +63,7 @@ public function getHeaderHtml()
'label' => Mage::helper('M2ePro')->__('Description')
),
array(
+ 'id' => 'add_policy_synchronization',
'url' => $this->getUrl(
'*/adminhtml_amazon_template/new',
array(
@@ -79,6 +73,7 @@ public function getHeaderHtml()
'label' => Mage::helper('M2ePro')->__('Synchronization')
),
array(
+ 'id' => 'add_policy_shipping',
'url' => $this->getUrl(
'*/adminhtml_amazon_template/new',
array(
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Description/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Description/Edit.php
index c71165a2b..751171c20 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Description/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Description/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Description Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Description Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -54,10 +55,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'CommonObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'CommonObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -66,18 +69,22 @@ public function __construct()
if (!$isSaveAndClose && $this->isEditMode()) {
$headId = 'amazon-template-description';
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => "AmazonTemplateDescriptionObj.duplicate_click('{$headId}')",
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => "AmazonTemplateDescriptionObj.duplicate_click('{$headId}')",
+ 'class' => 'add M2ePro_duplicate_button'
)
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'CommonObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'CommonObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -88,6 +95,7 @@ public function __construct()
$this->_addButton(
'save',
array(
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'AmazonTemplateDescriptionObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -97,7 +105,9 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'AmazonTemplateDescriptionObj.save_click('
. '\'\','
@@ -109,7 +119,9 @@ public function __construct()
);
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'AmazonTemplateDescriptionObj.save_and_edit_click('
. '\'\','
@@ -128,6 +140,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/ProductTaxCode/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/ProductTaxCode/Edit.php
index 29827e8f6..f82ae5a4f 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/ProductTaxCode/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/ProductTaxCode/Edit.php
@@ -30,7 +30,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Product Tax Code Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Product Tax Code Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -65,10 +66,12 @@ public function __construct()
// ---------------------------------------
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'AmazonTemplateProductTaxCodeObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'AmazonTemplateProductTaxCodeObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
// ---------------------------------------
@@ -78,21 +81,25 @@ public function __construct()
) {
// ---------------------------------------
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => 'AmazonTemplateProductTaxCodeObj.duplicate_click'
- .'(\'amazon-template-TaxCode\')',
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => 'AmazonTemplateProductTaxCodeObj.duplicate_click'
+ . '(\'amazon-template-TaxCode\')',
+ 'class' => 'add M2ePro_duplicate_button'
)
);
// ---------------------------------------
// ---------------------------------------
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'AmazonTemplateProductTaxCodeObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'AmazonTemplateProductTaxCodeObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
// ---------------------------------------
@@ -100,29 +107,33 @@ public function __construct()
// ---------------------------------------
$this->_addButton(
- 'save', array(
- 'label' => Mage::helper('M2ePro')->__('Save'),
- 'onclick' => 'AmazonTemplateProductTaxCodeObj.save_click('
- . '\'\','
- . '\'' . $this->getSaveConfirmationText() . '\','
- . '\'' . Ess_M2ePro_Block_Adminhtml_Amazon_Template_Grid::TEMPLATE_PRODUCT_TAX_CODE . '\''
- . ')',
- 'class' => 'save'
+ 'save',
+ array(
+ 'id' => 'save_button',
+ 'label' => Mage::helper('M2ePro')->__('Save'),
+ 'onclick' => 'AmazonTemplateProductTaxCodeObj.save_click('
+ . '\'\','
+ . '\'' . $this->getSaveConfirmationText() . '\','
+ . '\'' . Ess_M2ePro_Block_Adminhtml_Amazon_Template_Grid::TEMPLATE_PRODUCT_TAX_CODE . '\''
+ . ')',
+ 'class' => 'save'
)
);
// ---------------------------------------
// ---------------------------------------
$this->_addButton(
- 'save_and_continue', array(
- 'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
- 'onclick' => 'AmazonTemplateProductTaxCodeObj.save_and_edit_click('
- . '\'\','
- . 'undefined,'
- . '\'' . $this->getSaveConfirmationText() . '\','
- . '\'' . Ess_M2ePro_Block_Adminhtml_Amazon_Template_Grid::TEMPLATE_PRODUCT_TAX_CODE . '\''
- . ')',
- 'class' => 'save'
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
+ 'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
+ 'onclick' => 'AmazonTemplateProductTaxCodeObj.save_and_edit_click('
+ . '\'\','
+ . 'undefined,'
+ . '\'' . $this->getSaveConfirmationText() . '\','
+ . '\'' . Ess_M2ePro_Block_Adminhtml_Amazon_Template_Grid::TEMPLATE_PRODUCT_TAX_CODE . '\''
+ . ')',
+ 'class' => 'save'
)
);
// ---------------------------------------
@@ -133,6 +144,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/SellingFormat/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/SellingFormat/Edit.php
index f56face7d..4dd0dde63 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/SellingFormat/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/SellingFormat/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Selling Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Selling Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -51,10 +52,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'AmazonTemplateSellingFormatObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'AmazonTemplateSellingFormatObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -63,19 +66,23 @@ public function __construct()
if (!$isSaveAndClose && Mage::helper('M2ePro/Data_Global')->getValue('temp_data')
&& Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getId()) {
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => 'AmazonTemplateSellingFormatObj.duplicate_click'
- .'(\'amazon-template-sellingFormat\')',
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => 'AmazonTemplateSellingFormatObj.duplicate_click'
+ . '(\'amazon-template-sellingFormat\')',
+ 'class' => 'add M2ePro_duplicate_button'
)
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'AmazonTemplateSellingFormatObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'AmazonTemplateSellingFormatObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -86,7 +93,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'AmazonTemplateSellingFormatObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -96,7 +103,9 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'AmazonTemplateSellingFormatObj.save_click('
. '\'\','
@@ -108,7 +117,9 @@ public function __construct()
);
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'AmazonTemplateSellingFormatObj.save_and_edit_click('
. '\'\','
@@ -127,6 +138,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Shipping/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Shipping/Edit.php
index 7e7eccdc7..c5e5bcfb8 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Shipping/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Shipping/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Shipping Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Shipping Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -57,10 +58,12 @@ public function __construct()
// ---------------------------------------
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'AmazonTemplateShippingObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'AmazonTemplateShippingObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
// ---------------------------------------
@@ -72,21 +75,25 @@ public function __construct()
) {
// ---------------------------------------
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => 'AmazonTemplateShippingObj.duplicate_click'
- .'(\'amazon-template-shipping\')',
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => 'AmazonTemplateShippingObj.duplicate_click'
+ . '(\'amazon-template-shipping\')',
+ 'class' => 'add M2ePro_duplicate_button'
)
);
// ---------------------------------------
// ---------------------------------------
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'AmazonTemplateShippingObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'AmazonTemplateShippingObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
// ---------------------------------------
@@ -100,7 +107,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'AmazonTemplateShippingObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -110,27 +117,31 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
- 'label' => Mage::helper('M2ePro')->__('Save'),
- 'onclick' => 'AmazonTemplateShippingObj.save_click('
+ 'save',
+ array(
+ 'id' => 'save_button',
+ 'label' => Mage::helper('M2ePro')->__('Save'),
+ 'onclick' => 'AmazonTemplateShippingObj.save_click('
. '\'\','
. '\'' . $this->getSaveConfirmationText() . '\','
. '\'' . Ess_M2ePro_Block_Adminhtml_Amazon_Template_Grid::TEMPLATE_SHIPPING . '\''
. ')',
- 'class' => 'save'
+ 'class' => 'save'
)
);
$this->_addButton(
- 'save_and_continue', array(
- 'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
- 'onclick' => 'AmazonTemplateShippingObj.save_and_edit_click('
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
+ 'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
+ 'onclick' => 'AmazonTemplateShippingObj.save_and_edit_click('
. '\'\','
. 'undefined,'
. '\'' . $this->getSaveConfirmationText() . '\','
. '\'' . Ess_M2ePro_Block_Adminhtml_Amazon_Template_Grid::TEMPLATE_SHIPPING . '\''
. ')',
- 'class' => 'save'
+ 'class' => 'save'
)
);
}
@@ -141,6 +152,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Synchronization/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Synchronization/Edit.php
index f1bbe7b9d..978ed7f0a 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Synchronization/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template/Synchronization/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Synchronization Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Synchronization Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -54,10 +55,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'AmazonTemplateSynchronizationObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'AmazonTemplateSynchronizationObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -66,19 +69,23 @@ public function __construct()
if (!$isSaveAndClose && Mage::helper('M2ePro/Data_Global')->getValue('temp_data')
&& Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getId()) {
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => 'AmazonTemplateSynchronizationObj.duplicate_click'
- .'(\'amazon-template-synchronization\')',
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => 'AmazonTemplateSynchronizationObj.duplicate_click'
+ . '(\'amazon-template-synchronization\')',
+ 'class' => 'add M2ePro_duplicate_button'
)
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'AmazonTemplateSynchronizationObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'AmazonTemplateSynchronizationObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -89,7 +96,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'AmazonTemplateSynchronizationObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -99,7 +106,9 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'AmazonTemplateSynchronizationObj.save_click('
. '\'\','
@@ -111,7 +120,9 @@ public function __construct()
);
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'AmazonTemplateSynchronizationObj.save_and_edit_click('
. '\'\','
@@ -130,6 +141,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Account/PickupStore/Edit/Tabs/BusinessHours.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Account/PickupStore/Edit/Tabs/BusinessHours.php
index 6cc2ca341..ba987ecbd 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Account/PickupStore/Edit/Tabs/BusinessHours.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Account/PickupStore/Edit/Tabs/BusinessHours.php
@@ -72,11 +72,16 @@ protected function prepareHoursData($hoursData, $key)
$parsedSettings = array();
foreach ($data[$key] as $day => $daySettings) {
- $fromHours = date('G', strtotime($daySettings['open']));
- $fromMinutes = date('i', strtotime($daySettings['open']));
+ /** @var Ess_M2ePro_Helper_Data $helper */
+ $helper = Mage::helper('M2ePro');
+ $openDateTime = $helper->createGmtDateTime($daySettings['open']);
+ $closeDateTime = $helper->createGmtDateTime($daySettings['close']);
- $toHours = date('G', strtotime($daySettings['close']));
- $toMinutes = date('i', strtotime($daySettings['close']));
+ $fromHours = $openDateTime->format('G');
+ $fromMinutes = $openDateTime->format('i');
+
+ $toHours = $closeDateTime->format('G');
+ $toMinutes = $closeDateTime->format('i');
$parsedSettings[$day] = array(
'from_hours' => $fromHours == 0 ? 24 : $fromHours,
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Feedback/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Feedback/Grid.php
index bff9059e7..bc1daac6d 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Feedback/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Feedback/Grid.php
@@ -190,7 +190,14 @@ public function callbackColumnEbayItemId($value, $row, $column, $isExport)
public function callbackColumnBuyerFeedbackDate($value, $row, $column, $isExport)
{
- if (strtotime($row->getData('buyer_feedback_date')) < strtotime('2001-01-02')) {
+ /** @var Ess_M2ePro_Helper_Data $helper */
+ $helper = Mage::helper('M2ePro');
+ $buyerFeedbackDate = (int)$helper->createGmtDateTime($row->getData('buyer_feedback_date'))
+ ->format('U');
+ $comparedDate = (int)$helper->createGmtDateTime('2001-01-02')
+ ->format('U');
+
+ if ($buyerFeedbackDate < $comparedDate) {
return Mage::helper('M2ePro')->__('N/A');
}
@@ -199,7 +206,14 @@ public function callbackColumnBuyerFeedbackDate($value, $row, $column, $isExport
public function callbackColumnSellerFeedbackDate($value, $row, $column, $isExport)
{
- if (strtotime($row->getData('seller_feedback_date')) < strtotime('2001-01-02')) {
+ /** @var Ess_M2ePro_Helper_Data $helper */
+ $helper = Mage::helper('M2ePro');
+ $sellerFeedbackDate = (int)$helper->createGmtDateTime($row->getData('seller_feedback_date'))
+ ->format('U');
+ $comparedDate = (int)$helper->createGmtDateTime('2001-01-02')
+ ->format('U');
+
+ if ($sellerFeedbackDate < $comparedDate) {
return Mage::helper('M2ePro')->__('N/A');
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/Grid.php
index 8586783aa..196decf55 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/Grid.php
@@ -10,16 +10,12 @@ class Ess_M2ePro_Block_Adminhtml_Ebay_Listing_Grid extends Ess_M2ePro_Block_Admi
{
const MASS_ACTION_ID_EDIT_PARTS_COMPATIBILITY = 'editPartsCompatibilityMode';
- /** @var Ess_M2ePro_Model_Resource_Ebay_Listing */
- protected $_ebayListingResourceModel;
-
//########################################
public function __construct()
{
parent::__construct();
$this->setId('ebayListingGrid');
- $this->_ebayListingResourceModel = Mage::getResourceModel('M2ePro/Ebay_Listing');
}
protected function _prepareCollection()
@@ -37,6 +33,36 @@ protected function _prepareCollection()
array('marketplace_title'=>'title')
);
+ $structureHelper = Mage::helper('M2ePro/Module_Database_Structure');
+
+ $m2eproListing = $structureHelper->getTableNameWithPrefix('m2epro_listing');
+ $m2eproEbayListing = $structureHelper->getTableNameWithPrefix('m2epro_ebay_listing');
+ $m2eproListingProduct = $structureHelper->getTableNameWithPrefix('m2epro_listing_product');
+ $m2eproEbayListingProduct = $structureHelper->getTableNameWithPrefix('m2epro_ebay_listing_product');
+
+ $sql = "SELECT
+ l.id AS listing_id,
+ COUNT(lp.id) AS products_total_count,
+ COUNT(CASE WHEN lp.status = 2 THEN lp.id END) AS products_active_count,
+ COUNT(CASE WHEN lp.status != 2 THEN lp.id END) AS products_inactive_count,
+ IFNULL(SUM(elp.online_qty_sold), 0) AS items_sold_count
+ FROM `{$m2eproListing}` AS `l`
+ INNER JOIN `{$m2eproEbayListing}` AS `el` ON l.id = el.listing_id
+ LEFT JOIN `{$m2eproListingProduct}` AS `lp` ON l.id = lp.listing_id
+ LEFT JOIN `{$m2eproEbayListingProduct}` AS `elp` ON lp.id = elp.listing_product_id
+ GROUP BY listing_id";
+
+ $collection->getSelect()->joinLeft(
+ array('t' => new Zend_Db_Expr('('.$sql.')')),
+ 'main_table.id=t.listing_id',
+ array(
+ 'products_total_count' => 'products_total_count',
+ 'products_active_count' => 'products_active_count',
+ 'products_inactive_count' => 'products_inactive_count',
+ 'items_sold_count' => 'items_sold_count'
+ )
+ );
+
$this->setCollection($collection);
return parent::_prepareCollection();
@@ -87,6 +113,23 @@ protected function _prepareMassaction()
//########################################
+ protected function setColumns()
+ {
+ $this->addColumn(
+ 'items_sold_count', array(
+ 'header' => Mage::helper('M2ePro')->__('Sold QTY'),
+ 'align' => 'right',
+ 'width' => '100px',
+ 'type' => 'number',
+ 'index' => 'items_sold_count',
+ 'filter_index' => 't.items_sold_count',
+ 'frame_callback' => array($this, 'callbackColumnProductsCount')
+ )
+ );
+
+ return $this;
+ }
+
protected function getColumnActionsItems()
{
$helper = Mage::helper('M2ePro');
@@ -211,45 +254,6 @@ protected function _prepareColumns()
//########################################
- public function callbackColumnTotalProducts($value, $row, $column, $isExport)
- {
- $value = $this->_ebayListingResourceModel->getStatisticTotalCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
- public function callbackColumnListedProducts($value, $row, $column, $isExport)
- {
- $value = $this->_ebayListingResourceModel->getStatisticActiveCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
- public function callbackColumnInactiveProducts($value, $row, $column, $isExport)
- {
- $value = $this->_ebayListingResourceModel->getStatisticInactiveCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
public function callbackColumnTitle($value, $row, $column, $isExport)
{
$title = Mage::helper('M2ePro')->escapeHtml($value);
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template.php
index 0e9125a56..f4ea35dc2 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template.php
@@ -14,36 +14,27 @@ public function __construct()
{
parent::__construct();
- // Initialization block
- // ---------------------------------------
$this->setId('ebayTemplate');
$this->_blockGroup = 'M2ePro';
$this->_controller = 'adminhtml_ebay_template';
- // ---------------------------------------
- // Set header text
- // ---------------------------------------
$this->_headerText = '';
- // ---------------------------------------
- // Set buttons actions
- // ---------------------------------------
$this->removeButton('back');
$this->removeButton('reset');
$this->removeButton('delete');
$this->removeButton('save');
$this->removeButton('edit');
- // ---------------------------------------
- // ---------------------------------------
$this->_addButton(
- 'add', array(
- 'label' => Mage::helper('M2ePro')->__('Add Policy'),
- 'onclick' => '',
- 'class' => 'add add-button-drop-down'
+ 'add',
+ array(
+ 'id' => 'add_policy',
+ 'label' => Mage::helper('M2ePro')->__('Add Policy'),
+ 'onclick' => '',
+ 'class' => 'add add-button-drop-down'
)
);
- // ---------------------------------------
}
//########################################
@@ -54,6 +45,7 @@ protected function getAddButtonJavascript()
'target_css_class' => 'add-button-drop-down',
'items' => array(
array(
+ 'id' => 'add_policy_payment',
'url' => $this->getUrl(
'*/adminhtml_ebay_template/new',
array(
@@ -64,6 +56,7 @@ protected function getAddButtonJavascript()
'label' => Mage::helper('M2ePro')->__('Payment')
),
array(
+ 'id' => 'add_policy_shipping',
'url' => $this->getUrl(
'*/adminhtml_ebay_template/new',
array(
@@ -74,6 +67,7 @@ protected function getAddButtonJavascript()
'label' => Mage::helper('M2ePro')->__('Shipping')
),
array(
+ 'id' => 'add_policy_return',
'url' => $this->getUrl(
'*/adminhtml_ebay_template/new',
array(
@@ -84,6 +78,7 @@ protected function getAddButtonJavascript()
'label' => Mage::helper('M2ePro')->__('Return')
),
array(
+ 'id' => 'add_policy_selling',
'url' => $this->getUrl(
'*/adminhtml_ebay_template/new',
array(
@@ -94,6 +89,7 @@ protected function getAddButtonJavascript()
'label' => Mage::helper('M2ePro')->__('Selling')
),
array(
+ 'id' => 'add_policy_description',
'url' => $this->getUrl(
'*/adminhtml_ebay_template/new',
array(
@@ -104,6 +100,7 @@ protected function getAddButtonJavascript()
'label' => Mage::helper('M2ePro')->__('Description')
),
array(
+ 'id' => 'add_policy_synchronization',
'url' => $this->getUrl(
'*/adminhtml_ebay_template/new',
array(
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template/Edit.php
index e347ac580..7ae72a857 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Template/Edit.php
@@ -74,10 +74,12 @@ public function __construct()
if ((bool)$this->getRequest()->getParam('back', false)) {
$url = $this->getUrl('*/adminhtml_ebay_template/index');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'EbayTemplateEditObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'EbayTemplateEditObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
}
@@ -86,6 +88,7 @@ public function __construct()
$this->_addButton(
'save',
array(
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'EbayTemplateEditObj.saveAndClose('
. '\'' . $this->getUrl('*/adminhtml_ebay_template/save', array('_current' => true)) . '\','
@@ -113,10 +116,12 @@ public function __construct()
}
$this->_addButton(
- 'duplicate', array(
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
'label' => Mage::helper('M2ePro')->__('Duplicate'),
'onclick' => 'EbayTemplateEditObj.duplicate_click(
- \'ebay-template\', \''.$duplicateHeaderText.'\', \''.$nick.'\'
+ \'ebay-template\', \'' . $duplicateHeaderText . '\', \'' . $nick . '\'
)',
'class' => 'add M2ePro_duplicate_button'
)
@@ -126,7 +131,9 @@ public function __construct()
if ($template->getId()) {
$url = $this->getUrl('*/adminhtml_ebay_template/delete');
$this->_addButton(
- 'delete', array(
+ 'delete',
+ array(
+ 'id' => 'delete_button',
'label' => Mage::helper('M2ePro')->__('Delete'),
'onclick' => 'EbayTemplateEditObj.delete_click(\'' . $url . '\')',
'class' => 'delete M2ePro_delete_button'
@@ -146,7 +153,9 @@ public function __construct()
$url = $this->getUrl('*/adminhtml_ebay_template/save');
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'EbayTemplateEditObj.save_click('
. '\'' . $url . '\','
@@ -160,7 +169,9 @@ public function __construct()
$backUrl = Mage::helper('M2ePro')->makeBackUrlParam('edit', array());
$url = $this->getUrl('*/adminhtml_ebay_template/save', array('back' => $backUrl));
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'EbayTemplateEditObj.save_and_edit_click('
. '\'' . $url . '\','
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Grid.php
index fe89076a7..b4742880a 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Grid.php
@@ -62,8 +62,8 @@ protected function _prepareColumns()
'width' => '100px',
'type' => 'number',
'index' => 'products_total_count',
- 'filter_index' => 'main_table.products_total_count',
- 'frame_callback' => array($this, 'callbackColumnTotalProducts')
+ 'filter_index' => 't.products_total_count',
+ 'frame_callback' => array($this, 'callbackColumnProductsCount')
)
);
@@ -74,8 +74,8 @@ protected function _prepareColumns()
'width' => '100px',
'type' => 'number',
'index' => 'products_active_count',
- 'filter_index' => 'main_table.products_active_count',
- 'frame_callback' => array($this, 'callbackColumnListedProducts')
+ 'filter_index' => 't.products_active_count',
+ 'frame_callback' => array($this, 'callbackColumnProductsCount')
)
);
@@ -86,11 +86,13 @@ protected function _prepareColumns()
'width' => '100px',
'type' => 'number',
'index' => 'products_inactive_count',
- 'filter_index' => 'main_table.products_inactive_count',
- 'frame_callback' => array($this, 'callbackColumnInactiveProducts')
+ 'filter_index' => 't.products_inactive_count',
+ 'frame_callback' => array($this, 'callbackColumnProductsCount')
)
);
+ $this->setColumns();
+
$this->addColumn(
'actions', array(
'header' => Mage::helper('M2ePro')->__('Actions'),
@@ -110,6 +112,11 @@ protected function _prepareColumns()
return parent::_prepareColumns();
}
+ protected function setColumns()
+ {
+ return null;
+ }
+
//########################################
public function callbackColumnTitle($value, $row, $column, $isExport)
@@ -122,9 +129,9 @@ protected function callbackFilterTitle($collection, $column)
return null;
}
- //########################################
+ // ---------------------------------------
- protected function getColumnValue($value)
+ public function callbackColumnProductsCount($value, $row, $column, $isExport)
{
if ($value === null || $value === '') {
$value = Mage::helper('M2ePro')->__('N/A');
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Moving/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Moving/Grid.php
index 4eef70d8a..e9b197ecb 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Moving/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Listing/Moving/Grid.php
@@ -138,16 +138,14 @@ public function callbackColumnStore($value, $row, $column, $isExport)
return ' '.$storeName;
}
- public function callbackColumnSourceTotalItems($value, $row, $column, $isExport)
+ public function callbackColumnSource($value, $row, $column, $isExport)
{
- $componentMode = $this->getRequest()->getParam('componentMode');
- $value = Mage::getResourceModel('M2ePro/' . ucfirst($componentMode) . '_Listing')->getStatisticTotalCount($row->id);
-
- if ($value <= 0) {
- $value = '0';
- }
+ return ' '.$value;
+ }
- return $value;
+ public function callbackColumnSourceTotalItems($value, $row, $column, $isExport)
+ {
+ return $value.' ';
}
public function callbackColumnActions($value, $row, $column, $isExport)
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Listing/Grid.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Listing/Grid.php
index b8e31d6d2..689f20e97 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Listing/Grid.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Listing/Grid.php
@@ -8,16 +8,10 @@
class Ess_M2ePro_Block_Adminhtml_Walmart_Listing_Grid extends Ess_M2ePro_Block_Adminhtml_Listing_Grid
{
- /** @var Ess_M2ePro_Model_Resource_Walmart_Listing */
- protected $_walmartListingResourceModel;
-
- //########################################
-
public function __construct()
{
parent::__construct();
$this->setId('walmartListingGrid');
- $this->_walmartListingResourceModel = Mage::getResourceModel('M2ePro/Walmart_Listing');
}
protected function _prepareCollection()
@@ -66,6 +60,32 @@ protected function _prepareCollection()
);
// ---------------------------------------
+ $structureHelper = Mage::helper('M2ePro/Module_Database_Structure');
+
+ $m2eproListing = $structureHelper->getTableNameWithPrefix('m2epro_listing');
+ $m2eproWalmartListing = $structureHelper->getTableNameWithPrefix('m2epro_walmart_listing');
+ $m2eproListingProduct = $structureHelper->getTableNameWithPrefix('m2epro_listing_product');
+
+ $sql = "SELECT
+ l.id AS listing_id,
+ COUNT(lp.id) AS products_total_count,
+ COUNT(CASE WHEN lp.status = 2 THEN lp.id END) AS products_active_count,
+ COUNT(CASE WHEN lp.status != 2 THEN lp.id END) AS products_inactive_count
+ FROM `{$m2eproListing}` AS `l`
+ INNER JOIN `{$m2eproWalmartListing}` AS `wl` ON l.id = wl.listing_id
+ LEFT JOIN `{$m2eproListingProduct}` AS `lp` ON l.id = lp.listing_id
+ GROUP BY listing_id";
+
+ $collection->getSelect()->joinLeft(
+ array('t' => new Zend_Db_Expr('('.$sql.')')),
+ 'main_table.id=t.listing_id',
+ array(
+ 'products_total_count' => 'products_total_count',
+ 'products_active_count' => 'products_active_count',
+ 'products_inactive_count' => 'products_inactive_count',
+ )
+ );
+
$this->setCollection($collection);
return parent::_prepareCollection();
@@ -248,45 +268,6 @@ protected function getColumnActionsItems()
//########################################
- public function callbackColumnTotalProducts($value, $row, $column, $isExport)
- {
- $value = $this->_walmartListingResourceModel->getStatisticTotalCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
- public function callbackColumnListedProducts($value, $row, $column, $isExport)
- {
- $value = $this->_walmartListingResourceModel->getStatisticActiveCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
- public function callbackColumnInactiveProducts($value, $row, $column, $isExport)
- {
- $value = $this->_walmartListingResourceModel->getStatisticInactiveCount($row->id);
-
- if ($value == 0) {
- $value = '0';
- }
-
- return $value;
- }
-
- //########################################
-
public function callbackColumnTitle($value, $row, $column, $isExport)
{
$value = '' .
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template.php
index 949571a6c..b41792731 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template.php
@@ -14,36 +14,27 @@ public function __construct()
{
parent::__construct();
- // Initialization block
- // ---------------------------------------
$this->setId('walmartTemplate');
$this->_blockGroup = 'M2ePro';
$this->_controller = 'adminhtml_walmart_template';
- // ---------------------------------------
- // Set header text
- // ---------------------------------------
$this->_headerText = '';
- // ---------------------------------------
- // Set buttons actions
- // ---------------------------------------
$this->removeButton('back');
$this->removeButton('reset');
$this->removeButton('delete');
$this->removeButton('save');
$this->removeButton('edit');
- // ---------------------------------------
- // ---------------------------------------
$this->_addButton(
- 'add', array(
- 'label' => Mage::helper('M2ePro')->__('Add Policy'),
- 'onclick' => '',
- 'class' => 'add add-button-drop-down'
+ 'add',
+ array(
+ 'id' => 'add_policy',
+ 'label' => Mage::helper('M2ePro')->__('Add Policy'),
+ 'onclick' => '',
+ 'class' => 'add add-button-drop-down'
)
);
- // -------------------------------------
}
public function getHeaderHtml()
@@ -52,6 +43,7 @@ public function getHeaderHtml()
'target_css_class' => 'add-button-drop-down',
'items' => array(
array(
+ 'id' => 'add_policy_category',
'url' => $this->getUrl(
'*/adminhtml_walmart_template/new',
array(
@@ -61,6 +53,7 @@ public function getHeaderHtml()
'label' => Mage::helper('M2ePro')->__('Category')
),
array(
+ 'id' => 'add_policy_description',
'url' => $this->getUrl(
'*/adminhtml_walmart_template/new',
array(
@@ -70,6 +63,7 @@ public function getHeaderHtml()
'label' => Mage::helper('M2ePro')->__('Description')
),
array(
+ 'id' => 'add_policy_selling',
'url' => $this->getUrl(
'*/adminhtml_walmart_template/new',
array(
@@ -79,6 +73,7 @@ public function getHeaderHtml()
'label' => Mage::helper('M2ePro')->__('Selling')
),
array(
+ 'id' => 'add_policy_synchronization',
'url' => $this->getUrl(
'*/adminhtml_walmart_template/new',
array(
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Category/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Category/Edit.php
index 3d757c3e3..de91e8223 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Category/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Category/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Category Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Category Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -54,10 +55,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('index');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'WalmartTemplateCategoryObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'WalmartTemplateCategoryObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -66,7 +69,9 @@ public function __construct()
if (!$isSaveAndClose && $this->isEditMode()) {
$headId = 'walmart-template-category';
$this->_addButton(
- 'duplicate', array(
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
'label' => Mage::helper('M2ePro')->__('Duplicate'),
'onclick' => "WalmartTemplateCategoryObj.duplicate_click('{$headId}')",
'class' => 'add M2ePro_duplicate_button'
@@ -74,10 +79,12 @@ public function __construct()
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'WalmartTemplateCategoryObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'WalmartTemplateCategoryObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -88,7 +95,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'WalmartTemplateCategoryObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -98,27 +105,31 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
- 'label' => Mage::helper('M2ePro')->__('Save'),
- 'onclick' => 'WalmartTemplateCategoryObj.save_click('
- . '\'\','
- . '\'' . $this->getSaveConfirmationText() . '\','
- . '\'' . Ess_M2ePro_Block_Adminhtml_Walmart_Template_Grid::TEMPLATE_CATEGORY . '\''
- . ')',
- 'class' => 'save'
+ 'save',
+ array(
+ 'id' => 'save_button',
+ 'label' => Mage::helper('M2ePro')->__('Save'),
+ 'onclick' => 'WalmartTemplateCategoryObj.save_click('
+ . '\'\','
+ . '\'' . $this->getSaveConfirmationText() . '\','
+ . '\'' . Ess_M2ePro_Block_Adminhtml_Walmart_Template_Grid::TEMPLATE_CATEGORY . '\''
+ . ')',
+ 'class' => 'save'
)
);
$this->_addButton(
- 'save_and_continue', array(
- 'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
- 'onclick' => 'WalmartTemplateCategoryObj.save_and_edit_click('
- . '\'\','
- . 'undefined,'
- . '\'' . $this->getSaveConfirmationText() . '\','
- . '\'' . Ess_M2ePro_Block_Adminhtml_Walmart_Template_Grid::TEMPLATE_CATEGORY . '\''
- . ')',
- 'class' => 'save'
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
+ 'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
+ 'onclick' => 'WalmartTemplateCategoryObj.save_and_edit_click('
+ . '\'\','
+ . 'undefined,'
+ . '\'' . $this->getSaveConfirmationText() . '\','
+ . '\'' . Ess_M2ePro_Block_Adminhtml_Walmart_Template_Grid::TEMPLATE_CATEGORY . '\''
+ . ')',
+ 'class' => 'save'
)
);
}
@@ -129,6 +140,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Description/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Description/Edit.php
index afdb16779..a6b7968bf 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Description/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Description/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Description Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Description Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -54,10 +55,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'CommonObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'CommonObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -66,7 +69,9 @@ public function __construct()
if (!$isSaveAndClose && $this->isEditMode()) {
$headId = 'walmart-template-description';
$this->_addButton(
- 'duplicate', array(
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
'label' => Mage::helper('M2ePro')->__('Duplicate'),
'onclick' => "WalmartTemplateDescriptionObj.duplicate_click('{$headId}')",
'class' => 'add M2ePro_duplicate_button'
@@ -74,10 +79,12 @@ public function __construct()
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'CommonObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'CommonObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -88,7 +95,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'WalmartTemplateDescriptionObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -98,7 +105,9 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'WalmartTemplateDescriptionObj.save_click('
. '\'\','
@@ -110,7 +119,9 @@ public function __construct()
);
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'WalmartTemplateDescriptionObj.save_and_edit_click('
. '\'\','
@@ -129,6 +140,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/SellingFormat/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/SellingFormat/Edit.php
index 03aff7268..f314416bf 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/SellingFormat/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/SellingFormat/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Selling Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Selling Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -51,10 +52,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'WalmartTemplateSellingFormatObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'WalmartTemplateSellingFormatObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -64,19 +67,23 @@ public function __construct()
&& Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getId()
) {
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => 'WalmartTemplateSellingFormatObj.duplicate_click'
- .'(\'walmart-template-sellingFormat\')',
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => 'WalmartTemplateSellingFormatObj.duplicate_click'
+ . '(\'walmart-template-sellingFormat\')',
+ 'class' => 'add M2ePro_duplicate_button'
)
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'WalmartTemplateSellingFormatObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'WalmartTemplateSellingFormatObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -87,7 +94,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'WalmartTemplateSellingFormatObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -97,7 +104,9 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'WalmartTemplateSellingFormatObj.save_click('
. '\'\','
@@ -109,7 +118,9 @@ public function __construct()
);
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'WalmartTemplateSellingFormatObj.save_and_edit_click('
. '\'\','
@@ -128,6 +139,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Synchronization/Edit.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Synchronization/Edit.php
index 4c003a425..12b6386ba 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Synchronization/Edit.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Walmart/Template/Synchronization/Edit.php
@@ -25,7 +25,8 @@ public function __construct()
if ($this->isEditMode()) {
$this->_headerText = Mage::helper('M2ePro')->__(
- 'Edit %component_name% Synchronization Policy "%template_title%"', $componentName,
+ 'Edit %component_name% Synchronization Policy "%template_title%"',
+ $componentName,
$this->escapeHtml(Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getTitle())
);
} else {
@@ -54,10 +55,12 @@ public function __construct()
$url = Mage::helper('M2ePro')->getBackUrl('list');
$this->_addButton(
- 'back', array(
- 'label' => Mage::helper('M2ePro')->__('Back'),
- 'onclick' => 'WalmartTemplateSynchronizationObj.back_click(\'' . $url . '\')',
- 'class' => 'back'
+ 'back',
+ array(
+ 'id' => 'back_button',
+ 'label' => Mage::helper('M2ePro')->__('Back'),
+ 'onclick' => 'WalmartTemplateSynchronizationObj.back_click(\'' . $url . '\')',
+ 'class' => 'back'
)
);
@@ -66,19 +69,23 @@ public function __construct()
if (!$isSaveAndClose && Mage::helper('M2ePro/Data_Global')->getValue('temp_data')
&& Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getId()) {
$this->_addButton(
- 'duplicate', array(
- 'label' => Mage::helper('M2ePro')->__('Duplicate'),
- 'onclick' => 'WalmartTemplateSynchronizationObj.duplicate_click'
- .'(\'walmart-template-synchronization\')',
- 'class' => 'add M2ePro_duplicate_button'
+ 'duplicate',
+ array(
+ 'id' => 'duplicate_button',
+ 'label' => Mage::helper('M2ePro')->__('Duplicate'),
+ 'onclick' => 'WalmartTemplateSynchronizationObj.duplicate_click'
+ . '(\'walmart-template-synchronization\')',
+ 'class' => 'add M2ePro_duplicate_button'
)
);
$this->_addButton(
- 'delete', array(
- 'label' => Mage::helper('M2ePro')->__('Delete'),
- 'onclick' => 'WalmartTemplateSynchronizationObj.delete_click()',
- 'class' => 'delete M2ePro_delete_button'
+ 'delete',
+ array(
+ 'id' => 'delete_button',
+ 'label' => Mage::helper('M2ePro')->__('Delete'),
+ 'onclick' => 'WalmartTemplateSynchronizationObj.delete_click()',
+ 'class' => 'delete M2ePro_delete_button'
)
);
}
@@ -89,7 +96,7 @@ public function __construct()
$this->_addButton(
'save',
array(
- 'id' => 'save_and_close',
+ 'id' => 'save_and_close_button',
'label' => Mage::helper('M2ePro')->__('Save And Close'),
'onclick' => 'WalmartTemplateSynchronizationObj.saveAndClose('
. '\'' . $this->getUrl('*/*/save', array('_current' => true)) . '\','
@@ -99,7 +106,9 @@ public function __construct()
);
} else {
$this->_addButton(
- 'save', array(
+ 'save',
+ array(
+ 'id' => 'save_button',
'label' => Mage::helper('M2ePro')->__('Save'),
'onclick' => 'WalmartTemplateSynchronizationObj.save_click('
. '\'\','
@@ -111,7 +120,9 @@ public function __construct()
);
$this->_addButton(
- 'save_and_continue', array(
+ 'save_and_continue',
+ array(
+ 'id' => 'save_and_continue_button',
'label' => Mage::helper('M2ePro')->__('Save And Continue Edit'),
'onclick' => 'WalmartTemplateSynchronizationObj.save_and_edit_click('
. '\'\','
@@ -130,6 +141,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
+
return $templateModel && $templateModel->getId();
}
diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Widget/Button/DropDown.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Widget/Button/DropDown.php
index 12d46791e..ebff0fdd8 100644
--- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Widget/Button/DropDown.php
+++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Widget/Button/DropDown.php
@@ -36,13 +36,14 @@ public function getDropDownHtml()
$url = $item['url'];
$label = $item['label'];
+ $id = isset($item['id']) ? $item['id'] : '';
$target = isset($item['target']) ? $item['target'] : '_self';
$onclick = isset($item['onclick']) ? $item['onclick'] : '';
$style = (string)$this->getStyle();
$html .= <<{$label}
+