Skip to content

Commit

Permalink
1.51.1 (FINAL RELEASE)
Browse files Browse the repository at this point in the history
  • Loading branch information
m2epro committed Nov 28, 2023
1 parent 7144027 commit 77dc970
Show file tree
Hide file tree
Showing 14 changed files with 194 additions and 4 deletions.
87 changes: 87 additions & 0 deletions Block/Adminhtml/Ebay/Settings/Tabs/Motors.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ protected function _prepareForm()
$this->addFieldsetForITMarketplace($form, $preparedAttributes);
}

if (
$this->getMarketplace(EbayHelper::MARKETPLACE_AU)->isStatusEnabled()
&& $this->componentEbayConfiguration->isVisibleEpidsAu()
) {
$this->addFieldsetForAUMarketplace($form, $preparedAttributes);
}

if ($this->componentEbayMotors->isKTypeMarketplacesEnabled()) {
$this->addFieldsetForKTypesMarketplace($form, $preparedAttributes);
}
Expand Down Expand Up @@ -424,6 +431,86 @@ private function addFieldsetForITMarketplace(
);
}

/**
* @param \Magento\Framework\Data\Form $form
* @param array $preparedAttributes
*
* @return void
* @throws \Zend_Db_Statement_Exception
*/
private function addFieldsetForAUMarketplace(
\Magento\Framework\Data\Form $form,
array $preparedAttributes
): void {
$fieldset = $form->addFieldset(
'motors_epids_au',
[
'legend' => $this->__('Parts Compatibility [ePIDs AU]'),
'collapsable' => false,
'tooltip' => $this->__(
'In this Section, you can provide a Magento Attribute where ePID values for AU marketplace
will be saved.
<br/>
Also you can Add/Update ePID Database manually by clicking <strong>Manage Option</strong>
in Database line.
<br/>
You have an ability to choose either ePID or kType values should be used on eBay AU.
Specify the appropriate <strong>Parts Compatibility Mode</strong> for your Listing in M2E Pro
Listings grid.'
),
]
);

$fieldset->addField(
'au_epids_attribute',
self::SELECT,
[
'name' => 'au_epids_attribute',
'label' => $this->__('Attribute'),
'values' => $preparedAttributes,
'value' => $this->componentEbayConfiguration->getAUEpidsAttribute(),
'class' => 'M2ePro-custom-attribute-can-be-created',
'tooltip' => $this->__(
'Choose the Attribute that contains the Product Reference IDs (ePIDs) of compatible vehicles
for the parts.
In the M2E Pro Listing, use the <strong>Add Compatible Vehicles</strong> tool to find
necessary compatible Items.
<br/>
Only Textarea Attributes are shown.'
),
]
)
->addCustomAttribute('allowed_attribute_types', 'textarea')
->addCustomAttribute('apply_to_all_attribute_sets', 'false');

$motorsType = \Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_AU;
$popupTitle = $this->__('Manage Custom Compatibility [ePIDs AU]');
[$count, $customCount] = $this->componentEbayMotors->getDictionaryRecordCount(
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_AU
);

$fieldset->addField(
'motors_epids_au_database',
self::CUSTOM_CONTAINER,
[
'label' => $this->__('Database'),
'text' => <<<HTML
<span style="padding-right: 2px;">{$this->__('From eBay')}: </span>
<span style="font-weight: bold; display: inline-block; width: 40px;">{$count}</span>
<span style="padding-right: 2px; padding-left: 10px;">{$this->__('Custom Added')}: </span>
<span id="epids_au_custom_count" style="font-weight: bold; padding-right: 2px;">{$customCount}</span>
<span>
(<a href="javascript:void(0);"
onclick="EbaySettingsMotorsObj.manageMotorsRecords('{$motorsType}','{$popupTitle}');">{$this->__('manage')}</a>)
</span>
HTML
,
]
);
}

/**
* @param \Magento\Framework\Data\Form $form
* @param array $preparedAttributes
Expand Down
31 changes: 31 additions & 0 deletions Helper/Component/Ebay/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ public function getDeEpidsAttribute()
);
}

/**
* @return mixed|null
*/
public function getAuEpidsAttribute()
{
return $this->config->getGroupValue(
self::CONFIG_GROUP,
'au_epids_attribute'
);
}

/**
* @return mixed|null
*/
Expand Down Expand Up @@ -441,6 +452,10 @@ public function setConfigValues(array $values): void
$motorsAttributes[] = $values['de_epids_attribute'];
}

if (isset($values['au_epids_attribute'])) {
$motorsAttributes[] = $values['au_epids_attribute'];
}

if (isset($values['it_epids_attribute'])) {
$motorsAttributes[] = $values['it_epids_attribute'];
}
Expand Down Expand Up @@ -473,6 +488,14 @@ public function setConfigValues(array $values): void
);
}

