Skip to content

Commit

Permalink
1.67.0 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Sep 12, 2024
1 parent c8b305d commit 9276f12
Show file tree
Hide file tree
Showing 161 changed files with 3,469 additions and 4,206 deletions.
16 changes: 4 additions & 12 deletions Block/Adminhtml/Amazon/Listing/AllItems/Grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,25 +344,17 @@ private function getSubSelectForAmazonListingProductsWithTags(int $tagId): \Mage
{
$collection = $this->amazonProductCollectionFactory->create();
$collection->distinct(true);
$collection->joinLeft(
['main_table_child' => $this->amazonProductResource->getMainTable()],
'main_table.listing_product_id = main_table_child.variation_parent_id'
);
$collection->join(
['tag_rel' => $this->tagRelationResource->getMainTable()],
'main_table.listing_product_id = tag_rel.listing_product_id'
. ' OR main_table_child.listing_product_id = tag_rel.listing_product_id'
);
$collection->join(
['tag' => $this->tagResource->getMainTable()],
'tag.id = tag_rel.tag_id'
);

$collection->getSelect()->where('main_table.variation_parent_id IS NULL');
$collection->getSelect()->where('tag.id = ?', $tagId);
$collection->getSelect()->where('tag_rel.tag_id = ?', $tagId);

$collection->getSelect()->reset('columns');
$collection->getSelect()->columns('main_table.listing_product_id');
$collection->getSelect()->columns(
new \Zend_Db_Expr('IFNULL(main_table.variation_parent_id, main_table.listing_product_id)')
);

return $collection->getSelect();
}
Expand Down
36 changes: 8 additions & 28 deletions Block/Adminhtml/Amazon/Listing/AutoAction/Mode/Category/Form.php
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
<?php

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

namespace Ess\M2ePro\Block\Adminhtml\Amazon\Listing\AutoAction\Mode\Category;

use Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory as AmazonProductTypeCollectionFactory;

class Form extends \Ess\M2ePro\Block\Adminhtml\Listing\AutoAction\Mode\Category\AbstractForm
{
/** @var \Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory */
private $amazonProductTypeCollectionFactory;
private \Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository;

/**
* @param \Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\FormFactory $formFactory
* @param \Ess\M2ePro\Helper\Data $dataHelper
* @param AmazonProductTypeCollectionFactory $amazonProductTypeCollectionFactory
* @param array $data
*/
public function __construct(
\Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Ess\M2ePro\Helper\Data $dataHelper,
AmazonProductTypeCollectionFactory $amazonProductTypeCollectionFactory,
array $data = []
) {
$this->amazonTemplateProductTypeRepository = $amazonTemplateProductTypeRepository;
parent::__construct($context, $registry, $formFactory, $dataHelper, $data);
$this->amazonProductTypeCollectionFactory = $amazonProductTypeCollectionFactory;
}

public function _construct()
Expand All @@ -45,8 +28,6 @@ public function _construct()
// ---------------------------------------
}

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

protected function _prepareForm()
{
$form = $this->_formFactory->create([
Expand Down Expand Up @@ -155,16 +136,15 @@ protected function _prepareForm()
]
);

$collection = $this->amazonProductTypeCollectionFactory->create();
$collection->appendFilterMarketplaceId($this->getListing()->getMarketplaceId());

$productTypeTemplates = $collection->getData();
$productTypeTemplates = $this->amazonTemplateProductTypeRepository->findByMarketplaceId(
$this->getListing()->getMarketplaceId()
);

$options = [['label' => '', 'value' => '', 'attrs' => ['class' => 'empty']]];
foreach ($productTypeTemplates as $template) {
$options[] = [
'label' => $this->_escaper->escapeHtml($template['title']),
'value' => $template['id'],
'label' => $this->_escaper->escapeHtml($template->getTitle()),
'value' => $template->getId(),
];
}

Expand Down
20 changes: 8 additions & 12 deletions Block/Adminhtml/Amazon/Listing/AutoAction/Mode/GlobalMode.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,23 @@

namespace Ess\M2ePro\Block\Adminhtml\Amazon\Listing\AutoAction\Mode;

use Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory as AmazonProductTypeCollectionFactory;

class GlobalMode extends \Ess\M2ePro\Block\Adminhtml\Listing\AutoAction\Mode\AbstractGlobalMode
{
/** @var \Ess\M2ePro\Helper\Module\Support */
private $supportHelper;
/** @var \Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory */
private $amazonProductTypeCollectionFactory;
private \Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository;

public function __construct(
\Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Ess\M2ePro\Helper\Module\Support $supportHelper,
\Ess\M2ePro\Helper\Data $dataHelper,
AmazonProductTypeCollectionFactory $amazonProductTypeCollectionFactory,
array $data = []
) {
$this->supportHelper = $supportHelper;
$this->amazonProductTypeCollectionFactory = $amazonProductTypeCollectionFactory;
$this->amazonTemplateProductTypeRepository = $amazonTemplateProductTypeRepository;
parent::__construct($context, $registry, $formFactory, $dataHelper, $data);
}

Expand Down Expand Up @@ -156,16 +153,15 @@ protected function _prepareForm()
]
);

