m2epro_ebay_magento - Version 6.4.0

Version Notes

The M2E Pro extension fully integrates Magento into eBay, Amazon and Rakuten platforms. This allows quick and simple creation as well as management of product listings (inc. automated synchronization of stock levels, pricing, and product details), import of eBay and Amazon order, automated feedback posting for buyers and many other tasks which significantly reduce time required for listing maintenance.

The extension interacts with all 23 major eBay and 7 Amazon marketplaces. It supports multiple eBay/Amazon accounts and multiple Magento stores.

Download this release

Release Info

Developer Magento Core Team
Extension m2epro_ebay_magento
Version 6.4.0
Comparing to
See all releases


Code changes from version 6.3.9 to 6.4.0

Files changed (49) hide show
  1. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View/Sellercentral/Grid.php +6 -0
  2. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Order/MerchantFulfillment/Message.php +1 -1
  3. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Template/Description/Edit/Tabs/Definition.php +3 -1
  4. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Buy/Listing/ProductSearch/Grid.php +2 -0
  5. app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/View/Ebay/Grid.php +3 -1
  6. app/code/community/Ess/M2ePro/CHANGELOG +12 -0
  7. app/code/community/Ess/M2ePro/Helper/Module.php +1 -1
  8. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Action/Type/List/Validator/ListType.php +2 -2
  9. app/code/community/Ess/M2ePro/Model/Amazon/Order/Builder.php +2 -2
  10. app/code/community/Ess/M2ePro/Model/Amazon/Repricing.php +200 -130
  11. app/code/community/Ess/M2ePro/Model/Buy/Synchronization/Defaults/UpdateListingsProducts/Responser.php +14 -2
  12. app/code/community/Ess/M2ePro/Model/Ebay/Template/Description.php +1 -1
  13. app/code/community/Ess/M2ePro/Model/Observer/Dispatcher.php +22 -4
  14. app/code/community/Ess/M2ePro/Model/ProductChange.php +0 -68
  15. app/code/community/Ess/M2ePro/Model/Synchronization/Dispatcher.php +45 -20
  16. app/code/community/Ess/M2ePro/Model/Upgrade/MySqlSetup.php +33 -19
  17. app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Account/RepricingController.php +4 -4
  18. app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php +106 -32
  19. app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Order/MerchantFulfillmentController.php +3 -6
  20. app/code/community/Ess/M2ePro/controllers/Adminhtml/Development/Tools/M2ePro/GeneralController.php +2 -2
  21. app/code/community/Ess/M2ePro/etc/config.xml +1 -1
  22. app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.3.9-6.4.0.php +31 -0
  23. app/design/adminhtml/default/default/template/M2ePro/common/amazon/account/tabs/listing_other.phtml +3 -3
  24. app/design/adminhtml/default/default/template/M2ePro/common/amazon/account/tabs/repricing.phtml +22 -25
  25. app/design/adminhtml/default/default/template/M2ePro/common/amazon/listing/variation/product/manage/tabs/settings.phtml +1 -1
  26. app/design/adminhtml/default/default/template/M2ePro/common/amazon/order/merchant_fulfillment/configuration.phtml +3 -3
  27. app/design/adminhtml/default/default/template/M2ePro/common/amazon/order/merchant_fulfillment/magento/shipment.phtml +9 -3
  28. app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/description/tabs/definition.phtml +2 -2
  29. app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/description/tabs/general.phtml +1 -1
  30. app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/selling_format/form.phtml +1 -1
  31. app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/shippingOverride/form.phtml +1 -1
  32. app/design/adminhtml/default/default/template/M2ePro/common/buy/account/tabs/listing_other.phtml +2 -2
  33. app/design/adminhtml/default/default/template/M2ePro/common/buy/template/selling_format/form.phtml +1 -1
  34. app/design/adminhtml/default/default/template/M2ePro/ebay/account/tabs/listing_other.phtml +2 -2
  35. app/design/adminhtml/default/default/template/M2ePro/ebay/configuration/general/form.phtml +2 -2
  36. app/design/adminhtml/default/default/template/M2ePro/ebay/listing/other/synchronization/tabs/general.phtml +6 -6
  37. app/design/adminhtml/default/default/template/M2ePro/ebay/template/description/form/data.phtml +15 -15
  38. app/design/adminhtml/default/default/template/M2ePro/ebay/template/sellingFormat/form/data.phtml +2 -2
  39. app/design/adminhtml/default/default/template/M2ePro/ebay/template/shipping/form/data.phtml +10 -10
  40. app/design/adminhtml/default/default/template/M2ePro/wizard/installationCommon/installation/license.phtml +2 -2
  41. app/design/adminhtml/default/default/template/M2ePro/wizard/installationEbay/installation/license.phtml +2 -2
  42. app/design/adminhtml/default/default/template/M2ePro/wizard/installationEbay/installation/wizard_tutorial.phtml +2 -2
  43. js/M2ePro/Common/Amazon/AccountHandler.js +6 -22
  44. js/M2ePro/Common/Amazon/Listing/GridHandler.js +4 -0
  45. js/M2ePro/Common/Amazon/Listing/RepricingHandler.js +6 -1
  46. js/M2ePro/Common/Amazon/Order/MerchantFulfillmentHandler.js +1 -1
  47. js/M2ePro/Wizard/InstallationCommon.js +1 -1
  48. js/M2ePro/Wizard/InstallationEbay.js +1 -1
  49. package.xml +4 -4
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View/Sellercentral/Grid.php CHANGED
@@ -330,6 +330,12 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Sellercentral_Grid
330
'url' => '',
331
'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
332
), 'edit_repricing');
333
}
334
// ---------------------------------------
335
330
'url' => '',
331
'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
332
), 'edit_repricing');
333
+
334
+ $this->getMassactionBlock()->addItem('showDetails', array(
335
+ 'label' => Mage::helper('M2ePro')->__('Show Details'),
336
+ 'url' => '',
337
+ 'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
338
+ ), 'edit_repricing');
339
}
340
// ---------------------------------------
341
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Order/MerchantFulfillment/Message.php CHANGED
@@ -17,7 +17,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Order_MerchantFulfillment_Message
17
18
// Initialization block
19
// ---------------------------------------
20
- $this->setId('amazonOrderMerchantFulfillmentBreadcrumb');
21
// ---------------------------------------
22
$this->setTemplate('M2ePro/common/amazon/order/merchant_fulfillment/message.phtml');
23
}
17
18
// Initialization block
19
// ---------------------------------------
20
+ $this->setId('amazonOrderMerchantFulfillmentMessage');
21
// ---------------------------------------
22
$this->setTemplate('M2ePro/common/amazon/order/merchant_fulfillment/message.phtml');
23
}
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Template/Description/Edit/Tabs/Definition.php CHANGED
@@ -102,7 +102,9 @@ JS;
102
return '';
103
}
104
105
- $attributeLabel = Mage::helper('M2ePro/Magento_Attribute')->getAttributeLabel($attributeCode);
106
$html = "<option %s selected=\"selected\">{$attributeLabel}</option>";
107
108
return is_null($value) ? sprintf($html, "value='{$attributeCode}'")
102
return '';
103
}
104
105
+ $attributeLabel = Mage::helper('M2ePro')
106
+ ->escapeHtml(Mage::helper('M2ePro/Magento_Attribute')->getAttributeLabel($attributeCode));
107
+
108
$html = "<option %s selected=\"selected\">{$attributeLabel}</option>";
109
110
return is_null($value) ? sprintf($html, "value='{$attributeCode}'")
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Buy/Listing/ProductSearch/Grid.php CHANGED
@@ -178,6 +178,8 @@ class Ess_M2ePro_Block_Adminhtml_Common_Buy_Listing_ProductSearch_Grid extends M
178
{
179
if (empty($value)) {
180
$value = Mage::helper('M2ePro')->__('N/A');
181
}
182
183
return '<div id="price_'.$row->getId().'" style="margin-right: 5px;">'.$value.'</div>';
178
{
179
if (empty($value)) {
180
$value = Mage::helper('M2ePro')->__('N/A');
181
+ } else {
182
+ $value = Mage::app()->getLocale()->currency('USD')->toCurrency($value);
183
}
184
185
return '<div id="price_'.$row->getId().'" style="margin-right: 5px;">'.$value.'</div>';
app/code/community/Ess/M2ePro/Block/Adminhtml/Ebay/Listing/View/Ebay/Grid.php CHANGED
@@ -1307,6 +1307,8 @@ HTML;
1307
return '';
1308
}
1309
1310
return <<<HTML
1311
<style>
1312
div.tp-research { display: inline-block; }
@@ -1330,7 +1332,7 @@ HTML;
1330
};
1331
1332
var script = new Element('script', {type: 'text/javascript',
1333
- src: 'https://widget.terapeak.com/tools/terapeak-loader.js'});
1334
1335
$('head').first().appendChild(script);
1336
1307
return '';
1308
}
1309
1310
+ $protocolMode = Mage::getStoreConfig('web/secure/use_in_adminhtml') == '1' ? 'https' : 'http';
1311
+
1312
return <<<HTML
1313
<style>
1314
div.tp-research { display: inline-block; }
1332
};
1333
1334
var script = new Element('script', {type: 'text/javascript',
1335
+ src: '$protocolMode://widget.terapeak.com/tools/terapeak-loader.js'});
1336
1337
$('head').first().appendChild(script);
1338
app/code/community/Ess/M2ePro/CHANGELOG CHANGED
@@ -1,3 +1,15 @@
1
* 6.3.9 (r9929) (15/11/2015)
2
3
* Added: [Amazon] Ability to use Amazon's Shipping Services feature (Buy Shipping API)
1
+ * 6.4.0 (r10097) (08/12/2015)
2
+
3
+ * Improvement: [Amazon] Many improvements of Amazon's Shipping Services feature (Buy Shipping API)
4
+ * Fix: Blank page if Magento Configs cache was disabled and Compilation was enabled
5
+ * Fix: Major boost of some Extension observers (core blocks render before and after events)
6
+ * Fix: Some data Changes could be lost if more than 500 Magento Products updated at one time
7
+ * Fix: Sales Channels could not be enabled in System -> Configuration if all of them were switched off
8
+ * Fix: Magento Attributes Labels were translated to the selected Locale language (wrong labels)
9
+ * Fix: [eBay] The warnings in Chrome Browser because of unsecure connections to the Terapeak service
10
+ * Fix: [Amazon] Error: "Call to a member function setData() on a non-object" during synchronization in some cases
11
+ * Fix: [Rakuten.com] Unexpected Product Status changing in some cases (Rakuten.com API issue)
12
+
13
* 6.3.9 (r9929) (15/11/2015)
14
15
* Added: [Amazon] Ability to use Amazon's Shipping Services feature (Buy Shipping API)
app/code/community/Ess/M2ePro/Helper/Module.php CHANGED
@@ -72,7 +72,7 @@ class Ess_M2ePro_Helper_Module extends Mage_Core_Helper_Abstract
72
73
public function getRevision()
74
{
75
- $revision = '9929';
76
77
if ($revision == str_replace('|','#','|REVISION|')) {
78
$revision = (int)exec('svnversion');
72
73
public function getRevision()
74
{
75
+ $revision = '10097';
76
77
if ($revision == str_replace('|','#','|REVISION|')) {
78
$revision = (int)exec('svnversion');
app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Action/Type/List/Validator/ListType.php CHANGED
@@ -333,11 +333,11 @@ class Ess_M2ePro_Model_Amazon_Listing_Product_Action_Type_List_Validator_ListTyp
333
}
334
335
// M2ePro_TRANSLATIONS
336
- // %worldwide_id_type% %worldwide_id% provided in Listing Search Settings is not found on Amazon. Please set the correct value and try again.
337
$this->addMessage(
338
Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription(
339
'%worldwide_id_type% %worldwide_id% provided in Search Settings
340
- is not found on Amazon. Please set the correct value and try again.',
341
array('!worldwide_id_type' => $worldwideIdType, '!worldwide_id' => $worldwideId)
342
)
343
);
333
}
334
335
// M2ePro_TRANSLATIONS
336
+ // %worldwide_id_type% %worldwide_id% provided in Listing Search Settings is not found on Amazon. Please set Description Policy to create New ASIN/ISBN.
337
$this->addMessage(
338
Mage::getSingleton('M2ePro/Log_Abstract')->encodeDescription(
339
'%worldwide_id_type% %worldwide_id% provided in Search Settings
340
+ is not found on Amazon. Please set Description Policy to create New ASIN/ISBN.',
341
array('!worldwide_id_type' => $worldwideIdType, '!worldwide_id' => $worldwideId)
342
)
343
);
app/code/community/Ess/M2ePro/Model/Amazon/Order/Builder.php CHANGED
@@ -291,7 +291,7 @@ class Ess_M2ePro_Model_Amazon_Order_Builder extends Mage_Core_Model_Abstract
291
292
private function processMagentoOrderUpdates()
293
{
294
- if (!$this->hasUpdates()) {
295
return;
296
}
297
@@ -315,7 +315,7 @@ class Ess_M2ePro_Model_Amazon_Order_Builder extends Mage_Core_Model_Abstract
315
);
316
}
317
318
- if (!is_null($this->order->getMagentoOrder()) && $this->hasUpdate(self::UPDATE_EMAIL)) {
319
$magentoOrderUpdater->updateCustomerEmail($this->order->getChildObject()->getBuyerEmail());
320
}
321
291
292
private function processMagentoOrderUpdates()
293
{
294
+ if (!$this->hasUpdates() || is_null($this->order->getMagentoOrder())) {
295
return;
296
}
297
315
);
316
}
317
318
+ if ($this->hasUpdate(self::UPDATE_EMAIL)) {
319
$magentoOrderUpdater->updateCustomerEmail($this->order->getChildObject()->getBuyerEmail());
320
}
321
app/code/community/Ess/M2ePro/Model/Amazon/Repricing.php CHANGED
@@ -8,13 +8,16 @@
8
9
class Ess_M2ePro_Model_Amazon_Repricing
10
{
11
- const COMMAND_ACCOUNT_LINK = 1;
12
- const COMMAND_ACCOUNT_UNLINK = 2;
13
- const COMMAND_SYNCHRONIZE = 3;
14
- const COMMAND_GOTO_SERVICE = 4;
15
- const COMMAND_OFFERS_ADD = 5;
16
- const COMMAND_OFFERS_EDIT = 6;
17
- const COMMAND_OFFERS_REMOVE = 7;
18
19
const TIMEOUT = 300;
20
@@ -79,10 +82,12 @@ class Ess_M2ePro_Model_Amazon_Repricing
79
// ---------------------------------------
80
81
$requestToken = $this->sendData(self::COMMAND_ACCOUNT_LINK, array(
82
- 'back_url' => array(
83
- 'url' => $backUrl,
84
- 'params' => array(
85
- 'id' => $this->account->getId()
86
)
87
),
88
'data' => array(
@@ -95,7 +100,7 @@ class Ess_M2ePro_Model_Amazon_Repricing
95
));
96
97
return $this->getBaseUrl() .
98
- $this->getCommandName(self::COMMAND_ACCOUNT_LINK) .
99
'?' . http_build_query(array('request_token' => $requestToken));
100
}
101
@@ -103,25 +108,30 @@ class Ess_M2ePro_Model_Amazon_Repricing
103
{
104
$backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_account_repricing/unlink');
105
106
- $collection = $this->prepareLisgingProductCollection();
107
108
$collection->getSelect()->where("`l`.`account_id` = ?", $this->account->getId());
109
110
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
111
$collection->getSelect()->columns(array(
112
- 'sku' => 'second_table.sku'
113
));
114
115
$requestToken = $this->sendData(self::COMMAND_ACCOUNT_UNLINK, array(
116
'request' => array(
117
'auth' => array(
118
'account_token' => $this->getAmazonAccount()->getRepricingToken()
119
- )
120
- ),
121
- 'back_url' => array(
122
- 'url' => $backUrl,
123
- 'params' => array(
124
- 'id' => $this->account->getId()
125
)
126
),
127
'data' => array(
@@ -130,7 +140,7 @@ class Ess_M2ePro_Model_Amazon_Repricing
130
));
131
132
return $this->getBaseUrl() .
133
- $this->getCommandName(self::COMMAND_ACCOUNT_UNLINK) .
134
'?' . http_build_query(array('request_token' => $requestToken));
135
}
136
@@ -138,7 +148,7 @@ class Ess_M2ePro_Model_Amazon_Repricing
138
139
public function getManagementUrl()
140
{
141
- return $this->getBaseUrl() . $this->getCommandName(self::COMMAND_GOTO_SERVICE) . '?' . http_build_query(array(
142
'account_token' => $this->getAmazonAccount()->getRepricingToken()
143
));
144
}
@@ -149,7 +159,7 @@ class Ess_M2ePro_Model_Amazon_Repricing
149
{
150
$backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/addProducts');
151
152
- $collection = $this->prepareLisgingProductCollection();
153
154
$collection->getSelect()->where('main_table.id IN (?)', $productsIds);
155
$collection->getSelect()->where('second_table.is_repricing = ?',
@@ -161,7 +171,7 @@ class Ess_M2ePro_Model_Amazon_Repricing
161
'name' => 'cpev.value',
162
'asin' => 'second_table.general_id',
163
'sku' => 'second_table.sku',
164
- 'price' => 'second_table.online_price',
165
)
166
);
167
@@ -175,13 +185,13 @@ class Ess_M2ePro_Model_Amazon_Repricing
175
'request' => array(
176
'auth' => array(
177
'account_token' => $this->getAmazonAccount()->getRepricingToken()
178
- )
179
- ),
180
- 'back_url' => array(
181
- 'url' => $backUrl,
182
- 'params' => array(
183
- 'id' => $listingId,
184
- 'account_id' => $this->account->getId()
185
)
186
),
187
'data' => array(
@@ -190,15 +200,15 @@ class Ess_M2ePro_Model_Amazon_Repricing
190
));
191
192
return $this->getBaseUrl() .
193
- $this->getCommandName(self::COMMAND_OFFERS_ADD).
194
'?' . http_build_query(array('request_token' => $requestToken));
195
}
196
197
- public function getEditProductsUrl($listingId, $productsIds)
198
{
199
- $backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/editProducts');
200
201
- $collection = $this->prepareLisgingProductCollection();
202
203
$collection->getSelect()->where('main_table.id IN (?)', $productsIds);
204
$collection->getSelect()->where('second_table.is_repricing = ?',
@@ -207,7 +217,10 @@ class Ess_M2ePro_Model_Amazon_Repricing
207
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
208
$collection->getSelect()->columns(
209
array(
210
'sku' => 'second_table.sku',
211
)
212
);
213
@@ -217,16 +230,17 @@ class Ess_M2ePro_Model_Amazon_Repricing
217
return false;
218
}
219
220
- $requestToken = $this->sendData(self::COMMAND_OFFERS_EDIT, array(
221
'request' => array(
222
'auth' => array(
223
'account_token' => $this->getAmazonAccount()->getRepricingToken()
224
- )
225
- ),
226
- 'back_url' => array(
227
- 'url' => $backUrl,
228
- 'params' => array(
229
- 'id' => $listingId
230
)
231
),
232
'data' => array(
@@ -235,15 +249,15 @@ class Ess_M2ePro_Model_Amazon_Repricing
235
));
236
237
return $this->getBaseUrl() .
238
- $this->getCommandName(self::COMMAND_OFFERS_EDIT).
239
'?' . http_build_query(array('request_token' => $requestToken));
240
}
241
242
- public function getRemoveProductsUrl($listingId, $productsIds)
243
{
244
- $backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/removeProducts');
245
246
- $collection = $this->prepareLisgingProductCollection();
247
248
$collection->getSelect()->where('main_table.id IN (?)', $productsIds);
249
$collection->getSelect()->where('second_table.is_repricing = ?',
@@ -252,7 +266,10 @@ class Ess_M2ePro_Model_Amazon_Repricing
252
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
253
$collection->getSelect()->columns(
254
array(
255
'sku' => 'second_table.sku',
256
)
257
);
258
@@ -262,17 +279,17 @@ class Ess_M2ePro_Model_Amazon_Repricing
262
return false;
263
}
264
265
- $requestToken = $this->sendData(self::COMMAND_OFFERS_REMOVE, array(
266
'request' => array(
267
'auth' => array(
268
'account_token' => $this->getAmazonAccount()->getRepricingToken()
269
- )
270
- ),
271
- 'back_url' => array(
272
- 'url' => $backUrl,
273
- 'params' => array(
274
- 'id' => $listingId,
275
- 'account_id' => $this->account->getId()
276
)
277
),
278
'data' => array(
@@ -281,68 +298,61 @@ class Ess_M2ePro_Model_Amazon_Repricing
281
));
282
283
return $this->getBaseUrl() .
284
- $this->getCommandName(self::COMMAND_OFFERS_REMOVE).
285
'?' . http_build_query(array('request_token' => $requestToken));
286
}
287
288
- //########################################
289
-
290
- public function unlink()
291
{
292
- $connWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
293
-
294
- $tableAmazonListingProduct = Mage::getSingleton('core/resource')->getTableName('m2epro_amazon_listing_product');
295
- $tableAmazonListingOther = Mage::getSingleton('core/resource')->getTableName('m2epro_amazon_listing_other');
296
297
- /** @var Ess_M2ePro_Model_Mysql4_Amazon_Listing_Product_Collection $collection */
298
- $collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
299
300
- $collection->getSelect()
301
- ->join(array('l' => Mage::getResourceModel('M2ePro/Listing')->getMainTable()),
302
- '(`l`.`id` = `main_table`.`listing_id`)', array());
303
-
304
- $collection->getSelect()->where(
305
- "`second_table`.`is_repricing` = ?",
306
- Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
307
- );
308
- $collection->getSelect()->where("`l`.`account_id` = ?", $this->account->getId());
309
310
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
311
- $collection->getSelect()->columns(array(
312
- 'id' => 'main_table.id'
313
- ));
314
315
- $productsIds = $collection->getColumnValues('id');
316
317
- if (!empty($productsIds)) {
318
- $connWrite->update($tableAmazonListingProduct, array(
319
- 'is_repricing' => Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_NO
320
- ), '`listing_product_id` IN ('.implode(',', $collection->getColumnValues('id')).')'
321
- );
322
}
323
324
- /** @var Ess_M2ePro_Model_Mysql4_Amazon_Listing_Other_Collection $collection */
325
- $collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Other');
326
-
327
- $collection->getSelect()->where("`main_table`.`account_id` = ?", $this->account->getId());
328
- $collection->getSelect()->where(
329
- "`second_table`.`is_repricing` = ?",
330
- Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
331
- );
332
-
333
- $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
334
- $collection->getSelect()->columns(array(
335
- 'id' => 'main_table.id'
336
));
337
338
- if (!empty($productsIds)) {
339
- $connWrite->update($tableAmazonListingOther, array(
340
- 'is_repricing' => Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_NO
341
- ), '`listing_other_id` IN ('.implode(',', $collection->getColumnValues('id')).')'
342
- );
343
- }
344
}
345
346
public function synchronize()
347
{
348
$result = $this->sendRequest(
@@ -364,10 +374,14 @@ class Ess_M2ePro_Model_Amazon_Repricing
364
$response = json_decode($result['response'], true);
365
366
if ($response['status'] == '0') {
367
- return Mage::helper('M2ePro')->__($response['messages']);
368
}
369
370
if (empty($response['offers'])) {
371
return array(
372
array(
373
'type' => 'notice',
@@ -383,6 +397,8 @@ class Ess_M2ePro_Model_Amazon_Repricing
383
$skus[] = $offer['sku'];
384
}
385
386
$this->setProductRepricingStatusBySku(
387
$skus,
388
Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
@@ -401,45 +417,37 @@ class Ess_M2ePro_Model_Amazon_Repricing
401
return Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/repricing/', 'base_url');
402
}
403
404
- private function getCommandName($command)
405
- {
406
- switch($command) {
407
- case self::COMMAND_ACCOUNT_LINK:
408
- return 'account/link';
409
-
410
- case self::COMMAND_ACCOUNT_UNLINK:
411
- return 'account/unlink';
412
-
413
- case self::COMMAND_SYNCHRONIZE:
414
- return 'synchronize';
415
-
416
- case self::COMMAND_GOTO_SERVICE:
417
- return 'goto_service';
418
-
419
- case self::COMMAND_OFFERS_ADD:
420
- return 'offers/add';
421
-
422
- case self::COMMAND_OFFERS_EDIT:
423
- return 'offers/edit';
424
425
- case self::COMMAND_OFFERS_REMOVE:
426
- return 'offers/remove';
427
- }
428
429
- return false;
430
}
431
432
// ---------------------------------------
433
434
private function sendData($command, $data)
435
{
436
$result = $this->sendRequest(
437
- $this->getBaseUrl() . $this->getCommandName($command),
438
$data
439
);
440
441
- if (!empty($result['response']['request_token'])) {
442
- return $result['response']['request_token'];
443
}
444
445
return false;
@@ -494,9 +502,11 @@ class Ess_M2ePro_Model_Amazon_Repricing
494
495
public function getRepricingListingProductsData()
496
{
497
- $collection = $this->prepareLisgingProductCollection();
498
499
$collection->getSelect()->where("`l`.`account_id` = ?", $this->account->getId());
500
501
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
502
$collection->getSelect()->columns(array(
@@ -506,6 +516,8 @@ class Ess_M2ePro_Model_Amazon_Repricing
506
return $collection->getData();
507
}
508
509
public function setProductRepricingStatusBySku($skus, $status)
510
{
511
$connWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
@@ -523,12 +535,70 @@ class Ess_M2ePro_Model_Amazon_Repricing
523
);
524
}
525
526
//----------------------------------------
527
528
/**
529
* @return Ess_M2ePro_Model_Mysql4_Amazon_Listing_Product_Collection
530
*/
531
- private function prepareLisgingProductCollection()
532
{
533
$collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
534
$collection->getSelect()
8
9
class Ess_M2ePro_Model_Amazon_Repricing
10
{
11
+ const COMMAND_ACCOUNT_LINK = 'account/link';
12
+ const COMMAND_ACCOUNT_UNLINK = 'account/unlink';
13
+ const COMMAND_SYNCHRONIZE = 'synchronize';
14
+ const COMMAND_GOTO_SERVICE = 'goto_service';
15
+ const COMMAND_OFFERS_ADD = 'offers/add';
16
+ const COMMAND_OFFERS_DETAILS = 'offers/details';
17
+ const COMMAND_OFFERS_EDIT = 'offers/edit';
18
+ const COMMAND_OFFERS_REMOVE = 'offers/remove';
19
+ const COMMAND_DATA_SET_REQUEST = 'data/setRequest';
20
+ const COMMAND_DATA_GET_RESPONSE = 'data/getResponse';
21
22
const TIMEOUT = 300;
23
82
// ---------------------------------------
83
84
$requestToken = $this->sendData(self::COMMAND_ACCOUNT_LINK, array(
85
+ 'request' => array(
86
+ 'back_url' => array(
87
+ 'url' => $backUrl,
88
+ 'params' => array(
89
+ 'id' => $this->account->getId()
90
+ )
91
)
92
),
93
'data' => array(
100
));
101
102
return $this->getBaseUrl() .
103
+ self::COMMAND_ACCOUNT_LINK .
104
'?' . http_build_query(array('request_token' => $requestToken));
105
}
106
108
{
109
$backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_account_repricing/unlink');
110
111
+ $collection = $this->prepareListingProductCollection();
112
113
$collection->getSelect()->where("`l`.`account_id` = ?", $this->account->getId());
114
+ $collection->getSelect()->where('second_table.is_repricing = ?',
115
+ Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES);
116
117
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
118
$collection->getSelect()->columns(array(
119
+ 'name' => 'cpev.value',
120
+ 'asin' => 'second_table.general_id',
121
+ 'sku' => 'second_table.sku',
122
+ 'price' => 'second_table.online_price'
123
));
124
125
$requestToken = $this->sendData(self::COMMAND_ACCOUNT_UNLINK, array(
126
'request' => array(
127
'auth' => array(
128
'account_token' => $this->getAmazonAccount()->getRepricingToken()
129
+ ),
130
+ 'back_url' => array(
131
+ 'url' => $backUrl,
132
+ 'params' => array(
133
+ 'id' => $this->account->getId()
134
+ )
135
)
136
),
137
'data' => array(
140
));
141
142
return $this->getBaseUrl() .
143
+ self::COMMAND_ACCOUNT_UNLINK .
144
'?' . http_build_query(array('request_token' => $requestToken));
145
}
146
148
149
public function getManagementUrl()
150
{
151
+ return $this->getBaseUrl() . self::COMMAND_GOTO_SERVICE . '?' . http_build_query(array(
152
'account_token' => $this->getAmazonAccount()->getRepricingToken()
153
));
154
}
159
{
160
$backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/addProducts');
161
162
+ $collection = $this->prepareListingProductCollection();
163
164
$collection->getSelect()->where('main_table.id IN (?)', $productsIds);
165
$collection->getSelect()->where('second_table.is_repricing = ?',
171
'name' => 'cpev.value',
172
'asin' => 'second_table.general_id',
173
'sku' => 'second_table.sku',
174
+ 'price' => 'second_table.online_price'
175
)
176
);
177
185
'request' => array(
186
'auth' => array(
187
'account_token' => $this->getAmazonAccount()->getRepricingToken()
188
+ ),
189
+ 'back_url' => array(
190
+ 'url' => $backUrl,
191
+ 'params' => array(
192
+ 'id' => $listingId,
193
+ 'account_id' => $this->account->getId()
194
+ )
195
)
196
),
197
'data' => array(
200
));
201
202
return $this->getBaseUrl() .
203
+ self::COMMAND_OFFERS_ADD .
204
'?' . http_build_query(array('request_token' => $requestToken));
205
}
206
207
+ public function getShowDetailsUrl($listingId, $productsIds)
208
{
209
+ $backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/showDetails');
210
211
+ $collection = $this->prepareListingProductCollection();
212
213
$collection->getSelect()->where('main_table.id IN (?)', $productsIds);
214
$collection->getSelect()->where('second_table.is_repricing = ?',
217
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
218
$collection->getSelect()->columns(
219
array(
220
+ 'name' => 'cpev.value',
221
+ 'asin' => 'second_table.general_id',
222
'sku' => 'second_table.sku',
223
+ 'price' => 'second_table.online_price'
224
)
225
);
226
230
return false;
231
}
232
233
+ $requestToken = $this->sendData(self::COMMAND_OFFERS_DETAILS, array(
234
'request' => array(
235
'auth' => array(
236
'account_token' => $this->getAmazonAccount()->getRepricingToken()
237
+ ),
238
+ 'back_url' => array(
239
+ 'url' => $backUrl,
240
+ 'params' => array(
241
+ 'id' => $listingId,
242
+ 'account_id' => $this->account->getId()
243
+ )
244
)
245
),
246
'data' => array(
249
));
250
251
return $this->getBaseUrl() .
252
+ self::COMMAND_OFFERS_DETAILS .
253
'?' . http_build_query(array('request_token' => $requestToken));
254
}
255
256
+ public function getEditProductsUrl($listingId, $productsIds)
257
{
258
+ $backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/editProducts');
259
260
+ $collection = $this->prepareListingProductCollection();
261
262
$collection->getSelect()->where('main_table.id IN (?)', $productsIds);
263
$collection->getSelect()->where('second_table.is_repricing = ?',
266
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
267
$collection->getSelect()->columns(
268
array(
269
+ 'name' => 'cpev.value',
270
+ 'asin' => 'second_table.general_id',
271
'sku' => 'second_table.sku',
272
+ 'price' => 'second_table.online_price'
273
)
274
);
275
279
return false;
280
}
281
282
+ $requestToken = $this->sendData(self::COMMAND_OFFERS_EDIT, array(
283
'request' => array(
284
'auth' => array(
285
'account_token' => $this->getAmazonAccount()->getRepricingToken()
286
+ ),
287
+ 'back_url' => array(
288
+ 'url' => $backUrl,
289
+ 'params' => array(
290
+ 'id' => $listingId,
291
+ 'account_id' => $this->account->getId()
292
+ )
293
)
294
),
295
'data' => array(
298
));
299
300
return $this->getBaseUrl() .
301
+ self::COMMAND_OFFERS_EDIT .
302
'?' . http_build_query(array('request_token' => $requestToken));
303
}
304
305
+ public function getRemoveProductsUrl($listingId, $productsIds)
306
{
307
+ $backUrl = Mage::helper('adminhtml')->getUrl('*/adminhtml_common_amazon_listing_repricing/removeProducts');
308
309
+ $collection = $this->prepareListingProductCollection();
310
311
+ $collection->getSelect()->where('main_table.id IN (?)', $productsIds);
312
+ $collection->getSelect()->where('second_table.is_repricing = ?',
313
+ Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES);
314
315
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
316
+ $collection->getSelect()->columns(
317
+ array(
318
+ 'name' => 'cpev.value',
319
+ 'asin' => 'second_table.general_id',
320
+ 'sku' => 'second_table.sku',
321
+ 'price' => 'second_table.online_price'
322
+ )
323
+ );
324
325
+ $productsData = $collection->getData();
326
327
+ if (empty($productsData)) {
328
+ return false;
329
}
330
331
+ $requestToken = $this->sendData(self::COMMAND_OFFERS_REMOVE, array(
332
+ 'request' => array(
333
+ 'auth' => array(
334
+ 'account_token' => $this->getAmazonAccount()->getRepricingToken()
335
+ ),
336
+ 'back_url' => array(
337
+ 'url' => $backUrl,
338
+ 'params' => array(
339
+ 'id' => $listingId,
340
+ 'account_id' => $this->account->getId()
341
+ )
342
+ )
343
+ ),
344
+ 'data' => array(
345
+ 'offers' => $productsData
346
+ )
347
));
348
349
+ return $this->getBaseUrl() .
350
+ self::COMMAND_OFFERS_REMOVE .
351
+ '?' . http_build_query(array('request_token' => $requestToken));
352
}
353
354
+ //########################################
355
+
356
public function synchronize()
357
{
358
$result = $this->sendRequest(
374
$response = json_decode($result['response'], true);
375
376
if ($response['status'] == '0') {
377
+ return $response['messages'];
378
}
379
380
if (empty($response['offers'])) {
381
+
382
+ $this->account->setSetting('repricing', array('info', 'total_products'), 0);
383
+ $this->account->save();
384
+
385
return array(
386
array(
387
'type' => 'notice',
397
$skus[] = $offer['sku'];
398
}
399
400
+ $this->resetProductRepricingStatus();
401
+
402
$this->setProductRepricingStatusBySku(
403
$skus,
404
Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
417
return Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/repricing/', 'base_url');
418
}
419
420
+ // ---------------------------------------
421
422
+ public function getResponseData($responseToken)
423
+ {
424
+ $result = $this->sendRequest(
425
+ $this->getBaseUrl() . self::COMMAND_DATA_GET_RESPONSE,
426
+ array(
427
+ 'response_token' => $responseToken
428
+ )
429
+ );
430
431
+ return json_decode($result['response'], true);
432
}
433
434
// ---------------------------------------
435
436
private function sendData($command, $data)
437
{
438
+ if (!empty($data['data'])) {
439
+ $data['data'] = json_encode($data['data']);
440
+ }
441
+
442
$result = $this->sendRequest(
443
+ $this->getBaseUrl() . $command,
444
$data
445
);
446
447
+ $response = json_decode($result['response'], true);
448
+
449
+ if (!empty($response['request_token'])) {
450
+ return $response['request_token'];
451
}
452
453
return false;
502
503
public function getRepricingListingProductsData()
504
{
505
+ $collection = $this->prepareListingProductCollection();
506
507
$collection->getSelect()->where("`l`.`account_id` = ?", $this->account->getId());
508
+ $collection->getSelect()->where('second_table.is_repricing = ?',
509
+ Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES);
510
511
$collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
512
$collection->getSelect()->columns(array(
516
return $collection->getData();
517
}
518
519
+ //----------------------------------------
520
+
521
public function setProductRepricingStatusBySku($skus, $status)
522
{
523
$connWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
535
);
536
}
537
538
+ public function resetProductRepricingStatus()
539
+ {
540
+ $connWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
541
+
542
+ $tableAmazonListingProduct = Mage::getSingleton('core/resource')->getTableName('m2epro_amazon_listing_product');
543
+ $tableAmazonListingOther = Mage::getSingleton('core/resource')->getTableName('m2epro_amazon_listing_other');
544
+
545
+ /** @var Ess_M2ePro_Model_Mysql4_Amazon_Listing_Product_Collection $collection */
546
+ $collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
547
+
548
+ $collection->getSelect()
549
+ ->join(array('l' => Mage::getResourceModel('M2ePro/Listing')->getMainTable()),
550
+ '(`l`.`id` = `main_table`.`listing_id`)', array());
551
+
552
+ $collection->getSelect()->where(
553
+ "`second_table`.`is_repricing` = ?",
554
+ Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
555
+ );
556
+ $collection->getSelect()->where("`l`.`account_id` = ?", $this->account->getId());
557
+
558
+ $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
559
+ $collection->getSelect()->columns(array(
560
+ 'id' => 'main_table.id'
561
+ ));
562
+
563
+ $productsIds = $collection->getColumnValues('id');
564
+
565
+ if (!empty($productsIds)) {
566
+ $connWrite->update($tableAmazonListingProduct, array(
567
+ 'is_repricing' => Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_NO
568
+ ), '`listing_product_id` IN ('.implode(',', $productsIds).')'
569
+ );
570
+ }
571
+
572
+ /** @var Ess_M2ePro_Model_Mysql4_Amazon_Listing_Other_Collection $collection */
573
+ $collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Other');
574
+
575
+ $collection->getSelect()->where("`main_table`.`account_id` = ?", $this->account->getId());
576
+ $collection->getSelect()->where(
577
+ "`second_table`.`is_repricing` = ?",
578
+ Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
579
+ );
580
+
581
+ $collection->getSelect()->reset(Zend_Db_Select::COLUMNS);
582
+ $collection->getSelect()->columns(array(
583
+ 'id' => 'main_table.id'
584
+ ));
585
+
586
+ $productsIds = $collection->getColumnValues('id');
587
+
588
+ if (!empty($productsIds)) {
589
+ $connWrite->update($tableAmazonListingOther, array(
590
+ 'is_repricing' => Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_NO
591
+ ), '`listing_other_id` IN ('.implode(',', $productsIds).')'
592
+ );
593
+ }
594
+ }
595
+
596
//----------------------------------------
597
598
/**
599
* @return Ess_M2ePro_Model_Mysql4_Amazon_Listing_Product_Collection
600
*/
601
+ private function prepareListingProductCollection()
602
{
603
$collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
604
$collection->getSelect()
app/code/community/Ess/M2ePro/Model/Buy/Synchronization/Defaults/UpdateListingsProducts/Responser.php CHANGED
@@ -163,7 +163,7 @@ class Ess_M2ePro_Model_Buy_Synchronization_Defaults_UpdateListingsProducts_Respo
163
) {
164
$lastQtySynchDate = $existingAdditionalData['last_synchronization_dates']['qty'];
165
166
- if (strtotime($lastQtySynchDate) > strtotime($this->params['request_date'])) {
167
unset($newData['online_qty'], $newData['status']);
168
unset($existingData['online_qty'], $existingData['status']);
169
}
@@ -174,7 +174,7 @@ class Ess_M2ePro_Model_Buy_Synchronization_Defaults_UpdateListingsProducts_Respo
174
) {
175
$lastPriceSynchDate = $existingAdditionalData['last_synchronization_dates']['price'];
176
177
- if (strtotime($lastPriceSynchDate) > strtotime($this->params['request_date'])) {
178
unset($newData['online_price']);
179
unset($existingData['online_price']);
180
}
@@ -334,4 +334,16 @@ class Ess_M2ePro_Model_Buy_Synchronization_Defaults_UpdateListingsProducts_Respo
334
}
335
336
//########################################
337
}
163
) {
164
$lastQtySynchDate = $existingAdditionalData['last_synchronization_dates']['qty'];
165
166
+ if ($this->isProductInfoOutdated($lastQtySynchDate)) {
167
unset($newData['online_qty'], $newData['status']);
168
unset($existingData['online_qty'], $existingData['status']);
169
}
174
) {
175
$lastPriceSynchDate = $existingAdditionalData['last_synchronization_dates']['price'];
176
177
+ if ($this->isProductInfoOutdated($lastPriceSynchDate)) {
178
unset($newData['online_price']);
179
unset($existingData['online_price']);
180
}
334
}
335
336
//########################################
337
+
338
+ private function isProductInfoOutdated($lastDate)
339
+ {
340
+ $lastDate = new DateTime($lastDate, new DateTimeZone('UTC'));
341
+ $requestDate = new DateTime($this->params['request_date'], new DateTimeZone('UTC'));
342
+
343
+ $lastDate->modify('+1 day');
344
+
345
+ return $lastDate > $requestDate;
346
+ }
347
+
348
+ // ########################################
349
}
app/code/community/Ess/M2ePro/Model/Ebay/Template/Description.php CHANGED
@@ -511,7 +511,7 @@ class Ess_M2ePro_Model_Ebay_Template_Description extends Ess_M2ePro_Model_Compon
511
$productDetails = $this->getProductDetails();
512
513
if (!is_array($productDetails) || !isset($productDetails[$type]) ||
514
- !isset($productDetails[$type]['attribute'])) {
515
return NULL;
516
}
517
511
$productDetails = $this->getProductDetails();
512
513
if (!is_array($productDetails) || !isset($productDetails[$type]) ||
514
+ $this->isProductDetailsModeNone($type) || !isset($productDetails[$type]['attribute'])) {
515
return NULL;
516
}
517
app/code/community/Ess/M2ePro/Model/Observer/Dispatcher.php CHANGED
@@ -12,7 +12,7 @@ class Ess_M2ePro_Model_Observer_Dispatcher
12
13
public function systemConfigurationSaveAction(Varien_Event_Observer $eventObserver)
14
{
15
- $this->process('Magento_Configuration', $eventObserver);
16
}
17
18
//########################################
@@ -86,16 +86,33 @@ class Ess_M2ePro_Model_Observer_Dispatcher
86
87
public function orderView(Varien_Event_Observer $eventObserver)
88
{
89
$this->process('Order_View', $eventObserver);
90
}
91
92
public function shipmentViewBefore(Varien_Event_Observer $eventObserver)
93
{
94
$this->process('Shipment_View_Before', $eventObserver);
95
}
96
97
public function shipmentViewAfter(Varien_Event_Observer $eventObserver)
98
{
99
$this->process('Shipment_View_After', $eventObserver);
100
}
101
@@ -140,10 +157,11 @@ class Ess_M2ePro_Model_Observer_Dispatcher
140
141
//########################################
142
143
- private function process($observerModel, Varien_Event_Observer $eventObserver)
144
{
145
- if (!Mage::helper('M2ePro/Module')->isReadyToWork() ||
146
- !Mage::helper('M2ePro/Component')->getActiveComponents()) {
147
148
return;
149
}
12
13
public function systemConfigurationSaveAction(Varien_Event_Observer $eventObserver)
14
{
15
+ $this->process('Magento_Configuration', $eventObserver, true);
16
}
17
18
//########################################
86
87
public function orderView(Varien_Event_Observer $eventObserver)
88
{
89
+ // event dispatched for ALL rendered magento blocks, so we need to skip unnecessary blocks ASAP
90
+ if (!($eventObserver->getEvent()->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_View)) {
91
+ return;
92
+ }
93
+
94
$this->process('Order_View', $eventObserver);
95
}
96
97
public function shipmentViewBefore(Varien_Event_Observer $eventObserver)
98
{
99
+ // event dispatched for ALL rendered magento blocks, so we need to skip unnecessary blocks ASAP
100
+ if (!($eventObserver->getEvent()->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_Create) &&
101
+ !($eventObserver->getEvent()->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_View)
102
+ ) {
103
+ return;
104
+ }
105
+
106
$this->process('Shipment_View_Before', $eventObserver);
107
}
108
109
public function shipmentViewAfter(Varien_Event_Observer $eventObserver)
110
{
111
+ // event dispatched for ALL rendered magento blocks, so we need to skip unnecessary blocks ASAP
112
+ if (!($eventObserver->getEvent()->getBlock() instanceof Mage_Adminhtml_Block_Sales_Order_Shipment_Create)) {
113
+ return;
114
+ }
115
+
116
$this->process('Shipment_View_After', $eventObserver);
117
}
118
157
158
//########################################
159
160
+ private function process($observerModel, Varien_Event_Observer $eventObserver, $forceRun = false)
161
{
162
+ if (!$forceRun &&
163
+ (!Mage::helper('M2ePro/Module')->isReadyToWork() ||
164
+ !Mage::helper('M2ePro/Component')->getActiveComponents())) {
165
166
return;
167
}
app/code/community/Ess/M2ePro/Model/ProductChange.php CHANGED
@@ -218,72 +218,4 @@ class Ess_M2ePro_Model_ProductChange extends Ess_M2ePro_Model_Abstract
218
}
219
220
//########################################
221
-
222
- public function clearLastProcessed($date, $maxPerOneTime)
223
- {
224
- $stmt = $this->getResource()->getReadConnection()
225
- ->select()
226
- ->from(array('pc' => $this->getResource()->getMainTable()),'id')
227
- ->order(array('id ASC'))
228
- ->limit($maxPerOneTime)
229
- ->query();
230
-
231
- $ids = array();
232
- while ($ids[] = (int)$stmt->fetchColumn());
233
- $ids = array_values(array_unique(array_filter($ids)));
234
-
235
- if (empty($ids)) {
236
- return;
237
- }
238
-
239
- $ids = implode(',',$ids);
240
- $initiator = self::INITIATOR_OBSERVER;
241
-
242
- $this->clear("id IN ({$ids}) AND (update_date <= '{$date}' OR initiators NOT LIKE '%{$initiator}%')");
243
- }
244
-
245
- public function clearOutdated($maxLifeTime)
246
- {
247
- /** @var $connRead Varien_Db_Adapter_Pdo_Mysql */
248
- $connRead = Mage::getSingleton('core/resource')->getConnection('core_read');
249
-
250
- $tempDate = new DateTime('now', new DateTimeZone('UTC'));
251
- $tempDate->modify('-'.$maxLifeTime.' seconds');
252
- $tempDate = Mage::helper('M2ePro')->getDate($tempDate->format('U'));
253
-
254
- Mage::getModel('M2ePro/ProductChange')->clear(
255
- 'update_date <= ' . $connRead->quote($tempDate)
256
- );
257
- }
258
-
259
- public function clearExcessive($maxProductsChanges)
260
- {
261
- $countOfProductChanges = Mage::getModel('M2ePro/ProductChange')->getCollection()->getSize();
262
-
263
- if (($countOfProductChangesToDelete = $countOfProductChanges - $maxProductsChanges) > 0) {
264
- Mage::getModel('M2ePro/ProductChange')->clear(NULL, $countOfProductChangesToDelete);
265
- }
266
- }
267
-
268
- //########################################
269
-
270
- public function clear($where = NULL, $limit = NULL)
271
- {
272
- if ($limit < 0) {
273
- $limit = NULL;
274
- }
275
-
276
- /** @var $connWrite Varien_Db_Adapter_Pdo_Mysql */
277
- $connWrite = Mage::getSingleton('core/resource')->getConnection('core_write');
278
- $tableName = $this->getResource()->getMainTable();
279
-
280
- $where && $where = "AND {$where}";
281
- $limit && $limit = "LIMIT {$limit}";
282
-
283
- $sql = "DELETE FROM {$tableName} WHERE 1 {$where} ORDER BY id ASC {$limit}";
284
-
285
- $connWrite->query($sql);
286
- }
287
-
288
- //########################################
289
}
218
}
219
220
//########################################
221
}
app/code/community/Ess/M2ePro/Model/Synchronization/Dispatcher.php CHANGED
@@ -261,11 +261,13 @@ final class Ess_M2ePro_Model_Synchronization_Dispatcher
261
262
$this->getLog()->setOperationHistoryId($this->getOperationHistory()->getObject()->getId());
263
264
- $this->checkAndPrepareProductChange();
265
-
266
if (in_array(Ess_M2ePro_Model_Synchronization_Task::ORDERS, $this->getAllowedTasksTypes())) {
267
Mage::dispatchEvent('m2epro_synchronization_before_start', array());
268
}
269
}
270
271
protected function afterEnd()
@@ -274,10 +276,9 @@ final class Ess_M2ePro_Model_Synchronization_Dispatcher
274
Mage::dispatchEvent('m2epro_synchronization_after_end', array());
275
}
276
277
- Mage::getModel('M2ePro/ProductChange')->clearLastProcessed(
278
- $this->getOperationHistory()->getObject()->getData('start_date'),
279
- (int)$this->getConfigValue('/settings/product_change/', 'max_count_per_one_time')
280
- );
281
282
$this->getOperationHistory()->stop();
283
$this->getLockItem()->remove();
@@ -322,23 +323,47 @@ final class Ess_M2ePro_Model_Synchronization_Dispatcher
322
323
// ---------------------------------------
324
325
- protected function checkAndPrepareProductChange()
326
{
327
- Mage::getModel('M2ePro/ProductChange')->clearOutdated(
328
- $this->getConfigValue('/settings/product_change/', 'max_lifetime')
329
- );
330
- Mage::getModel('M2ePro/ProductChange')->clearExcessive(
331
- (int)$this->getConfigValue('/settings/product_change/', 'max_count')
332
);
333
334
- $startDate = $this->getOperationHistory()->getObject()->getData('start_date');
335
- $maxCountPerOneTime = (int)$this->getConfigValue('/settings/product_change/', 'max_count_per_one_time');
336
-
337
- $functionCode = "Mage::getModel('M2ePro/ProductChange')
338
- ->clearLastProcessed('{$startDate}',{$maxCountPerOneTime});";
339
-
340
- $shutdownFunction = create_function('', $functionCode);
341
- register_shutdown_function($shutdownFunction);
342
}
343
344
//########################################
261
262
$this->getLog()->setOperationHistoryId($this->getOperationHistory()->getObject()->getId());
263
264
if (in_array(Ess_M2ePro_Model_Synchronization_Task::ORDERS, $this->getAllowedTasksTypes())) {
265
Mage::dispatchEvent('m2epro_synchronization_before_start', array());
266
}
267
+
268
+ if (in_array(Ess_M2ePro_Model_Synchronization_Task::TEMPLATES, $this->getAllowedTasksTypes())) {
269
+ $this->clearOutdatedProductChanges();
270
+ }
271
}
272
273
protected function afterEnd()
276
Mage::dispatchEvent('m2epro_synchronization_after_end', array());
277
}
278
279
+ if (in_array(Ess_M2ePro_Model_Synchronization_Task::TEMPLATES, $this->getAllowedTasksTypes())) {
280
+ $this->clearProcessedProductChanges();
281
+ }
282
283
$this->getOperationHistory()->stop();
284
$this->getLockItem()->remove();
323
324
// ---------------------------------------
325
326
+ protected function clearOutdatedProductChanges()
327
{
328
+ /** @var Mage_Core_Model_Resource $resource */
329
+ $resource = Mage::getSingleton('core/resource');
330
+ /** @var $connWrite Varien_Db_Adapter_Pdo_Mysql */
331
+ $connWrite = $resource->getConnection('core_write');
332
+
333
+ $tempDate = new DateTime('now', new DateTimeZone('UTC'));
334
+ $tempDate->modify('-'.$this->getConfigValue('/settings/product_change/', 'max_lifetime').' seconds');
335
+ $tempDate = Mage::helper('M2ePro')->getDate($tempDate->format('U'));
336
+
337
+ $connWrite->delete(
338
+ $resource->getTableName('m2epro_product_change'),
339
+ array(
340
+ 'update_date <= (?)' => $tempDate
341
+ )
342
);
343
+ }
344
345
+ protected function clearProcessedProductChanges()
346
+ {
347
+ /** @var Ess_M2ePro_Model_Mysql4_ProductChange_Collection $productChangeCollection */
348
+ $productChangeCollection = Mage::getResourceModel('M2ePro/ProductChange_Collection');
349
+ $productChangeCollection->setPageSize(
350
+ (int)$this->getConfigValue('/settings/product_change/', 'max_count_per_one_time')
351
+ );
352
+ $productChangeCollection->setOrder('id', Varien_Data_Collection_Db::SORT_ORDER_ASC);
353
+
354
+ /** @var Mage_Core_Model_Resource $resource */
355
+ $resource = Mage::getSingleton('core/resource');
356
+ /** @var $connWrite Varien_Db_Adapter_Pdo_Mysql */
357
+ $connWrite = $resource->getConnection('core_write');
358
+
359
+ $connWrite->delete(
360
+ $resource->getTableName('m2epro_product_change'),
361
+ array(
362
+ 'id IN (?)' => $productChangeCollection->getColumnValues('id'),
363
+ '(update_date <= \''.$this->getOperationHistory()->getObject()->getData('start_date').'\' OR
364
+ initiators NOT LIKE \'%'.Ess_M2ePro_Model_ProductChange::INITIATOR_OBSERVER.'%\')'
365
+ )
366
+ );
367
}
368
369
//########################################
app/code/community/Ess/M2ePro/Model/Upgrade/MySqlSetup.php CHANGED
@@ -144,10 +144,6 @@ class Ess_M2ePro_Model_Upgrade_MySqlSetup extends Mage_Core_Model_Resource_Setup
144
if (function_exists('opcache_get_status')) {
145
opcache_reset();
146
}
147
-
148
- if (defined('COMPILER_INCLUDE_PATH')) {
149
- Mage::getModel('compiler/process')->run();
150
- }
151
}
152
153
protected function afterModuleDbModification()
@@ -184,7 +180,7 @@ class Ess_M2ePro_Model_Upgrade_MySqlSetup extends Mage_Core_Model_Resource_Setup
184
185
//########################################
186
187
- public function applyUpdates()
188
{
189
// double running protection
190
usleep(1000000); // 1 sec
@@ -198,7 +194,11 @@ class Ess_M2ePro_Model_Upgrade_MySqlSetup extends Mage_Core_Model_Resource_Setup
198
try {
199
200
$this->beforeModuleDbModification();
201
- parent::applyUpdates();
202
$this->afterModuleDbModification();
203
204
} catch (Exception $e) {
@@ -210,20 +210,34 @@ class Ess_M2ePro_Model_Upgrade_MySqlSetup extends Mage_Core_Model_Resource_Setup
210
$this->unlock();
211
}
212
213
- // ---------------------------------------
214
-
215
- protected function _installResourceDb($newVersion)
216
- {
217
- $this->beforeInstall($newVersion);
218
- parent::_installResourceDb($newVersion);
219
- $this->afterInstall($newVersion);
220
- }
221
-
222
protected function _upgradeResourceDb($oldVersion, $newVersion)
223
{
224
- $this->beforeUpgrade($oldVersion, $newVersion);
225
- parent::_upgradeResourceDb($oldVersion, $newVersion);
226
- $this->afterUpgrade($oldVersion, $newVersion);
227
}
228
229
// ---------------------------------------
@@ -269,7 +283,7 @@ class Ess_M2ePro_Model_Upgrade_MySqlSetup extends Mage_Core_Model_Resource_Setup
269
);
270
}
271
272
- protected function removeConfigsDuplicates()
273
{
274
foreach ($this->getTablesObject()->getAllHistoryConfigEntities() as $tableName => $tableFullName) {
275
144
if (function_exists('opcache_get_status')) {
145
opcache_reset();
146
}
147
}
148
149
protected function afterModuleDbModification()
180
181
//########################################
182
183
+ protected function _installResourceDb($newVersion)
184
{
185
// double running protection
186
usleep(1000000); // 1 sec
194
try {
195
196
$this->beforeModuleDbModification();
197
+ $this->beforeInstall($newVersion);
198
+
199
+ parent::_installResourceDb($newVersion);
200
+
201
+ $this->afterInstall($newVersion);
202
$this->afterModuleDbModification();
203
204
} catch (Exception $e) {
210
$this->unlock();
211
}
212
213
protected function _upgradeResourceDb($oldVersion, $newVersion)
214
{
215
+ // double running protection
216
+ usleep(1000000); // 1 sec
217
+
218
+ if ($this->isLocked()) {
219
+ return;
220
+ }
221
+
222
+ $this->lock();
223
+
224
+ try {
225
+
226
+ $this->beforeModuleDbModification();
227
+ $this->beforeUpgrade($oldVersion, $newVersion);
228
+
229
+ parent::_upgradeResourceDb($oldVersion, $newVersion);
230
+
231
+ $this->afterUpgrade($oldVersion, $newVersion);
232
+ $this->afterModuleDbModification();
233
+
234
+ } catch (Exception $e) {
235
+
236
+ $this->unlock();
237
+ throw $e;
238
+ }
239
+
240
+ $this->unlock();
241
}
242
243
// ---------------------------------------
283
);
284
}
285
286
+ public function removeConfigsDuplicates()
287
{
288
foreach ($this->getTablesObject()->getAllHistoryConfigEntities() as $tableName => $tableFullName) {
289
app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Account/RepricingController.php CHANGED
@@ -39,11 +39,11 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Account_RepricingController
39
public function linkAction()
40
{
41
$accountId = $this->getRequest()->getParam('id');
42
- $token = $this->getRequest()->getParam('token');
43
$email = $this->getRequest()->getParam('email');
44
45
$status = $this->getRequest()->getParam('status');
46
- $messages = $this->getRequest()->getParam('messages');
47
48
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
49
@@ -99,7 +99,7 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Account_RepricingController
99
$accountId = $this->getRequest()->getParam('id');
100
101
$status = $this->getRequest()->getParam('status');
102
- $messages = $this->getRequest()->getParam('messages');
103
104
/** @var $model Ess_M2ePro_Model_Account */
105
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
@@ -117,7 +117,7 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Account_RepricingController
117
118
/** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
119
$repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
120
- $repricing->unlink();
121
}
122
123
return $this->_redirectUrl($this->getUrl('*/adminhtml_common_amazon_account/edit', array(
39
public function linkAction()
40
{
41
$accountId = $this->getRequest()->getParam('id');
42
+ $token = $this->getRequest()->getParam('account_token');
43
$email = $this->getRequest()->getParam('email');
44
45
$status = $this->getRequest()->getParam('status');
46
+ $messages = $this->getRequest()->getParam('messages', array());
47
48
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
49
99
$accountId = $this->getRequest()->getParam('id');
100
101
$status = $this->getRequest()->getParam('status');
102
+ $messages = $this->getRequest()->getParam('messages', array());
103
104
/** @var $model Ess_M2ePro_Model_Account */
105
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
117
118
/** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
119
$repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
120
+ $repricing->resetProductRepricingStatus();
121
}
122
123
return $this->_redirectUrl($this->getUrl('*/adminhtml_common_amazon_account/edit', array(
app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php CHANGED
@@ -62,14 +62,7 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Listing_RepricingController
62
public function addProductsAction()
63
{
64
$accountId = $this->getRequest()->getParam('account_id');
65
- $offers = $this->getRequest()->getParam('offers');
66
-
67
- $status = $this->getRequest()->getParam('status');
68
- $messages = $this->getRequest()->getParam('messages');
69
-
70
- if (!is_array($offers)) {
71
- $offers = explode(',', $offers);
72
- }
73
74
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
75
@@ -78,24 +71,28 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Listing_RepricingController
78
return $this->indexAction();
79
}
80
81
- $this->parseRepricingMessages($messages);
82
83
- if ($status == '0') {
84
return $this->indexAction();
85
}
86
87
- if (empty($offers)) {
88
return $this->indexAction();
89
}
90
91
$skus = array();
92
- foreach ($offers as $offer) {
93
$skus[] = $offer['sku'];
94
}
95
96
- /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
97
- $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
98
-
99
$repricing->setProductRepricingStatusBySku(
100
$skus,
101
Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
@@ -109,7 +106,71 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Listing_RepricingController
109
110
//########################################
111
112
- public function openEditProducts()
113
{
114
$listingId = $this->getRequest()->getParam('id');
115
$accountId = $this->getRequest()->getParam('account_id');
@@ -148,9 +209,24 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Listing_RepricingController
148
149
public function editProductsAction()
150
{
151
- $messages = $this->getRequest()->getParam('messages');
152
153
- $this->parseRepricingMessages($messages);
154
155
return $this->indexAction();
156
}
@@ -197,14 +273,7 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Listing_RepricingController
197
public function removeProductsAction()
198
{
199
$accountId = $this->getRequest()->getParam('account_id');
200
- $offers = $this->getRequest()->getParam('offers');
201
-
202
- $status = $this->getRequest()->getParam('status');
203
- $messages = $this->getRequest()->getParam('messages');
204
-
205
- if (!is_array($offers)) {
206
- $offers = explode(',', $offers);
207
- }
208
209
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
210
@@ -213,23 +282,28 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Listing_RepricingController
213
return $this->indexAction();
214
}
215
216
- $this->parseRepricingMessages($messages);
217
218
- if ($status == '0') {
219
return $this->indexAction();
220
}
221
222
- if (empty($offers)) {
223
return $this->indexAction();
224
}
225
226
$skus = array();
227
- foreach ($offers as $offer) {
228
$skus[] = $offer['sku'];
229
}
230
231
- /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
232
- $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
233
$repricing->setProductRepricingStatusBySku(
234
$skus,
235
Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_NO
62
public function addProductsAction()
63
{
64
$accountId = $this->getRequest()->getParam('account_id');
65
+ $responseToken = $this->getRequest()->getParam('response_token');
66
67
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
68
71
return $this->indexAction();
72
}
73
74
+ /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
75
+ $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
76
+
77
+ $response = $repricing->getResponseData($responseToken);
78
79
+ if (!empty($response['messages'])) {
80
+ $this->parseRepricingMessages($response['messages']);
81
+ }
82
+
83
+ if ($response['status'] == '0') {
84
return $this->indexAction();
85
}
86
87
+ if (empty($response['offers'])) {
88
return $this->indexAction();
89
}
90
91
$skus = array();
92
+ foreach ($response['offers'] as $offer) {
93
$skus[] = $offer['sku'];
94
}
95
96
$repricing->setProductRepricingStatusBySku(
97
$skus,
98
Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES
106
107
//########################################
108
109
+ public function openShowDetailsAction()
110
+ {
111
+ $listingId = $this->getRequest()->getParam('id');
112
+ $accountId = $this->getRequest()->getParam('account_id');
113
+ $productsIds = $this->getRequest()->getParam('products_ids');
114
+
115
+ if (!is_array($productsIds)) {
116
+ $productsIds = explode(',', $productsIds);
117
+ }
118
+
119
+ $model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
120
+
121
+ if ($accountId && !$model->getId()) {
122
+ $this->_getSession()->addError(Mage::helper('M2ePro')->__('Account does not exist.'));
123
+ return $this->indexAction();
124
+ }
125
+
126
+ if (empty($productsIds)) {
127
+ $this->_getSession()->addError(Mage::helper('M2ePro')->__('Products not selected.'));
128
+ return $this->indexAction();
129
+ }
130
+
131
+ /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
132
+ $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
133
+
134
+ $url = $repricing->getShowDetailsUrl($listingId, $productsIds);
135
+
136
+ if ($url === false) {
137
+ $this->_getSession()->addError(
138
+ Mage::helper('M2ePro')
139
+ ->__('The selected Amazon Products cannot be Managed by Amazon Repricing Tool.')
140
+ );
141
+ return $this->indexAction();
142
+ }
143
+
144
+ return $this->_redirectUrl($url);
145
+ }
146
+
147
+ public function showDetailsAction()
148
+ {
149
+ $accountId = $this->getRequest()->getParam('account_id');
150
+ $responseToken = $this->getRequest()->getParam('response_token');
151
+
152
+ $model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
153
+
154
+ if ($accountId && !$model->getId()) {
155
+ $this->_getSession()->addError(Mage::helper('M2ePro')->__('Account does not exist.'));
156
+ return $this->indexAction();
157
+ }
158
+
159
+ /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
160
+ $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
161
+
162
+ $response = $repricing->getResponseData($responseToken);
163
+
164
+ if (!empty($response['messages'])) {
165
+ $this->parseRepricingMessages($response['messages']);
166
+ }
167
+
168
+ return $this->indexAction();
169
+ }
170
+
171
+ //########################################
172
+
173
+ public function openEditProductsAction()
174
{
175
$listingId = $this->getRequest()->getParam('id');
176
$accountId = $this->getRequest()->getParam('account_id');
209
210
public function editProductsAction()
211
{
212
+ $accountId = $this->getRequest()->getParam('account_id');
213
+ $responseToken = $this->getRequest()->getParam('response_token');
214
215
+ $model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
216
+
217
+ if ($accountId && !$model->getId()) {
218
+ $this->_getSession()->addError(Mage::helper('M2ePro')->__('Account does not exist.'));
219
+ return $this->indexAction();
220
+ }
221
+
222
+ /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
223
+ $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
224
+
225
+ $response = $repricing->getResponseData($responseToken);
226
+
227
+ if (!empty($response['messages'])) {
228
+ $this->parseRepricingMessages($response['messages']);
229
+ }
230
231
return $this->indexAction();
232
}
273
public function removeProductsAction()
274
{
275
$accountId = $this->getRequest()->getParam('account_id');
276
+ $responseToken = $this->getRequest()->getParam('response_token');
277
278
$model = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId);
279
282
return $this->indexAction();
283
}
284
285
+ /** @var $repricing Ess_M2ePro_Model_Amazon_Repricing */
286
+ $repricing = Mage::getModel('M2ePro/Amazon_Repricing', $model);
287
+
288
+ $response = $repricing->getResponseData($responseToken);
289
+
290
+ if (!empty($response['messages'])) {
291
+ $this->parseRepricingMessages($response['messages']);
292
+ }
293
294
+ if ($response['status'] == '0') {
295
return $this->indexAction();
296
}
297
298
+ if (empty($response['offers'])) {
299
return $this->indexAction();
300
}
301
302
$skus = array();
303
+ foreach ($response['offers'] as $offer) {
304
$skus[] = $offer['sku'];
305
}
306
307
$repricing->setProductRepricingStatusBySku(
308
$skus,
309
Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_NO
app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Order/MerchantFulfillmentController.php CHANGED
@@ -389,12 +389,9 @@ class Ess_M2ePro_Adminhtml_Common_Amazon_Order_MerchantFulfillmentController
389
return $this->getResponse()->setBody('You should create shipment first');
390
}
391
392
- $statusRefundRejected = Ess_M2ePro_Helper_Component_Amazon_MerchantFulfillment::STATUS_REFUND_REJECTED;
393
- $statusRefundApplied = Ess_M2ePro_Helper_Component_Amazon_MerchantFulfillment::STATUS_REFUND_APPLIED;
394
-
395
- if ($orderFulfillmentData['status'] != $statusRefundRejected
396
- || $orderFulfillmentData['status'] != $statusRefundApplied) {
397
- return $this->getResponse()->setBody('Shipment refund status should be Rejected or Applied');
398
}
399
400
$order->addData(array(
389
return $this->getResponse()->setBody('You should create shipment first');
390
}
391
392
+ if ($orderFulfillmentData['status']
393
+ == Ess_M2ePro_Helper_Component_Amazon_MerchantFulfillment::STATUS_PURCHASED) {
394
+ return $this->getResponse()->setBody('Shipment status should not be Purchased');
395
}
396
397
$order->addData(array(
app/code/community/Ess/M2ePro/controllers/Adminhtml/Development/Tools/M2ePro/GeneralController.php CHANGED
@@ -413,11 +413,11 @@ HTML;
413
* @confirm "Are you sure?"
414
* @new_line
415
*/
416
- public function removeConfigDuplicatesAction()
417
{
418
/** @var $installerInstance Ess_M2ePro_Model_Upgrade_MySqlSetup */
419
$installerInstance = new Ess_M2ePro_Model_Upgrade_MySqlSetup('M2ePro_setup');
420
- $installerInstance->removeConfigDuplicates();
421
422
Mage::helper('M2ePro/Module')->clearCache();
423
413
* @confirm "Are you sure?"
414
* @new_line
415
*/
416
+ public function removeConfigsDuplicatesAction()
417
{
418
/** @var $installerInstance Ess_M2ePro_Model_Upgrade_MySqlSetup */
419
$installerInstance = new Ess_M2ePro_Model_Upgrade_MySqlSetup('M2ePro_setup');
420
+ $installerInstance->removeConfigsDuplicates();
421
422
Mage::helper('M2ePro/Module')->clearCache();
423
app/code/community/Ess/M2ePro/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
<config>
3
<modules>
4
<Ess_M2ePro>
5
- <version>6.3.9</version>
6
</Ess_M2ePro>
7
</modules>
8
<default>
2
<config>
3
<modules>
4
<Ess_M2ePro>
5
+ <version>6.4.0</version>
6
</Ess_M2ePro>
7
</modules>
8
<default>
app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.3.9-6.4.0.php ADDED
@@ -0,0 +1,31 @@
1
+ <?php
2
+
3
+ //########################################
4
+
5
+ /** @var $installer Ess_M2ePro_Model_Upgrade_MySqlSetup */
6
+ $installer = $this;
7
+ $installer->startSetup();
8
+
9
+ $connection = $installer->getConnection();
10
+
11
+ //########################################
12
+
13
+ /*
14
+ DELETE FROM `m2epro_synchronization_config`
15
+ WHERE `group` = '/settings/product_change/' AND
16
+ `key` = 'max_count';
17
+
18
+ UPDATE `m2epro_synchronization_config`
19
+ SET `value` = '172800'
20
+ WHERE `group` = '/settings/product_change/' AND
21
+ `key` = 'max_lifetime';
22
+ */
23
+
24
+ $installer->getSynchConfigModifier()->getEntity('/settings/product_change/', 'max_count')->delete();
25
+ $installer->getSynchConfigModifier()->getEntity('/settings/product_change/', 'max_lifetime')->updateValue('172800');
26
+
27
+ //########################################
28
+
29
+ $installer->endSetup();
30
+
31
+ //########################################
app/design/adminhtml/default/default/template/M2ePro/common/amazon/account/tabs/listing_other.phtml CHANGED
@@ -194,7 +194,7 @@
194
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
195
<?php foreach ($this->attributes as $attribute) { ?>
196
<option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>>
197
- <?php echo Mage::helper('M2ePro')->__($attribute['label']) ?>
198
</option>
199
<?php } ?>
200
</optgroup>
@@ -225,7 +225,7 @@
225
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
226
<?php foreach ($this->attributes as $attribute) { ?>
227
<option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_CUSTOM_ATTRIBUTE?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>>
228
- <?php echo Mage::helper('M2ePro')->__($attribute['label']) ?>
229
</option>
230
<?php } ?>
231
</optgroup>
@@ -257,7 +257,7 @@
257
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
258
<?php foreach ($this->attributes as $attribute) { ?>
259
<option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>>
260
- <?php echo Mage::helper('M2ePro')->__($attribute['label']) ?>
261
</option>
262
<?php } ?>
263
</optgroup>
194
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
195
<?php foreach ($this->attributes as $attribute) { ?>
196
<option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>>
197
+ <?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
198
</option>
199
<?php } ?>
200
</optgroup>
225
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
226
<?php foreach ($this->attributes as $attribute) { ?>
227
<option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_CUSTOM_ATTRIBUTE?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>>
228
+ <?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
229
</option>
230
<?php } ?>
231
</optgroup>
257
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
258
<?php foreach ($this->attributes as $attribute) { ?>
259
<option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>>
260
+ <?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
261
</option>
262
<?php } ?>
263
</optgroup>
app/design/adminhtml/default/default/template/M2ePro/common/amazon/account/tabs/repricing.phtml CHANGED
@@ -37,7 +37,7 @@
37
It will <strong>review</strong> your Competitors\' pricing and <strong>change</strong> your Product prices accordingly.<br/><br/>
38
39
To start working with the Tool you should Add the information about your M2E Pro Amazon Account to the Repricing Service and Link it
40
- by clicking on the Button <strong>Link or Register Now</strong>. Futher, you will need to complete the Wizard which allows
41
Setting Up all necessary data.<br/><br/>
42
43
After your Account is successfully Linked, you will be able to review the information about the Products which are automatically
@@ -61,34 +61,31 @@
61
<div class="hor-scroll">
62
63
<table class="form-list" cellspacing="0" cellpadding="0">
64
-
65
<tr>
66
<td class="label">
67
- <label><?php echo Mage::helper('M2ePro')->__('Account'); ?>:</label>
68
</td>
69
<td class="value" style="width: auto;">
70
- <?php if (!$this->isRepricingLinked) { ?>
71
- <?php echo Mage::helper('M2ePro')->__('Not Set'); ?>&nbsp;
72
- <button type="button" onclick="AmazonAccountHandlerObj.linkOrRegisterRepricing()"><?php echo Mage::helper('M2ePro')->__('Link of Register Now'); ?></button>
73
- <?php } else { ?>
74
- <?php echo $this->repricingData['email']; ?>&nbsp;
75
- [ <a href="javascript:void(0)" onclick="AmazonAccountHandlerObj.unlinkRepricing()"><?php echo Mage::helper('M2ePro')->__('unlink'); ?></a> ]
76
- <br/>
77
- <a href="javascript:void(0)" onclick="AmazonAccountHandlerObj.openManagement()"><?php echo Mage::helper('M2ePro')->__('Go to Manager Tool'); ?></a>
78
-
79
- <div id="repricing_unlink_popup" style="display: none">
80
- <div style="margin: 10px 0;">
81
- <p><?php echo Mage::helper('M2ePro')->__('Are you sure?'); ?></p>
82
- </div>
83
- <div style="text-align: right; margin: 10px 0;">
84
- <button type="button" onclick="AmazonAccountHandlerObj.openUnlinkPage()"><?php echo Mage::helper('M2ePro')->__('Yes'); ?></button>
85
- &nbsp;&nbsp;
86
- <button type="button" onclick="Windows.getFocusedWindow().close()"><?php echo Mage::helper('M2ePro')->__('No'); ?></button>
87
- </div>
88
- </div>
89
- <?php } ?>
90
</td>
91
</tr>
92
93
</table>
94
@@ -111,7 +108,7 @@
111
112
<tr>
113
<td class="label">
114
- <label><?php echo Mage::helper('M2ePro')->__('Total Products'); ?>:</label>
115
</td>
116
<td class="value" style="width: auto;">
117
<span id="repricing_total_products"><?php echo $this->repricingData['info']['total_products']?></span>
@@ -137,7 +134,7 @@
137
<td class="label">
138
</td>
139
<td class="value" style="width: auto;">
140
- <button type="button" onclick="AmazonAccountHandlerObj.synchRepricing()"><?php echo Mage::helper('M2ePro')->__('Synchronize'); ?></button>
141
<p class="note">
142
<span><?php echo Mage::helper('M2ePro')->__('
143
This Option allows you to <strong>Synchronize</strong> M2E Pro and Repricer Inventory. For example, if you manually
37
It will <strong>review</strong> your Competitors\' pricing and <strong>change</strong> your Product prices accordingly.<br/><br/>
38
39
To start working with the Tool you should Add the information about your M2E Pro Amazon Account to the Repricing Service and Link it
40
+ by clicking on the Button <strong>Link Now</strong>. Futher, you will need to complete the Wizard which allows
41
Setting Up all necessary data.<br/><br/>
42
43
After your Account is successfully Linked, you will be able to review the information about the Products which are automatically
61
<div class="hor-scroll">
62
63
<table class="form-list" cellspacing="0" cellpadding="0">
64
+ <?php if (!$this->isRepricingLinked) { ?>
65
+ <tr>
66
+ <td class="value" style="width: auto;">
67
+ <?php echo Mage::helper('M2ePro')->__('First, you have to link this Amazon Account with Amazon Repricing Tool'); ?>&nbsp;
68
+ <button type="button" onclick="AmazonAccountHandlerObj.linkOrRegisterRepricing()"><?php echo Mage::helper('M2ePro')->__('Link Now'); ?></button>
69
+ </td>
70
+ </tr>
71
+ <?php } else { ?>
72
+ <tr>
73
+ <td class="label" colspan="2" style="width: 100%;">
74
+ <?php echo Mage::helper('M2ePro')->__('This Amazon Account is successfully linked with Amazon Repricing Tool'); ?>&nbsp;
75
+ <button type="button" onclick="AmazonAccountHandlerObj.unlinkRepricing()"><?php echo Mage::helper('M2ePro')->__('Unlink'); ?></button>
76
+ </td>
77
+ </tr>
78
<tr>
79
<td class="label">
80
+ <label><?php echo Mage::helper('M2ePro')->__('Customer'); ?>:</label>
81
</td>
82
<td class="value" style="width: auto;">
83
+ <?php echo $this->repricingData['email']; ?>&nbsp;
84
+ <br/>
85
+ <a href="javascript:void(0)" onclick="AmazonAccountHandlerObj.openManagement()"><?php echo Mage::helper('M2ePro')->__('Go to Amazon Repricing Tool'); ?></a>
86
</td>
87
</tr>
88
+ <?php } ?>
89
90
</table>
91
108
109
<tr>
110
<td class="label">
111
+ <label><?php echo Mage::helper('M2ePro')->__('Repricing Products'); ?>:</label>
112
</td>
113
<td class="value" style="width: auto;">
114
<span id="repricing_total_products"><?php echo $this->repricingData['info']['total_products']?></span>
134
<td class="label">
135
</td>
136
<td class="value" style="width: auto;">
137
+ <button type="button" onclick="AmazonAccountHandlerObj.synchRepricing()"><?php echo Mage::helper('M2ePro')->__('Synchronize Now'); ?></button>
138
<p class="note">
139
<span><?php echo Mage::helper('M2ePro')->__('
140
This Option allows you to <strong>Synchronize</strong> M2E Pro and Repricer Inventory. For example, if you manually
app/design/adminhtml/default/default/template/M2ePro/common/amazon/listing/variation/product/manage/tabs/settings.phtml CHANGED
@@ -76,7 +76,7 @@
76
77
<?php } elseif (!$this->hasGeneralId() && $this->isGeneralIdOwner()) { ?>
78
79
- <p><?php echo Mage::helper('M2ePro')->__('New Amazon Parent Product will be created based on %desctemplate% Description Policy.<br />You will be able to create New Amazon Child Products.', $this->getDescriptionTemplateLink())?></p>
80
81
<?php } ?>
82
76
77
<?php } elseif (!$this->hasGeneralId() && $this->isGeneralIdOwner()) { ?>
78
79
+ <p><?php echo Mage::helper('M2ePro')->__('New Amazon Parent Product will be created based on %desctemplate% Description Policy.<br/> You will be able to create New Amazon Child Products.', $this->getDescriptionTemplateLink())?></p>
80
81
<?php } ?>
82
app/design/adminhtml/default/default/template/M2ePro/common/amazon/order/merchant_fulfillment/configuration.phtml CHANGED
@@ -198,12 +198,12 @@
198
</td>
199
<td class="value">
200
<input id="fulfillment_general_declared_value" name="declared_value" value="<?php echo $formData['declared_value']; ?>" type="text" class="input-text validate-greater-than-zero" />
201
- <p class="note note-no-tool-tip">
202
- <span style="color: grey;">[<?php echo $this->getData('order_currency'); ?>]</span>
203
- </p>
204
<p class="note">
205
<span><?php echo Mage::helper('M2ePro')->__('Based on this Value, the Carrier will determine for how much to insure the Shipment. By default, this Value is calculated as a subtotal of all of the purchased Items.'); ?></span>
206
</p>
207
</td>
208
</tr>
209
</table>
198
</td>
199
<td class="value">
200
<input id="fulfillment_general_declared_value" name="declared_value" value="<?php echo $formData['declared_value']; ?>" type="text" class="input-text validate-greater-than-zero" />
201
<p class="note">
202
<span><?php echo Mage::helper('M2ePro')->__('Based on this Value, the Carrier will determine for how much to insure the Shipment. By default, this Value is calculated as a subtotal of all of the purchased Items.'); ?></span>
203
</p>
204
+ <p class="note note-no-tool-tip">
205
+ <span style="color: grey;">[<?php echo $this->getData('order_currency'); ?>]</span>
206
+ </p>
207
</td>
208
</tr>
209
</table>
app/design/adminhtml/default/default/template/M2ePro/common/amazon/order/merchant_fulfillment/magento/shipment.phtml CHANGED
@@ -50,7 +50,9 @@
50
') ?>
51
</div>
52
<div style="text-align: right; margin: 10px 0;">
53
- <button style="margin-left: 10px;" onclick="setLocation('<?php echo $this->getUrl('M2ePro/adminhtml_common_amazon_order/view', array('id' => $this->getOrder()->getId(), 'show_merchant_fulfillment' => 1)) ?>')">Amazon's Shipping Services</button>
54
</div>
55
</div>
56
@@ -70,8 +72,12 @@
70
</div>
71
<div style="margin: 10px 0;">
72
<a href="javascript:void(0)" onclick="orderMerchantFulfillmentMagentoHandlerObj.discardNotificationPopup()"><?php echo Mage::helper('M2ePro')->__('Don\'t show anymore'); ?></a>
73
- <button style="float: right;" onclick="setLocation('<?php echo $this->getUrl('M2ePro/adminhtml_common_amazon_order/view', array('id' => $this->getOrder()->getId(), 'show_merchant_fulfillment' => 1)) ?>')">Amazon's Shipping Services</button>
74
- <a href="javascript:void(0)" onclick="Windows.getFocusedWindow().close()" style="float: right;margin-right: 15px;">Cancel</a>
75
</div>
76
</div>
77
50
') ?>
51
</div>
52
<div style="text-align: right; margin: 10px 0;">
53
+ <button style="margin-left: 10px;" onclick="setLocation('<?php echo $this->getUrl('M2ePro/adminhtml_common_amazon_order/view', array('id' => $this->getOrder()->getId(), 'show_merchant_fulfillment' => 1)) ?>')">
54
+ <?php echo Mage::helper('M2ePro')->__('Amazon\'s Shipping Services'); ?>
55
+ </button>
56
</div>
57
</div>
58
72
</div>
73
<div style="margin: 10px 0;">
74
<a href="javascript:void(0)" onclick="orderMerchantFulfillmentMagentoHandlerObj.discardNotificationPopup()"><?php echo Mage::helper('M2ePro')->__('Don\'t show anymore'); ?></a>
75
+ <button style="float: right;" onclick="setLocation('<?php echo $this->getUrl('M2ePro/adminhtml_common_amazon_order/view', array('id' => $this->getOrder()->getId(), 'show_merchant_fulfillment' => 1)) ?>')">
76
+ <?php echo Mage::helper('M2ePro')->__('Amazon\'s Shipping Services'); ?>
77
+ </button>
78
+ <a href="javascript:void(0)" onclick="Windows.getFocusedWindow().close()" style="float: right;margin-right: 15px;">
79
+ <?php echo Mage::helper('M2ePro')->__('Cancel'); ?>
80
+ </a>
81
</div>
82
</div>
83
app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/description/tabs/definition.phtml CHANGED
@@ -491,7 +491,7 @@ $allAttributesByInputTypes = array(
491
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
492
<?php if ($formData['definition']['item_package_quantity_custom_attribute'] != '' && !$magentoAttributeHelper->isExistInAttributesArray($formData['definition']['item_package_quantity_custom_attribute'], $generalAttributesByInputTypes['text_select'])) : ?>
493
<option attribute_code="<?php echo $formData['definition']['item_package_quantity_custom_attribute']; ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Template_Description_Definition::ITEM_PACKAGE_QUANTITY_MODE_CUSTOM_ATTRIBUTE ?>" selected="selected" >
494
- <?php echo $magentoAttributeHelper->getAttributeLabel($formData['definition']['item_package_quantity_custom_attribute']); ?>
495
</option>
496
<?php endif; ?>
497
<?php foreach($generalAttributesByInputTypes['text_select'] as $attribute) : ?>
@@ -532,7 +532,7 @@ $allAttributesByInputTypes = array(
532
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
533
<?php if ($formData['definition']['number_of_items_custom_attribute'] != '' && !$magentoAttributeHelper->isExistInAttributesArray($formData['definition']['number_of_items_custom_attribute'], $generalAttributesByInputTypes['text_select'])) : ?>
534
<option attribute_code="<?php echo $formData['definition']['number_of_items_custom_attribute']; ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Template_Description_Definition::NUMBER_OF_ITEMS_MODE_CUSTOM_ATTRIBUTE ?>" selected="selected" >
535
- <?php echo $magentoAttributeHelper->getAttributeLabel($formData['definition']['number_of_items_custom_attribute']); ?>
536
</option>
537
<?php endif; ?>
538
<?php foreach($generalAttributesByInputTypes['text_select'] as $attribute) : ?>
491
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
492
<?php if ($formData['definition']['item_package_quantity_custom_attribute'] != '' && !$magentoAttributeHelper->isExistInAttributesArray($formData['definition']['item_package_quantity_custom_attribute'], $generalAttributesByInputTypes['text_select'])) : ?>
493
<option attribute_code="<?php echo $formData['definition']['item_package_quantity_custom_attribute']; ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Template_Description_Definition::ITEM_PACKAGE_QUANTITY_MODE_CUSTOM_ATTRIBUTE ?>" selected="selected" >
494
+ <?php echo Mage::helper('M2ePro')->escapeHtml($magentoAttributeHelper->getAttributeLabel($formData['definition']['item_package_quantity_custom_attribute'])); ?>
495
</option>
496
<?php endif; ?>
497
<?php foreach($generalAttributesByInputTypes['text_select'] as $attribute) : ?>
532
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
533
<?php if ($formData['definition']['number_of_items_custom_attribute'] != '' && !$magentoAttributeHelper->isExistInAttributesArray($formData['definition']['number_of_items_custom_attribute'], $generalAttributesByInputTypes['text_select'])) : ?>
534
<option attribute_code="<?php echo $formData['definition']['number_of_items_custom_attribute']; ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Template_Description_Definition::NUMBER_OF_ITEMS_MODE_CUSTOM_ATTRIBUTE ?>" selected="selected" >
535
+ <?php echo Mage::helper('M2ePro')->escapeHtml($magentoAttributeHelper->getAttributeLabel($formData['definition']['number_of_items_custom_attribute'])); ?>
536
</option>
537
<?php endif; ?>
538
<?php foreach($generalAttributesByInputTypes['text_select'] as $attribute) : ?>
app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/description/tabs/general.phtml CHANGED
@@ -363,7 +363,7 @@
363
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
364
<?php if ($formData['general']['worldwide_id_custom_attribute'] != '' && !$magentoAttributeHelper->isExistInAttributesArray($formData['general']['worldwide_id_custom_attribute'], $generalAttributesByInputTypes['text'])) : ?>
365
<option attribute_code="<?php echo $formData['general']['worldwide_id_custom_attribute']; ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Template_Description::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE ?>" selected="selected">
366
- <?php echo $magentoAttributeHelper->getAttributeLabel($formData['general']['worldwide_id_custom_attribute']); ?>
367
</option>
368
<?php endif; ?>
369
<?php foreach($generalAttributesByInputTypes['text'] as $attribute) : ?>
363
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
364
<?php if ($formData['general']['worldwide_id_custom_attribute'] != '' && !$magentoAttributeHelper->isExistInAttributesArray($formData['general']['worldwide_id_custom_attribute'], $generalAttributesByInputTypes['text'])) : ?>
365
<option attribute_code="<?php echo $formData['general']['worldwide_id_custom_attribute']; ?>" value="<?php echo Ess_M2ePro_Model_Amazon_Template_Description::WORLDWIDE_ID_MODE_CUSTOM_ATTRIBUTE ?>" selected="selected">
366
+ <?php echo Mage::helper('M2ePro')->escapeHtml($magentoAttributeHelper->getAttributeLabel($formData['general']['worldwide_id_custom_attribute'])); ?>
367
</option>
368
<?php endif; ?>
369
<?php foreach($generalAttributesByInputTypes['text'] as $attribute) : ?>
app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/selling_format/form.phtml CHANGED
@@ -266,7 +266,7 @@
266
<option id="qty_mode_cv" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER == $formData['qty_mode']) echo ' selected="selected"'; ?>><?php echo Mage::helper('M2ePro')->__('Custom Value'); ?></option>
267
268
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute" new_option_value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>">
269
- <option value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED == $formData['qty_mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('QTY'); ?></option>
270
<?php foreach($attributesByInputTypes['text'] as $attribute) : ?>
271
<option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>" <?php if ($formData['qty_mode'] == Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE && $attribute['code'] == $formData['qty_custom_attribute']): ?>selected="selected"<?php endif; ?>>
272
<?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
266
<option id="qty_mode_cv" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER == $formData['qty_mode']) echo ' selected="selected"'; ?>><?php echo Mage::helper('M2ePro')->__('Custom Value'); ?></option>
267
268
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute" new_option_value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>">
269
+ <option value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED == $formData['qty_mode']): echo ' selected="selected"'; endif; ?>>QTY</option>
270
<?php foreach($attributesByInputTypes['text'] as $attribute) : ?>
271
<option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>" <?php if ($formData['qty_mode'] == Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE && $attribute['code'] == $formData['qty_custom_attribute']): ?>selected="selected"<?php endif; ?>>
272
<?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
app/design/adminhtml/default/default/template/M2ePro/common/amazon/template/shippingOverride/form.phtml CHANGED
@@ -241,7 +241,7 @@
241
<select name="shipping_override_rule[cost_value][%i%]" class="required-entry shipping-override-cost-custom-attribute" disabled="disabled" style="width: 155px; display: none;">
242
<option value="" class="empty"></option>
243
<?php foreach ($this->getAttributes() as $attribute) { ?>
244
- <option value="<?php echo $attribute['code'] ?>"><?php echo $attribute['label']; ?></option>
245
<?php } ?>
246
</select>
247
</td>
241
<select name="shipping_override_rule[cost_value][%i%]" class="required-entry shipping-override-cost-custom-attribute" disabled="disabled" style="width: 155px; display: none;">
242
<option value="" class="empty"></option>
243
<?php foreach ($this->getAttributes() as $attribute) { ?>
244
+ <option value="<?php echo $attribute['code'] ?>"><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
245
<?php } ?>
246
</select>
247
</td>
app/design/adminhtml/default/default/template/M2ePro/common/buy/account/tabs/listing_other.phtml CHANGED
@@ -181,7 +181,7 @@ $isEdit = !!$this->getRequest()->getParam('id');
181
182
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
183
<?php foreach ($this->attributes as $attribute) { ?>
184
- <option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Buy_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE ?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
185
<?php } ?>
186
</optgroup>
187
</select>
@@ -210,7 +210,7 @@ $isEdit = !!$this->getRequest()->getParam('id');
210
211
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
212
<?php foreach ($this->attributes as $attribute) { ?>
213
- <option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Buy_Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_CUSTOM_ATTRIBUTE ?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
214
<?php } ?>
215
</optgroup>
216
</select>
181
182
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
183
<?php foreach ($this->attributes as $attribute) { ?>
184
+ <option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Buy_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE ?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
185
<?php } ?>
186
</optgroup>
187
</select>
210
211
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute">
212
<?php foreach ($this->attributes as $attribute) { ?>
213
+ <option attribute_code="<?php echo $attribute['code'] ?>" value="<?php echo Ess_M2ePro_Model_Buy_Account::OTHER_LISTINGS_MAPPING_GENERAL_ID_MODE_CUSTOM_ATTRIBUTE ?>" <?php if ($tempAttributeValue == $attribute['code']) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
214
<?php } ?>
215
</optgroup>
216
</select>
app/design/adminhtml/default/default/template/M2ePro/common/buy/template/selling_format/form.phtml CHANGED
@@ -213,7 +213,7 @@ $isEdit = !!$this->getRequest()->getParam('id');
213
<option id="qty_mode_cv" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER == $formData['qty_mode']) echo ' selected="selected"'; ?>><?php echo Mage::helper('M2ePro')->__('Custom Value'); ?></option>
214
215
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute" new_option_value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>">
216
- <option value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED == $formData['qty_mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('QTY'); ?></option>
217
<?php foreach($attributesByInputTypes['text'] as $attribute) : ?>
218
<option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>" <?php if ($formData['qty_mode'] == Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE && $attribute['code'] == $formData['qty_custom_attribute']): ?>selected="selected"<?php endif; ?>>
219
<?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
213
<option id="qty_mode_cv" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_NUMBER == $formData['qty_mode']) echo ' selected="selected"'; ?>><?php echo Mage::helper('M2ePro')->__('Custom Value'); ?></option>
214
215
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attribute" new_option_value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>">
216
+ <option value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED; ?>" <?php if (Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_PRODUCT_FIXED == $formData['qty_mode']): echo ' selected="selected"'; endif; ?>>QTY</option>
217
<?php foreach($attributesByInputTypes['text'] as $attribute) : ?>
218
<option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE; ?>" <?php if ($formData['qty_mode'] == Ess_M2ePro_Model_Template_SellingFormat::QTY_MODE_ATTRIBUTE && $attribute['code'] == $formData['qty_custom_attribute']): ?>selected="selected"<?php endif; ?>>
219
<?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
app/design/adminhtml/default/default/template/M2ePro/ebay/account/tabs/listing_other.phtml CHANGED
@@ -139,7 +139,7 @@
139
<option attribute_code="<?php echo $attribute['code']; ?>"
140
value="<?php echo Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE; ?>"
141
<?php if (isset($mappingSettings['sku']['mode']) && $mappingSettings['sku']['mode'] == Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE && $tempAttributeValue == $attribute['code']) : echo 'selected="selected"'; endif; ?>>
142
- <?php echo Mage::helper('M2ePro')->__($attribute['label']) ?>
143
</option>
144
<?php endforeach; ?>
145
</optgroup>
@@ -175,7 +175,7 @@
175
<option attribute_code="<?php echo $attribute['code']; ?>"
176
value="<?php echo Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE; ?>"
177
<?php if (isset($mappingSettings['title']['mode']) && $mappingSettings['title']['mode'] == Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE && $tempAttributeValue == $attribute['code']) : echo 'selected="selected"'; endif; ?>>
178
- <?php echo Mage::helper('M2ePro')->__($attribute['label']) ?>
179
</option>
180
<?php endforeach; ?>
181
</optgroup>
139
<option attribute_code="<?php echo $attribute['code']; ?>"
140
value="<?php echo Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE; ?>"
141
<?php if (isset($mappingSettings['sku']['mode']) && $mappingSettings['sku']['mode'] == Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_SKU_MODE_CUSTOM_ATTRIBUTE && $tempAttributeValue == $attribute['code']) : echo 'selected="selected"'; endif; ?>>
142
+ <?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
143
</option>
144
<?php endforeach; ?>
145
</optgroup>
175
<option attribute_code="<?php echo $attribute['code']; ?>"
176
value="<?php echo Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE; ?>"
177
<?php if (isset($mappingSettings['title']['mode']) && $mappingSettings['title']['mode'] == Ess_M2ePro_Model_Ebay_Account::OTHER_LISTINGS_MAPPING_TITLE_MODE_CUSTOM_ATTRIBUTE && $tempAttributeValue == $attribute['code']) : echo 'selected="selected"'; endif; ?>>
178
+ <?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
179
</option>
180
<?php endforeach; ?>
181
</optgroup>
app/design/adminhtml/default/default/template/M2ePro/ebay/configuration/general/form.phtml CHANGED
@@ -267,7 +267,7 @@
267
<select id="motors_epids_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="motors_epids_attribute">
268
<option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
269
<?php foreach ($this->attributes_for_motors as $attribute): ?>
270
- <option value="<?php echo $attribute['attribute_code']; ?>"<?php if ($attribute['attribute_code'] == $this->motors_epids_attribute): ?> selected="selected"<?php endif; ?>><?php echo $attribute['frontend_label']; ?></option>
271
<?php endforeach; ?>
272
</select>
273
</td>
@@ -355,7 +355,7 @@
355
<select id="motors_ktypes_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="motors_ktypes_attribute">
356
<option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
357
<?php foreach ($this->attributes_for_motors as $attribute): ?>
358
- <option value="<?php echo $attribute['attribute_code']; ?>"<?php if ($attribute['attribute_code'] == $this->motors_ktypes_attribute): ?> selected="selected"<?php endif; ?>><?php echo $attribute['frontend_label']; ?></option>
359
<?php endforeach; ?>
360
</select>
361
</td>
267
<select id="motors_epids_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="motors_epids_attribute">
268
<option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
269
<?php foreach ($this->attributes_for_motors as $attribute): ?>
270
+ <option value="<?php echo $attribute['attribute_code']; ?>"<?php if ($attribute['attribute_code'] == $this->motors_epids_attribute): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['frontend_label']); ?></option>
271
<?php endforeach; ?>
272
</select>
273
</td>
355
<select id="motors_ktypes_attribute" class="select M2ePro-custom-attribute-can-be-created" allowed_attribute_types="textarea" apply_to_all_attribute_sets="0" name="motors_ktypes_attribute">
356
<option value="">-- <?php echo Mage::helper('M2ePro')->__('Select Attribute'); ?> --</option>
357
<?php foreach ($this->attributes_for_motors as $attribute): ?>
358
+ <option value="<?php echo $attribute['attribute_code']; ?>"<?php if ($attribute['attribute_code'] == $this->motors_ktypes_attribute): ?> selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['frontend_label']); ?></option>
359
<?php endforeach; ?>
360
</select>
361
</td>
app/design/adminhtml/default/default/template/M2ePro/ebay/listing/other/synchronization/tabs/general.phtml CHANGED
@@ -134,9 +134,9 @@
134
<option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT ?>" <?php if ($sourceData['qty'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Product QTY'); ?></option>
135
136
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>" new_option_value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_ATTRIBUTE; ?>">
137
- <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT_FIXED; ?>" <?php if (Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT_FIXED == $sourceData['qty']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('QTY'); ?></option>
138
<?php foreach ($this->attributes as $attribute): ?>
139
- <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['qty'] == $attribute['code'] && $sourceData['qty'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
140
<?php endforeach; ?>
141
</optgroup>
142
</select>
@@ -171,7 +171,7 @@
171
172
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
173
<?php foreach ($this->attributes as $attribute): ?>
174
- <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::PRICE_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['price'] == $attribute['code'] && $sourceData['price'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::PRICE_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
175
<?php endforeach; ?>
176
</optgroup>
177
</select>
@@ -207,7 +207,7 @@
207
208
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
209
<?php foreach ($this->attributes as $attribute): ?>
210
- <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::TITLE_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['title'] == $attribute['code'] && $sourceData['title'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::TITLE_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
211
<?php endforeach; ?>
212
</optgroup>
213
</select>
@@ -241,7 +241,7 @@
241
242
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
243
<?php foreach ($this->attributes as $attribute): ?>
244
- <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::SUB_TITLE_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['sub_title'] == $attribute['code'] && $sourceData['sub_title'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::SUB_TITLE_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
245
<?php endforeach; ?>
246
</optgroup>
247
</select>
@@ -273,7 +273,7 @@
273
274
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
275
<?php foreach ($this->attributes as $attribute): ?>
276
- <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::DESCRIPTION_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['description'] == $attribute['code'] && $sourceData['description'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::DESCRIPTION_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']) ?></option>
277
<?php endforeach; ?>
278
</optgroup>
279
</select>
134
<option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT ?>" <?php if ($sourceData['qty'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Product QTY'); ?></option>
135
136
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>" new_option_value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_ATTRIBUTE; ?>">
137
+ <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT_FIXED; ?>" <?php if (Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_PRODUCT_FIXED == $sourceData['qty']): echo ' selected="selected"'; endif; ?>>QTY</option>
138
<?php foreach ($this->attributes as $attribute): ?>
139
+ <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['qty'] == $attribute['code'] && $sourceData['qty'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::QTY_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
140
<?php endforeach; ?>
141
</optgroup>
142
</select>
171
172
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
173
<?php foreach ($this->attributes as $attribute): ?>
174
+ <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::PRICE_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['price'] == $attribute['code'] && $sourceData['price'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::PRICE_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
175
<?php endforeach; ?>
176
</optgroup>
177
</select>
207
208
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
209
<?php foreach ($this->attributes as $attribute): ?>
210
+ <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::TITLE_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['title'] == $attribute['code'] && $sourceData['title'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::TITLE_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
211
<?php endforeach; ?>
212
</optgroup>
213
</select>
241
242
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
243
<?php foreach ($this->attributes as $attribute): ?>
244
+ <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::SUB_TITLE_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['sub_title'] == $attribute['code'] && $sourceData['sub_title'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::SUB_TITLE_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
245
<?php endforeach; ?>
246
</optgroup>
247
</select>
273
274
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
275
<?php foreach ($this->attributes as $attribute): ?>
276
+ <option value="<?php echo Ess_M2ePro_Model_Ebay_Listing_Other_Source::DESCRIPTION_SOURCE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code'] ?>" <?php if ($attributes['description'] == $attribute['code'] && $sourceData['description'] == Ess_M2ePro_Model_Ebay_Listing_Other_Source::DESCRIPTION_SOURCE_ATTRIBUTE) echo 'selected="selected"' ?>><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
277
<?php endforeach; ?>
278
</optgroup>
279
</select>
app/design/adminhtml/default/default/template/M2ePro/ebay/template/description/form/data.phtml CHANGED
@@ -223,7 +223,7 @@
223
<optgroup class="simple_mode_disallowed M2ePro-custom-attribute-optgroup" label="Magento Attributes">
224
<?php foreach($generalAttributesByTypes['text_select'] as $attribute) : ?>
225
<option class="simple_mode_disallowed" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::CONDITION_MODE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code']; ?>" <?php if ($formData['condition_mode'] == Ess_M2ePro_Model_Ebay_Template_Description::CONDITION_MODE_ATTRIBUTE && $formData['condition_attribute'] == $attribute['code']): ?>selected="selected"<?php endif; ?>>
226
- <?php echo Mage::helper('M2ePro')->__($attribute['label']); ?>
227
</option>
228
<?php endforeach; ?>
229
</optgroup>
@@ -278,7 +278,7 @@
278
<span id="select_attributes_for_condition_note_span" class="select-wrapper">
279
<select id="select_attributes_for_condition_note" class="M2ePro-custom-attribute-can-be-created" style="width: 150px;">
280
<?php foreach($this->attributes as $attribute) : ?>
281
- <option value="<?php echo $attribute['code']; ?>"><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
282
<?php endforeach; ?>
283
</select>
284
</span>
@@ -326,7 +326,7 @@
326
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
327
<?php foreach($generalAttributesByTypes['text_images'] as $attribute) : ?>
328
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::IMAGE_MAIN_MODE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code']; ?>" <?php if ($attribute['code'] == $formData['image_main_attribute'] && $formData['image_main_mode'] == Ess_M2ePro_Model_Ebay_Template_Description::IMAGE_MAIN_MODE_ATTRIBUTE): echo ' selected="selected"'; endif; ?>>
329
- <?php echo Mage::helper('M2ePro')->__($attribute['label']); ?>
330
</option>
331
<?php endforeach; ?>
332
</optgroup>
@@ -403,7 +403,7 @@
403
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
404
<?php foreach($generalAttributesByTypes['text_images'] as $attribute) : ?>
405
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::GALLERY_IMAGES_MODE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code']; ?>" <?php if ($attribute['code'] == $formData['gallery_images_attribute'] && $formData['gallery_images_mode'] == Ess_M2ePro_Model_Ebay_Template_Description::GALLERY_IMAGES_MODE_ATTRIBUTE): echo ' selected="selected"'; endif; ?>>
406
- <?php echo Mage::helper('M2ePro')->__($attribute['label']); ?>
407
</option>
408
<?php endforeach; ?>
409
</optgroup>
@@ -429,7 +429,7 @@
429
<td class="value" style="width: auto;">
430
<select id="variation_configurable_images" name="description[variation_configurable_images][]" multiple="multiple">
431
<?php foreach($this->attributesConfigurable as $attribute) : ?>
432
- <option value="<?php echo $attribute['code']; ?>" <?php if (in_array($attribute['code'], $formData['variation_configurable_images'])): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
433
<?php endforeach; ?>
434
</select>
435
<p class="note">
@@ -470,7 +470,7 @@
470
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
471
<?php foreach($generalAttributesByTypes['text_images'] as $attribute) : ?>
472
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::VARIATION_IMAGES_MODE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code']; ?>" <?php if ($attribute['code'] == $formData['variation_images_attribute'] && $formData['variation_images_mode'] == Ess_M2ePro_Model_Ebay_Template_Description::VARIATION_IMAGES_MODE_ATTRIBUTE): echo ' selected="selected"'; endif; ?>>
473
- <?php echo Mage::helper('M2ePro')->__($attribute['label']); ?>
474
</option>
475
<?php endforeach; ?>
476
</optgroup>
@@ -640,7 +640,7 @@
640
<span id="select_attributes_for_title_span" class="select-wrapper">
641
<select id="select_attributes_for_title" class="M2ePro-custom-attribute-can-be-created" style="width: 150px;" apply_to_all_attribute_sets="0">
642
<?php foreach($this->attributes as $attribute) : ?>
643
- <option value="<?php echo $attribute['code']; ?>"><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
644
<?php endforeach; ?>
645
</select>
646
</span>
@@ -686,7 +686,7 @@
686
<span id="select_attributes_for_subtitle_span" class="select-wrapper">
687
<select id="select_attributes_for_subtitle" class="M2ePro-custom-attribute-can-be-created" style="width: 150px;" apply_to_all_attribute_sets="0">
688
<?php foreach($this->attributes as $attribute) : ?>
689
- <option value="<?php echo $attribute['code']; ?>"><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
690
<?php endforeach; ?>
691
</select>
692
</span>
@@ -878,7 +878,7 @@
878
<span id="select_attributes_span">
879
<select id="select_attributes" class="M2ePro-custom-attribute-can-be-created" style="width: 150px;" apply_to_all_attribute_sets="0">
880
<?php foreach($this->attributes as $attribute) : ?>
881
- <option value="<?php echo $attribute['code']; ?>"><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
882
<?php endforeach; ?>
883
</select>
884
</span>
@@ -1136,7 +1136,7 @@
1136
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY;?>" <?php if (Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY == $formData['product_details']['upc']['mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Does Not Apply'); ?></option>
1137
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
1138
<?php foreach($generalAttributesByTypes['text'] as $attribute) : ?>
1139
- <option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE;?>" <?php if ($formData['product_details']['upc']['attribute'] == $attribute['code'] && Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE == $formData['product_details']['upc']['mode']): ?>selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
1140
<?php endforeach; ?>
1141
</optgroup>
1142
</select>
@@ -1164,7 +1164,7 @@
1164
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY;?>" <?php if (Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY == $formData['product_details']['ean']['mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Does Not Apply'); ?></option>
1165
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
1166
<?php foreach($generalAttributesByTypes['text'] as $attribute) : ?>
1167
- <option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE;?>" <?php if ($formData['product_details']['ean']['attribute'] == $attribute['code'] && Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE == $formData['product_details']['ean']['mode']): ?>selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
1168
<?php endforeach; ?>
1169
</optgroup>
1170
</select>
@@ -1193,7 +1193,7 @@
1193
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY;?>" <?php if (Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY == $formData['product_details']['isbn']['mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Does Not Apply'); ?></option>
1194
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
1195
<?php foreach($generalAttributesByTypes['text'] as $attribute) : ?>
1196
- <option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE;?>" <?php if ($formData['product_details']['isbn']['attribute'] == $attribute['code'] && Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE == $formData['product_details']['isbn']['mode']): ?>selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
1197
<?php endforeach; ?>
1198
</optgroup>
1199
</select>
@@ -1220,7 +1220,7 @@
1220
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_NONE;?>" <?php if (Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_NONE == $formData['product_details']['epid']['mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('None'); ?></option>
1221
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
1222
<?php foreach($generalAttributesByTypes['text'] as $attribute) : ?>
1223
- <option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE;?>" <?php if ($formData['product_details']['epid']['attribute'] == $attribute['code'] && Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE == $formData['product_details']['epid']['mode']): ?>selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
1224
<?php endforeach; ?>
1225
</optgroup>
1226
</select>
@@ -1244,7 +1244,7 @@
1244
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY;?>" <?php if (Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY == $formData['product_details']['brand']['mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Unbranded'); ?></option>
1245
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
1246
<?php foreach($generalAttributesByTypes['text_select'] as $attribute) : ?>
1247
- <option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE;?>" <?php if ($formData['product_details']['brand']['attribute'] == $attribute['code'] && Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE == $formData['product_details']['brand']['mode']): ?>selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
1248
<?php endforeach; ?>
1249
</optgroup>
1250
</select>
@@ -1270,7 +1270,7 @@
1270
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY;?>" <?php if (Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_DOES_NOT_APPLY == $formData['product_details']['mpn']['mode']): echo ' selected="selected"'; endif; ?>><?php echo Mage::helper('M2ePro')->__('Does Not Apply'); ?></option>
1271
<optgroup class="M2ePro-custom-attribute-optgroup" label="Magento Attributes">
1272
<?php foreach($generalAttributesByTypes['text'] as $attribute) : ?>
1273
- <option attribute_code="<?php echo $attribute['code']; ?>" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE;?>" <?php if ($formData['product_details']['mpn']['attribute'] == $attribute['code'] && Ess_M2ePro_Model_Ebay_Template_Description::PRODUCT_DETAILS_MODE_ATTRIBUTE == $formData['product_details']['mpn']['mode']): ?>selected="selected"<?php endif; ?>><?php echo Mage::helper('M2ePro')->__($attribute['label']); ?></option>
1274
<?php endforeach; ?>
1275
</optgroup>
1276
</select>
223
<optgroup class="simple_mode_disallowed M2ePro-custom-attribute-optgroup" label="Magento Attributes">
224
<?php foreach($generalAttributesByTypes['text_select'] as $attribute) : ?>
225
<option class="simple_mode_disallowed" value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::CONDITION_MODE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code']; ?>" <?php if ($formData['condition_mode'] == Ess_M2ePro_Model_Ebay_Template_Description::CONDITION_MODE_ATTRIBUTE && $formData['condition_attribute'] == $attribute['code']): ?>selected="selected"<?php endif; ?>>
226
+ <?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?>
227
</option>
228
<?php endforeach; ?>
229
</optgroup>
278
<span id="select_attributes_for_condition_note_span" class="select-wrapper">
279
<select id="select_attributes_for_condition_note" class="M2ePro-custom-attribute-can-be-created" style="width: 150px;">
280
<?php foreach($this->attributes as $attribute) : ?>
281
+ <option value="<?php echo $attribute['code']; ?>"><?php echo Mage::helper('M2ePro')->escapeHtml($attribute['label']); ?></option>
282
<?php endforeach; ?>
283
</select>
284
</span>
326
<optgroup class="M2ePro-custom-attribute-optgroup" label="<?php echo Mage::helper('M2ePro')->__('Magento Attributes'); ?>">
327
<?php foreach($generalAttributesByTypes['text_images'] as $attribute) : ?>
328
<option value="<?php echo Ess_M2ePro_Model_Ebay_Template_Description::IMAGE_MAIN_MODE_ATTRIBUTE; ?>" attribute_code="<?php echo $attribute['code']; ?>" <?php if ($attribute['code'] == $formData['image_main_attribute'] && $formData['image_main_mode'] == Ess_M2ePro_Model_Ebay_Template_Description::IMAGE_MAIN_MODE_ATTRIBUTE): echo ' selected="selected"'; endif; ?>>
329
+ <?php echo Mage::helper('M2ePro')->e