Skip to content

Commit

Permalink
6.22.1 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed May 24, 2022
1 parent 83465ed commit ca7165e
Show file tree
Hide file tree
Showing 107 changed files with 1,286 additions and 969 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -248,45 +268,6 @@ protected function getColumnActionsItems()

//########################################

public function callbackColumnTotalProducts($value, $row, $column, $isExport)
{
$value = $this->_amazonListingResourceModel->getStatisticTotalCount($row->id);

if ($value == 0) {
$value = '<span style="color: red;">0</span>';
}

return $value;
}

//########################################

public function callbackColumnListedProducts($value, $row, $column, $isExport)
{
$value = $this->_amazonListingResourceModel->getStatisticActiveCount($row->id);

if ($value == 0) {
$value = '<span style="color: red;">0</span>';
}

return $value;
}

//########################################

public function callbackColumnInactiveProducts($value, $row, $column, $isExport)
{
$value = $this->_amazonListingResourceModel->getStatisticInactiveCount($row->id);

if ($value == 0) {
$value = '<span style="color: red;">0</span>';
}

return $value;
}

//########################################

public function callbackColumnTitle($value, $row, $column, $isExport)
{
$value = '<span id="listing_title_'.$row->getId().'">' .
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
33 changes: 22 additions & 11 deletions app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Order/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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;
}
}

Expand Down
25 changes: 10 additions & 15 deletions app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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'
)
);

Expand All @@ -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'
)
);
}
Expand All @@ -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)) . '\','
Expand All @@ -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('
. '\'\','
Expand All @@ -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('
. '\'\','
Expand All @@ -128,6 +140,7 @@ public function __construct()
protected function isEditMode()
{
$templateModel = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');

return $templateModel && $templateModel->getId();
}

Expand Down
Loading

0 comments on commit ca7165e

Please sign in to comment.