$collection = $this->amazonProductTypeCollectionFactory->create();
$collection->appendFilterMarketplaceId($this->getListing()->getMarketplaceId());

$productTypesTemplates = $collection->getData();
$productTypesTemplates = $this->amazonTemplateProductTypeRepository->findByMarketplaceId(
$this->getListing()->getMarketplaceId(),
);

$options = [['label' => '', 'value' => '', 'attrs' => ['class' => 'empty']]];
foreach ($productTypesTemplates as $template) {
$options[] = [
'label' => $this->_escaper->escapeHtml($template['title']),
'value' => $template['id']
'label' => $this->_escaper->escapeHtml($template->getTitle()),
'value' => $template->getId(),
];
}

Expand Down
29 changes: 8 additions & 21 deletions Block/Adminhtml/Amazon/Listing/AutoAction/Mode/Website.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,32 +14,21 @@ class Website extends \Ess\M2ePro\Block\Adminhtml\Listing\AutoAction\Mode\Abstra
{
/** @var \Ess\M2ePro\Helper\Module\Support */
private $supportHelper;
/** @var \Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory */
private $amazonProductTypeCollectionFactory;
private \Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository;

/**
* @param \Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context
* @param \Magento\Framework\Registry $registry
* @param \Magento\Framework\Data\FormFactory $formFactory
* @param \Ess\M2ePro\Helper\Module\Support $supportHelper
* @param \Ess\M2ePro\Helper\Data $dataHelper
* @param \Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper
* @param \Ess\M2ePro\Helper\Magento\Store $magentoStoreHelper
* @param AmazonProductTypeCollectionFactory $amazonProductTypeCollectionFactory
* @param array $data
*/
public function __construct(
\Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
\Magento\Framework\Registry $registry,
\Magento\Framework\Data\FormFactory $formFactory,
\Ess\M2ePro\Helper\Module\Support $supportHelper,
\Ess\M2ePro\Helper\Data $dataHelper,
\Ess\M2ePro\Helper\Data\GlobalData $globalDataHelper,
\Ess\M2ePro\Helper\Magento\Store $magentoStoreHelper,
AmazonProductTypeCollectionFactory $amazonProductTypeCollectionFactory,
array $data = []
) {
$this->supportHelper = $supportHelper;
$this->amazonTemplateProductTypeRepository = $amazonTemplateProductTypeRepository;
parent::__construct(
$context,
$registry,
Expand All @@ -49,7 +38,6 @@ public function __construct(
$magentoStoreHelper,
$data
);
$this->amazonProductTypeCollectionFactory = $amazonProductTypeCollectionFactory;
}

protected function _prepareForm()
Expand Down Expand Up @@ -158,16 +146,15 @@ protected function _prepareForm()
]
);

$collection = $this->amazonProductTypeCollectionFactory->create();
$collection->appendFilterMarketplaceId($this->getListing()->getMarketplaceId());

$productTypesTemplates = $collection->getData();
$productTypesTemplates = $this->amazonTemplateProductTypeRepository->findByMarketplaceId(
$this->getListing()->getMarketplaceId(),
);

$options = [['label' => '', 'value' => '', 'attrs' => ['class' => 'empty']]];
foreach ($productTypesTemplates as $template) {
$options[] = [
'label' => $this->_escaper->escapeHtml($template['title']),
'value' => $template['id']
'label' => $this->_escaper->escapeHtml($template->getTitle()),
'value' => $template->getId(),
];
}

Expand Down
4 changes: 0 additions & 4 deletions Block/Adminhtml/Amazon/Listing/Product/Add/SearchAsin.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,6 @@ protected function _toHtml()
$autoMapAsinSearchProducts = __('Search %product_title% Product(s) on Amazon.');
$autoMapAsinProgressTitle = __('Automatic Assigning ASIN/ISBN to Item(s)');
$autoMapAsinErrorMessage = __('Server is currently unavailable. Please try again later.');
$newAsinNotAvailable = $this->__(
'The new ASIN/ISBN creation functionality is not available in %code% Marketplace yet.'
);
$notSynchronizedMarketplace = __(
'In order to use New ASIN/ISBN functionality, please re-synchronize Marketplace data.'
) . ' ' . __('Press "Save And Update" Button after redirect on Marketplace Page.');
Expand All @@ -176,7 +173,6 @@ protected function _toHtml()

'sending_data_message' => $sendingDataToAmazonMessage,

'new_asin_not_available' => $newAsinNotAvailable,
'not_synchronized_marketplace' => $notSynchronizedMarketplace,

'enter_productSearch_query' => $enterProductSearchQueryMessage,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,26 +24,17 @@ class Grid extends \Ess\M2ePro\Block\Adminhtml\Magento\Grid\AbstractGrid
private $checkNewAsinAccepted;
/** @var \Ess\M2ePro\Helper\Data */
private $dataHelper;
/** @var \Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory */
private $productTypeCollectionFactory;
private \Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository;

