Skip to content

Commit

Permalink
1.59.0 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Mar 21, 2024
1 parent 6aaef4e commit e449fb7
Show file tree
Hide file tree
Showing 69 changed files with 1,255 additions and 2,330 deletions.
14 changes: 10 additions & 4 deletions Block/Adminhtml/Amazon/Template/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ protected function _prepareCollection()
'id as template_id',
'title',
new \Zend_Db_Expr('\'' . self::TEMPLATE_SELLING_FORMAT . '\' as `type`'),
new \Zend_Db_Expr('NULL as `marketplace_title`'),
new \Zend_Db_Expr('\'0\' as `marketplace_id`'),
'create_date',
'update_date',
Expand All @@ -91,6 +92,7 @@ protected function _prepareCollection()
'id as template_id',
'title',
new \Zend_Db_Expr('\'' . self::TEMPLATE_SYNCHRONIZATION . '\' as `type`'),
new \Zend_Db_Expr('NULL as `marketplace_title`'),
new \Zend_Db_Expr('\'0\' as `marketplace_id`'),
'create_date',
'update_date',
Expand All @@ -111,7 +113,7 @@ protected function _prepareCollection()
->getCollection();
$collectionShipping->getSelect()->join(
['mm' => $this->marketplaceFactory->create()->getResource()->getMainTable()],
'mm.id=main_table.marketplace_id',
'main_table.marketplace_id=mm.id',
[]
);
$collectionShipping->addFieldToFilter('mm.status', \Ess\M2ePro\Model\Marketplace::STATUS_ENABLE);
Expand All @@ -121,14 +123,16 @@ protected function _prepareCollection()
'id as template_id',
'title',
new \Zend_Db_Expr('\'' . self::TEMPLATE_SHIPPING . '\' as `type`'),
'marketplace_id',
new \Zend_Db_Expr('mm.title as `marketplace_title`'),
new \Zend_Db_Expr('mm.id as `marketplace_id`'),
'create_date',
'update_date',
new \Zend_Db_Expr('NULL as `category_path`'),
new \Zend_Db_Expr('NULL as `browsenode_id`'),
new \Zend_Db_Expr('NULL as `is_new_asin_accepted`'),
]
);
$collectionShipping->addFieldToFilter('mm.status', \Ess\M2ePro\Model\Marketplace::STATUS_ENABLE);
// ---------------------------------------

// Prepare Product Tax Code collection
Expand All @@ -142,6 +146,7 @@ protected function _prepareCollection()
'id as template_id',
'title',
new \Zend_Db_Expr('\'' . self::TEMPLATE_PRODUCT_TAX_CODE . '\' as `type`'),
new \Zend_Db_Expr('NULL as `marketplace_title`'),
new \Zend_Db_Expr('\'0\' as `marketplace_id`'),
'create_date',
'update_date',
Expand Down Expand Up @@ -176,6 +181,7 @@ protected function _prepareCollection()
'template_id',
'title',
'type',
'marketplace_title',
'marketplace_id',
'create_date',
'update_date',
Expand Down Expand Up @@ -222,8 +228,8 @@ protected function _prepareColumns()
'align' => 'left',
'type' => 'options',
'width' => '100px',
'index' => 'marketplace_id',
'filter_index' => 'marketplace_id',
'index' => 'marketplace_title',
'filter_index' => 'marketplace_title',
'filter_condition_callback' => [$this, 'callbackFilterMarketplace'],
'frame_callback' => [$this, 'callbackColumnMarketplace'],
'options' => $this->getEnabledMarketplaceTitles(),
Expand Down
57 changes: 46 additions & 11 deletions Block/Adminhtml/Ebay/Account.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
<?php

/**
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

namespace Ess\M2ePro\Block\Adminhtml\Ebay;

use Ess\M2ePro\Block\Adminhtml\Magento\Grid\AbstractContainer;

class Account extends AbstractContainer
class Account extends \Ess\M2ePro\Block\Adminhtml\Magento\Grid\AbstractContainer
{
/** @var \Ess\M2ePro\Helper\Data */
private $dataHelper;
Expand All @@ -29,8 +21,41 @@ protected function _construct()
parent::_construct();
$this->_controller = 'adminhtml_ebay_account';

$this->buttonList->update('add', 'label', $this->__('Add Account'));
$this->buttonList->update('add', 'onclick', 'setLocation(\'' . $this->getUrl('*/ebay_account/new') . '\');');
$this->removeButton('add');

