Skip to content

Commit

Permalink
1.69.0 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Oct 29, 2024
1 parent e6e260c commit b62b847
Show file tree
Hide file tree
Showing 22 changed files with 407 additions and 252 deletions.
12 changes: 9 additions & 3 deletions Block/Adminhtml/Ebay/Listing/Create/General/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,19 @@ protected function _prepareForm()
$title = $this->ebayFactory->getObject('Listing')->getCollection()->getSize() == 0 ? 'Default' : '';
$accountId = '';

$account = $this->ebayFactory->getObject('Account')->getCollection()->getLastItem();
/** @var \Ess\M2ePro\Model\Account $accountModel */
$accountModel = $this->ebayFactory->getObject('Account');
/** @var \Ess\M2ePro\Model\Account $account */
$account = $accountModel->getCollection()->getLastItem();
$marketplaceId = $this->getRequest()->getParam('marketplace_id', '');
$marketplaceSelectionDisabled = true;
if (!$marketplaceId && $account->getId()) {
$accountId = $account->getId();
$info = \Ess\M2ePro\Helper\Json::decode($account->getChildObject()->getInfo());
$marketplaceId = $this->activeRecordFactory->getObject('Marketplace')->getIdByCode($info['Site']);
/** @var \Ess\M2ePro\Model\Ebay\Account $ebayAccount */
$ebayAccount = $account->getChildObject();
/** @var \Ess\M2ePro\Model\Marketplace $marketplaceModel */
$marketplaceModel = $this->activeRecordFactory->getObject('Marketplace');
$marketplaceId = $marketplaceModel->getIdByCode($ebayAccount->getEbaySite());
$marketplaceSelectionDisabled = false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,7 @@ protected function _prepareForm()
<tfoot>
HTML;

if (
!$this->getListingProductTypeModel()->hasChannelGroupId() &&
!$this->getListingProduct()->isSetProcessingLock('child_products_in_action')
) {
if (!$this->getListingProduct()->isSetProcessingLock('child_products_in_action')) {
$button = $this->getLayout()->createBlock(\Ess\M2ePro\Block\Adminhtml\Magento\Button::class)->setData([
'class' => 'action primary',
'label' => $this->getListingProductTypeModel()->hasChannelAttributes() ?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,9 @@ public function callbackColumnChannelOptions($additionalData, $row, $column, $is
$sortedOptions = [];

foreach ($matchedAttributes as $magentoAttr => $walmartAttr) {
if (empty($options[$walmartAttr])) {
continue;
}
$sortedOptions[$walmartAttr] = $options[$walmartAttr];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ public function execute()

foreach ($matchedAttributes as $productAttribute => $channelAttribute) {
$productOption = $magentoOptions[$productAttribute];
$channelOption = $channelOptions[$channelAttribute];
$channelOption = $channelOptions[$channelAttribute] ?? null;

if ($productOption == $channelOption) {
if (
$channelOption === null
|| $productOption == $channelOption
) {
continue;
}

Expand Down
16 changes: 2 additions & 14 deletions Helper/Module/Support.php
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
<?php

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

namespace Ess\M2ePro\Helper\Module;

class Support
{
public const DOCUMENTATION_URL = 'https://docs-m2.m2epro.com/';

/** @var \Magento\Backend\Model\UrlInterface */
protected $urlBuilder;
/** @var \Ess\M2ePro\Model\Factory */
Expand All @@ -23,14 +19,6 @@ class Support
/** @var \Ess\M2ePro\Model\Config\Manager */
private $config;

/**
* @param \Magento\Backend\Model\UrlInterface $urlBuilder
* @param \Ess\M2ePro\Model\Factory $modelFactory
* @param \Ess\M2ePro\Helper\Magento $magentoHelper
* @param \Ess\M2ePro\Helper\Module $moduleHelper
* @param \Ess\M2ePro\Helper\Client $clientHelper
* @param \Ess\M2ePro\Model\Config\Manager $config
*/
public function __construct(
\Magento\Backend\Model\UrlInterface $urlBuilder,
\Ess\M2ePro\Model\Factory $modelFactory,
Expand Down
25 changes: 25 additions & 0 deletions Model/Ebay/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -1257,4 +1257,29 @@ public function isFinalFeeUpdateEnabled(): bool

return (bool)$setting;
}

public function getEbaySite(): string
{
$site = (string)$this->getData(\Ess\M2ePro\Model\ResourceModel\Ebay\Account::COLUMN_EBAY_SITE);
if (!empty($site)) {
return $site;
}

$info = $this->getInfo();
if (empty($info)) {
return '';
}

$infoData = json_decode($info, true);
if (!is_array($infoData) || !isset($infoData['Site'])) {
return '';
}

return $infoData['Site'];
}

public function getInfo()
{
return $this->getData(\Ess\M2ePro\Model\ResourceModel\Ebay\Account::COLUMN_INFO);
}
}
9 changes: 7 additions & 2 deletions Model/Ebay/Account/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Ess\M2ePro\Model\Ebay\Account;

use Ess\M2ePro\Model\Ebay\Account as Account;
use Ess\M2ePro\Model\ResourceModel\Ebay\Account as EbayAccountResource;

class Builder extends \Ess\M2ePro\Model\ActiveRecord\AbstractBuilder
{
Expand All @@ -29,7 +30,8 @@ protected function prepareData()
'mode',
'user_id',
'is_token_exist',
'info',
EbayAccountResource::COLUMN_INFO,
EbayAccountResource::COLUMN_EBAY_SITE,
'server_hash',
'sell_api_token_expired_date',
];
Expand Down Expand Up @@ -433,7 +435,7 @@ public function getDefaultData(): array
'other_listings_mapping_settings' => [
'sku' => [
'mode' => Account::OTHER_LISTINGS_MAPPING_SKU_MODE_DEFAULT,
'priority' => 1
'priority' => 1,
],
],
'mapping_sku_mode' => Account::OTHER_LISTINGS_MAPPING_SKU_MODE_DEFAULT,
Expand Down Expand Up @@ -505,11 +507,14 @@ public function getDefaultData(): array
'create_magento_shipment' => 1,
'skip_evtin' => 0,

EbayAccountResource::COLUMN_EBAY_SITE => '',
'ebay_store_title' => '',
'ebay_store_url' => '',
'ebay_store_subscription_level' => '',
'ebay_store_description' => '',

EbayAccountResource::COLUMN_INFO => json_encode([]),

'feedbacks_receive' => 0,
'feedbacks_auto_response' => Account::FEEDBACKS_AUTO_RESPONSE_NONE,
'feedbacks_auto_response_only_positive' => 0,
Expand Down
15 changes: 8 additions & 7 deletions Model/Ebay/Account/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Ess\M2ePro\Model\Ebay\Account;

use Ess\M2ePro\Model\Ebay\Account as EbayAccount;
use Ess\M2ePro\Model\ResourceModel\Ebay\Account as EbayAccountResource;

class Create
{
Expand Down Expand Up @@ -44,13 +45,13 @@ public function create(string $authCode, int $mode): \Ess\M2ePro\Model\Account
throw new \Ess\M2ePro\Model\Exception('An account with the same eBay User ID already exists.');
}

$data['mode'] = $mode;
$data['is_token_exist'] = 1;
$data['info'] = \Ess\M2ePro\Helper\Json::encode($responseData['info']);
$data['sell_api_token_expired_date'] = $responseData['token_expired_date'];
$data['server_hash'] = $responseData['hash'];
$data['user_id'] = $responseData['user_id'];
$data['title'] = $responseData['user_id'];
$data[EbayAccountResource::COLUMN_MODE] = $mode;
$data[EbayAccountResource::COLUMN_IS_TOKEN_EXIST] = 1;
$data[EbayAccountResource::COLUMN_EBAY_SITE] = $responseData['site'];
$data[EbayAccountResource::COLUMN_SELL_API_TOKEN_EXPIRED_DATE] = $responseData['token_expired_date'];
$data[EbayAccountResource::COLUMN_SERVER_HASH] = $responseData['hash'];
$data[EbayAccountResource::COLUMN_USER_ID] = $responseData['user_id'];
$data[\Ess\M2ePro\Model\ResourceModel\Account::COLUMN_TITLE] = $responseData['user_id'];

$builder->build($account, $data);

Expand Down
9 changes: 5 additions & 4 deletions Model/Ebay/Account/Update.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use Ess\M2ePro\Model\Ebay\Account as EbayAccount;
use Ess\M2ePro\Model\Ebay\Account\Issue\ValidTokens;
use Ess\M2ePro\Model\ResourceModel\Ebay\Account as EbayAccountResource;

class Update
{
Expand Down Expand Up @@ -45,10 +46,10 @@ public function updateCredentials(
$responseData = $this->updateOnServer($account, $authCode, $mode);

$dataForUpdate = [
'info' => \Ess\M2ePro\Helper\Json::encode($responseData['info']),
'sell_api_token_expired_date' => $responseData['token_expired_date'],
'user_id' => $responseData['user_id'],
'is_token_exist' => 1
EbayAccountResource::COLUMN_EBAY_SITE => $responseData['site'],
EbayAccountResource::COLUMN_SELL_API_TOKEN_EXPIRED_DATE => $responseData['token_expired_date'],
EbayAccountResource::COLUMN_USER_ID => $responseData['user_id'],
EbayAccountResource::COLUMN_IS_TOKEN_EXIST => 1
];

$account->getChildObject()->addData($dataForUpdate);
Expand Down
2 changes: 1 addition & 1 deletion Model/Ebay/Connector/Protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class Protocol implements \Ess\M2ePro\Model\Connector\ProtocolInterface
{
public const COMPONENT_VERSION = 26;
public const COMPONENT_VERSION = 27;

public function getComponent(): string
{
Expand Down
1 change: 1 addition & 0 deletions Model/ResourceModel/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
class Account extends ActiveRecord\Component\Parent\AbstractModel
{
public const COLUMN_ID = 'id';
public const COLUMN_TITLE = 'title';
public const COLUMN_CREATE_DATE = 'create_date';

public function _construct()
Expand Down
30 changes: 30 additions & 0 deletions Model/ResourceModel/Ebay/Account.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,37 @@
class Account extends \Ess\M2ePro\Model\ResourceModel\ActiveRecord\Component\Child\AbstractModel
{
public const COLUMN_ACCOUNT_ID = 'account_id';
public const COLUMN_MODE = 'mode';
public const COLUMN_SERVER_HASH = 'server_hash';
public const COLUMN_USER_ID = 'user_id';
public const COLUMN_IS_TOKEN_EXIST = 'is_token_exist';
public const COLUMN_SELL_API_TOKEN_EXPIRED_DATE = 'sell_api_token_expired_date';
public const COLUMN_MARKETPLACES_DATA = 'marketplaces_data';
public const COLUMN_INVENTORY_LAST_SYNCHRONIZATION = 'inventory_last_synchronization';
public const COLUMN_OTHER_LISTINGS_SYNCHRONIZATION = 'other_listings_synchronization';
public const COLUMN_OTHER_LISTINGS_MAPPING_MODE = 'other_listings_mapping_mode';
public const COLUMN_OTHER_LISTINGS_MAPPING_SETTINGS = 'other_listings_mapping_settings';
public const COLUMN_OTHER_LISTINGS_LAST_SYNCHRONIZATION = 'other_listings_last_synchronization';
public const COLUMN_FEEDBACKS_RECEIVE = 'feedbacks_receive';
public const COLUMN_FEEDBACKS_AUTO_RESPONSE = 'feedbacks_auto_response';
public const COLUMN_FEEDBACKS_AUTO_RESPONSE_ONLY_POSITIVE = 'feedbacks_auto_response_only_positive';
public const COLUMN_FEEDBACKS_LAST_USED_ID = 'feedbacks_last_used_id';
public const COLUMN_EBAY_SITE = 'ebay_site';
public const COLUMN_EBAY_STORE_TITLE = 'ebay_store_title';
public const COLUMN_EBAY_STORE_URL = 'ebay_store_url';
public const COLUMN_EBAY_STORE_SUBSCRIPTION_LEVEL = 'ebay_store_subscription_level';
public const COLUMN_EBAY_STORE_DESCRIPTION = 'ebay_store_description';
public const COLUMN_INFO = 'info';
public const COLUMN_USER_PREFERENCES = 'user_preferences';
public const COLUMN_RATE_TABLES = 'rate_tables';
public const COLUMN_EBAY_SHIPPING_DISCOUNT_PROFILES = 'ebay_shipping_discount_profiles';
public const COLUMN_JOB_TOKEN = 'job_token';
public const COLUMN_ORDERS_LAST_SYNCHRONIZATION = 'orders_last_synchronization';
public const COLUMN_MAGENTO_ORDERS_SETTINGS = 'magento_orders_settings';
public const COLUMN_CREATE_MAGENTO_INVOICE = 'create_magento_invoice';
public const COLUMN_CREATE_MAGENTO_SHIPMENT = 'create_magento_shipment';
public const COLUMN_SKIP_EVTIN = 'skip_evtin';
public const COLUMN_MESSAGES_RECEIVE = 'messages_receive';

/** @var bool */
protected $_isPkAutoIncrement = false;
Expand Down
Loading

0 comments on commit b62b847

Please sign in to comment.