if (isset($values['au_epids_attribute'])) {
$this->config->setGroupValue(
self::CONFIG_GROUP,
'au_epids_attribute',
$values['au_epids_attribute']
);
}

if (isset($values['it_epids_attribute'])) {
$this->config->setGroupValue(
self::CONFIG_GROUP,
Expand Down Expand Up @@ -512,4 +535,12 @@ public function setProductIdsConfigValues(array $values): void
}
}
}

public function isVisibleEpidsAu(): bool
{
return (bool)$this->config->getGroupValue(
self::CONFIG_GROUP,
'au_epids_visible'
);
}
}
19 changes: 18 additions & 1 deletion Helper/Component/Ebay/Motors.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,13 @@ class Motors
public const TYPE_KTYPE = 2;
public const TYPE_EPID_UK = 3;
public const TYPE_EPID_DE = 4;
public const TYPE_EPID_AU = 5;
public const TYPE_EPID_IT = 6;

public const EPID_SCOPE_MOTORS = 1;
public const EPID_SCOPE_UK = 2;
public const EPID_SCOPE_DE = 3;
public const EPID_SCOPE_AU = 4;
public const EPID_SCOPE_IT = 5;

public const PRODUCT_TYPE_VEHICLE = 0;
Expand Down Expand Up @@ -84,6 +86,9 @@ public function getAttribute($type)
case self::TYPE_EPID_DE:
return $this->componentEbayConfiguration->getDeEpidsAttribute();

case self::TYPE_EPID_AU:
return $this->componentEbayConfiguration->getAuEpidsAttribute();

case self::TYPE_EPID_IT:
return $this->componentEbayConfiguration->getItEpidsAttribute();
}
Expand Down Expand Up @@ -239,7 +244,12 @@ public function buildGroupAttributeValue(array $groups)

public function isTypeBasedOnEpids($type)
{
if (in_array($type, [self::TYPE_EPID_MOTOR, self::TYPE_EPID_UK, self::TYPE_EPID_DE, self::TYPE_EPID_IT])) {
if (
in_array(
$type,
[self::TYPE_EPID_MOTOR, self::TYPE_EPID_UK, self::TYPE_EPID_DE, self::TYPE_EPID_AU, self::TYPE_EPID_IT]
)
) {
return true;
}

Expand Down Expand Up @@ -293,6 +303,9 @@ public function getEpidsScopeByType($type)
case self::TYPE_EPID_DE:
return self::EPID_SCOPE_DE;

case self::TYPE_EPID_AU:
return self::EPID_SCOPE_AU;

case self::TYPE_EPID_IT:
return self::EPID_SCOPE_IT;

Expand All @@ -313,6 +326,9 @@ public function getEpidsTypeByMarketplace($marketplaceId)
case \Ess\M2ePro\Helper\Component\Ebay::MARKETPLACE_DE:
return self::TYPE_EPID_DE;

case \Ess\M2ePro\Helper\Component\Ebay::MARKETPLACE_AU:
return self::TYPE_EPID_AU;

case \Ess\M2ePro\Helper\Component\Ebay::MARKETPLACE_IT:
return self::TYPE_EPID_IT;

Expand Down Expand Up @@ -474,6 +490,7 @@ public function getPartsCompatibilityAttributesIds()
'motors_epids_attribute',
'uk_epids_attribute',
'de_epids_attribute',
'au_epids_attribute',
'it_epids_attribute',
'ktypes_attribute',
];
Expand Down
1 change: 1 addition & 0 deletions Model/Ebay/Motor/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public function isTypeEpid()
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_MOTOR,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_UK,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_DE,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_AU,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_IT,
]);
}
Expand Down
1 change: 1 addition & 0 deletions Model/Ebay/Motor/Group.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public function isTypeEpid()
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_MOTOR,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_UK,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_DE,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_AU,
\Ess\M2ePro\Helper\Component\Ebay\Motors::TYPE_EPID_IT,
]);
}
Expand Down
4 changes: 3 additions & 1 deletion Model/Setup/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6807,6 +6807,8 @@ private function installEbayData()
$moduleConfig->insert('/ebay/configuration/', 'motors_epids_attribute');
$moduleConfig->insert('/ebay/configuration/', 'uk_epids_attribute');
$moduleConfig->insert('/ebay/configuration/', 'de_epids_attribute');
$moduleConfig->insert('/ebay/configuration/', 'au_epids_attribute');
$moduleConfig->insert('/ebay/configuration/', 'au_epids_visible', 0);
$moduleConfig->insert('/ebay/configuration/', 'it_epids_attribute');
$moduleConfig->insert('/ebay/configuration/', 'ktypes_attribute');
$moduleConfig->insert('/ebay/configuration/', 'upload_images_mode', 2);
Expand Down Expand Up @@ -7210,7 +7212,7 @@ private function installEbayData()
'is_global_shipping_program' => 0,
'is_charity' => 1,
'is_return_description' => 0,
'is_epid' => 0,
'is_epid' => 1,
'is_ktype' => 1,
],
[
Expand Down
1 change: 1 addition & 0 deletions Model/Setup/Upgrader.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ class Upgrader
'1.50.1' => ['1.50.2'],
'1.50.2' => ['1.50.3'],
'1.50.3' => ['1.51.0'],
'1.51.0' => ['1.51.1'],
];