$saveButtons = [
'id' => 'add-ebay-account',
'label' => __('Add Account'),
'class' => 'add-ebay-account',
'style' => 'pointer-events: none',
'class_name' => \Ess\M2ePro\Block\Adminhtml\Magento\Button\SplitButton::class,
'options' => [
'production' => [
'label' => __('Live Account'),
'id' => 'production',
'onclick' => 'setLocation(this.getAttribute("data-url"))',
'data_attribute' => [
'url' => $this->getUrl(
'*/ebay_account/beforeGetSellApiToken',
['mode' => \Ess\M2ePro\Model\Ebay\Account::MODE_PRODUCTION]
),
],
],
'sandbox' => [
'label' => __('Sandbox Account'),
'id' => 'sandbox',
'onclick' => 'setLocation(this.getAttribute("data-url"))',
'data_attribute' => [
'url' => $this->getUrl(
'*/ebay_account/beforeGetSellApiToken',
['mode' => \Ess\M2ePro\Model\Ebay\Account::MODE_SANDBOX]
),
],
],
],
];

$this->addButton('add', $saveButtons);
}

protected function _prepareLayout()
Expand All @@ -48,9 +73,19 @@ protected function _prepareLayout()
]);

$this->jsUrl->addUrls($this->dataHelper->getControllerActions('Ebay_Account_Feedback'));
$this->js->add(
<<<JS
require([
'M2ePro/Ebay/Account'
], function(){
window.EbayAccountObj = new EbayAccount();
});
JS
);

$this->jsTranslator->addTranslations([
'Should be between 2 and 80 characters long.' => $this->__('Should be between 2 and 80 characters long.'),
'Select Account Mode' => __('Select Account Mode')
]);

$this->css->addFile('ebay/account/feedback.css');
Expand Down
80 changes: 21 additions & 59 deletions Block/Adminhtml/Ebay/Account/Edit.php
Original file line number Diff line number Diff line change
@@ -1,37 +1,15 @@
<?php

/**
* @author M2E Pro Developers Team
* @copyright M2E LTD
* @license Commercial use is forbidden
*/

namespace Ess\M2ePro\Block\Adminhtml\Ebay\Account;

use Ess\M2ePro\Block\Adminhtml\Magento\Form\AbstractContainer;

class Edit extends AbstractContainer
class Edit extends \Ess\M2ePro\Block\Adminhtml\Magento\Form\AbstractContainer
{
/** @var \Ess\M2ePro\Helper\Data\GlobalData */
private $globalDataHelper;

public function __construct(
\Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Widget $context,
array $data = []
) {
$this->globalDataHelper = $globalDataHelper;
parent::__construct($context, $data);
}

protected function _construct()
{
parent::_construct();

$this->_controller = 'adminhtml_ebay_account';

// Set buttons actions
// ---------------------------------------
$this->removeButton('back');
$this->removeButton('reset');
$this->removeButton('delete');
Expand Down Expand Up @@ -63,44 +41,28 @@ protected function _construct()
'class' => 'back',
]);

$saveButtonsProps = [];
if (
$this->globalDataHelper->getValue('edit_account') &&
$this->globalDataHelper->getValue('edit_account')->getId()
) {
$this->addButton('delete', [
'label' => $this->__('Delete'),
'onclick' => 'EbayAccountObj.deleteClick()',
'class' => 'delete M2ePro_delete_button primary',
]);
$this->addButton('delete', [
'label' => $this->__('Delete'),
'onclick' => 'EbayAccountObj.deleteClick()',
'class' => 'delete M2ePro_delete_button primary',
]);

$saveButtonsProps['save'] = [
'label' => $this->__('Save And Back'),
'onclick' => 'EbayAccountObj.saveClick()',
'class' => 'save primary',
];
}
$saveButtonsProps['save'] = [
'label' => $this->__('Save And Back'),
'onclick' => 'EbayAccountObj.saveClick()',
'class' => 'save primary',
];

// ---------------------------------------
if (!empty($saveButtonsProps)) {
$saveButtons = [
'id' => 'save_and_continue',
'label' => $this->__('Save And Continue Edit'),
'class' => 'add',
'button_class' => '',
'onclick' => 'EbayAccountObj.saveAndEditClick(\'\', \'ebayAccountEditTabs\')',
'class_name' => \Ess\M2ePro\Block\Adminhtml\Magento\Button\SplitButton::class,
'options' => $saveButtonsProps,
];
$saveButtons = [
'id' => 'save_and_continue',
'label' => $this->__('Save And Continue Edit'),
'class' => 'add',
'button_class' => '',
'onclick' => 'EbayAccountObj.saveAndEditClick(\'\', \'ebayAccountEditTabs\')',
'class_name' => \Ess\M2ePro\Block\Adminhtml\Magento\Button\SplitButton::class,
'options' => $saveButtonsProps,
];

$this->addButton('save_buttons', $saveButtons);
} else {
$this->addButton('save_and_continue', [
'label' => $this->__('Save And Continue Edit'),
'class' => 'add primary',
'onclick' => 'EbayAccountObj.saveAndEditClick(\'\')',
]);
}
// ---------------------------------------
$this->addButton('save_buttons', $saveButtons);
}
}
Loading

0 comments on commit e449fb7

Please sign in to comment.