/**
* @param ProductTypeCollectionFactory $productTypeCollectionFactory
* @param \Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context
* @param \Magento\Backend\Helper\Data $backendHelper
* @param \Ess\M2ePro\Helper\Data $dataHelper
* @param array $data
*/
public function __construct(
\Ess\M2ePro\Model\ResourceModel\Amazon\Template\ProductType\CollectionFactory $productTypeCollectionFactory,
\Ess\M2ePro\Model\Amazon\Template\ProductType\Repository $amazonTemplateProductTypeRepository,
\Ess\M2ePro\Block\Adminhtml\Magento\Context\Template $context,
\Magento\Backend\Helper\Data $backendHelper,
\Ess\M2ePro\Helper\Data $dataHelper,
array $data = []
) {
$this->dataHelper = $dataHelper;
$this->productTypeCollectionFactory = $productTypeCollectionFactory;

$this->amazonTemplateProductTypeRepository = $amazonTemplateProductTypeRepository;
parent::__construct($context, $backendHelper, $data);
}

Expand Down Expand Up @@ -155,8 +146,9 @@ protected function _prepareCollection()
{
$this->setNoTemplatesText();

$collection = $this->productTypeCollectionFactory->create();
$collection->appendFilterMarketplaceId($this->getMarketplaceId());
$collection = $this->amazonTemplateProductTypeRepository->getCollectionForGrid();
$collection->getSelect()
->where('adpt.marketplace_id = ?', $this->getMarketplaceId());

$this->setCollection($collection);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -928,11 +928,7 @@ public function getChannelThemes()

$marketPlaceId = $this->getListingProduct()->getListing()->getMarketplaceId();

/** @var \Ess\M2ePro\Model\Amazon\Marketplace\Details $detailsModel */
$detailsModel = $this->modelFactory->getObject('Amazon_Marketplace_Details');
$detailsModel->setMarketplaceId($marketPlaceId);

$channelThemes = $detailsModel->getVariationThemes($productTypeTemplate->getNick());
$channelThemes = $productTypeTemplate->getDictionary()->getVariationThemes();

$themesUsageData = $this->variationHelper->getThemesUsageData();
$usedThemes = [];
Expand Down
10 changes: 0 additions & 10 deletions Block/Adminhtml/Amazon/Listing/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,6 @@ public function getGridHtml(): string
);
$this->jsUrl->add($this->getUrl('*/listing_mapping/remap'), 'listing_mapping/remap');

$this->jsUrl->add($this->getUrl('*/amazon_marketplace/index'), 'marketplaceSynchUrl');

$this->jsUrl->add(
$this->getUrl('*/listing/saveListingAdditionalData', [
'id' => $this->listing['id'],
Expand Down Expand Up @@ -262,9 +260,6 @@ public function getGridHtml(): string
$this->listing->getMarketplace()->getChildObject()->getData()
)
);
$isNewAsinAvailable = \Ess\M2ePro\Helper\Json::encode(
$this->listing->getMarketplace()->getChildObject()->isNewAsinAvailable()
);

$temp = $this->sessionDataHelper->getValue('products_ids_for_list', true);
$productsIdsForList = empty($temp) ? '' : $temp;
Expand Down Expand Up @@ -311,9 +306,6 @@ public function getGridHtml(): string
$autoMapAsinSearchProducts = $this->__('Search %product_title% Product(s) on Amazon.');
$autoMapAsinProgressTitle = $this->__('Automatic Assigning ASIN/ISBN to Item(s)');
$autoMapAsinErrorMessage = $this->__('Server is currently unavailable. Please try again later.');
$newAsinNotAvailable = $this->__(
'The new ASIN/ISBN creation functionality is not available in %code% Marketplace yet.'
);
$notSynchronizedMarketplace = $this->__(
'In order to use New ASIN/ISBN functionality, please re-synchronize Marketplace data.'
) . ' ' . $this->__('Press "Save And Update" Button after redirect on Marketplace Page.');
Expand Down Expand Up @@ -389,7 +381,6 @@ public function getGridHtml(): string
'automap_asin_progress_title' => $autoMapAsinProgressTitle,
'automap_error_message' => $autoMapAsinErrorMessage,

'new_asin_not_available' => $newAsinNotAvailable,
'not_synchronized_marketplace' => $notSynchronizedMarketplace,

'no_variations_left' => $noVariationsLeftText,
Expand Down Expand Up @@ -431,7 +422,6 @@ public function getGridHtml(): string
M2ePro.customData.ignoreListings = '{$ignoreListings}';
M2ePro.customData.marketplace = {$marketplace};
M2ePro.customData.isNewAsinAvailable = {$isNewAsinAvailable};
ListingGridObj = new AmazonListingViewGrid(
'{$gridId}',
Expand Down
Loading

0 comments on commit 9276f12

Please sign in to comment.