//########################################
Expand Down
1 change: 1 addition & 0 deletions Setup/MigrationFromMagento1/Modifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ private function executeSomeFeatures(): void
\Ess\M2ePro\Setup\Update\y23_m10\ReAddIsSoldByAmazonColumnToAmazonOrder::class,
\Ess\M2ePro\Setup\Update\y23_m11\AddWalmartIsWFS::class,
\Ess\M2ePro\Setup\Update\y23_m11\AddWalmartOrdersWfsLastSynchronization::class,
\Ess\M2ePro\Setup\Update\y23_m11\RestoreEpidsForAustralia::class,
];

foreach ($featureClasses as $featureClass) {
Expand Down
1 change: 1 addition & 0 deletions Setup/Update/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ public function getFeaturesList(): array
'y23_m11' => [
'AddWalmartIsWFS',
'AddWalmartOrdersWfsLastSynchronization',
'RestoreEpidsForAustralia',
]
];
}
Expand Down
30 changes: 30 additions & 0 deletions Setup/Update/y23_m11/RestoreEpidsForAustralia.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

namespace Ess\M2ePro\Setup\Update\y23_m11;

use Ess\M2ePro\Model\Setup\Upgrade\Entity\AbstractFeature;

class RestoreEpidsForAustralia extends AbstractFeature
{
public function execute()
{
$this->addEpidsInConfiguration();
$this->enableEpidsInMarketplace();
}

private function addEpidsInConfiguration(): void
{
$this->getConfigModifier('module')
->insert('/ebay/configuration/', 'au_epids_attribute', null);

$this->getConfigModifier('module')
->insert('/ebay/configuration/', 'au_epids_visible', 0);
}

private function enableEpidsInMarketplace(): void
{
$ebayMarketplaceTable = $this->getFullTableName('ebay_marketplace');
$sql = "UPDATE `{$ebayMarketplaceTable}` SET `is_epid` = 1 WHERE `marketplace_id` = 4;";
$this->installer->run($sql);
}
}
16 changes: 16 additions & 0 deletions Setup/Upgrade/v1_51_0__v1_51_1/Config.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace Ess\M2ePro\Setup\Upgrade\v1_51_0__v1_51_1;

use Ess\M2ePro\Model\Setup\Upgrade\Entity\AbstractConfig;

class Config extends AbstractConfig
{
public function getFeaturesList(): array
{
return [
'@y23_m11/RestoreEpidsForAustralia',
];
}
}

2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "m2e/ebay-amazon-magento2",
"description": "M2E Pro is a Magento trusted (TM), award-winning extension, which allows merchants of all sizes to fully integrate Magento based system(s) into eBay/Amazon/Walmart platforms.",
"type": "magento2-module",
"version": "1.51.0",
"version": "1.51.1",
"license": "proprietary",
"keywords": ["ebay", "amazon", "walmart", "magento"],
"homepage": "https://www.m2epro.com/",
Expand Down
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">

<module name="Ess_M2ePro" setup_version="1.51.0">
<module name="Ess_M2ePro" setup_version="1.51.1">
<sequence>
<module name="Magento_Backend" />
<module name="Magento_Catalog" />
Expand Down
2 changes: 2 additions & 0 deletions view/adminhtml/web/js/Ebay/Settings/Motors.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ define([
spanStatEpids.innerHTML = $('epids_uk_custom_count').innerHTML;
} else if (motorsType == M2ePro.php.constant('Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_DE')) {
spanStatEpids.innerHTML = $('epids_de_custom_count').innerHTML;
} else if (motorsType == M2ePro.php.constant('Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_AU')) {
spanStatEpids.innerHTML = $('epids_au_custom_count').innerHTML;
} else if (motorsType == M2ePro.php.constant('Ess_M2ePro_Helper_Component_Ebay_Motors::TYPE_EPID_IT')) {
spanStatEpids.innerHTML = $('epids_it_custom_count').innerHTML;
} else {
Expand Down

0 comments on commit 77dc970

Please sign in to comment.