m2epro_ebay_magento - Version 6.4.7

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 ESSUA
Extension m2epro_ebay_magento
Version 6.4.7
Comparing to
See all releases


Code changes from version 6.4.6.1 to 6.4.7

Files changed (76) hide show
  1. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Account/Edit/Tabs.php +1 -1
  2. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Account/Edit/Tabs/Repricing.php +16 -6
  3. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Grid/Column/Filter/Price.php +1 -1
  4. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Other/View.php +4 -0
  5. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Other/View/Grid.php +24 -11
  6. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Search/Grid.php +102 -23
  7. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Variation/Product/Manage/Tabs/Variations/Grid.php +103 -17
  8. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View.php +4 -0
  9. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View/Amazon/Grid.php +101 -18
  10. app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View/Sellercentral/Grid.php +43 -18
  11. app/code/community/Ess/M2ePro/CHANGELOG +11 -0
  12. app/code/community/Ess/M2ePro/Helper/Component/Amazon.php +0 -5
  13. app/code/community/Ess/M2ePro/Helper/Component/Amazon/Repricing.php +110 -0
  14. app/code/community/Ess/M2ePro/Helper/Module.php +1 -1
  15. app/code/community/Ess/M2ePro/Helper/Module/Database/Structure.php +2 -0
  16. app/code/community/Ess/M2ePro/Helper/Module/License.php +37 -0
  17. app/code/community/Ess/M2ePro/Model/Amazon/Account.php +47 -27
  18. app/code/community/Ess/M2ePro/Model/Amazon/Account/Repricing.php +571 -0
  19. app/code/community/Ess/M2ePro/Model/Amazon/Listing.php +12 -0
  20. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Other.php +18 -0
  21. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Other/Moving.php +11 -0
  22. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product.php +59 -10
  23. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Action/Type/Validator.php +3 -2
  24. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/PriceCalculator.php +14 -0
  25. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Repricing.php +337 -0
  26. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Repricing/PriceCalculator.php +73 -0
  27. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation.php +3 -0
  28. app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Manager/Type/Relation/Parent/Processor/Sub/Selling.php +21 -9
  29. app/code/community/Ess/M2ePro/Model/Amazon/Repricing.php +0 -635
  30. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Abstract.php +57 -0
  31. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Action/Account.php +77 -0
  32. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Action/Product.php +203 -0
  33. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/Abstract.php +54 -0
  34. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/ActualPrice.php +170 -0
  35. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/General.php +620 -0
  36. app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Updating.php +86 -0
  37. app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Defaults.php +0 -1
  38. app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Defaults/UpdateRepricing.php +0 -126
  39. app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Orders/Update.php +11 -3
  40. app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Templates.php +1 -0
  41. app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Templates/Inspector.php +2 -2
  42. app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Templates/Repricing.php +162 -0
  43. app/code/community/Ess/M2ePro/Model/Buy/Listing/Product/PriceCalculator.php +14 -0
  44. app/code/community/Ess/M2ePro/Model/Buy/Listing/Product/Variation.php +1 -0
  45. app/code/community/Ess/M2ePro/Model/Connector/Amazon/Orders/Get/ItemsResponser.php +1 -8
  46. app/code/community/Ess/M2ePro/Model/Cron/Strategy/Abstract.php +4 -0
  47. app/code/community/Ess/M2ePro/Model/Cron/Strategy/Parallel.php +4 -0
  48. app/code/community/Ess/M2ePro/Model/Cron/Task/RepricingInspectProducts.php +132 -0
  49. app/code/community/Ess/M2ePro/Model/Cron/Task/RepricingSynchronizationActualPrice.php +63 -0
  50. app/code/community/Ess/M2ePro/Model/Cron/Task/RepricingSynchronizationGeneral.php +63 -0
  51. app/code/community/Ess/M2ePro/Model/Cron/Task/RepricingUpdateSettings.php +140 -0
  52. app/code/community/Ess/M2ePro/Model/Ebay/Listing/Product/PriceCalculator.php +14 -0
  53. app/code/community/Ess/M2ePro/Model/Ebay/Listing/Product/Variation.php +1 -0
  54. app/code/community/Ess/M2ePro/Model/Listing/Product/PriceCalculator.php +37 -2
  55. app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Account/Repricing.php +64 -0
  56. app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Account/Repricing/Collection.php +21 -0
  57. app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Other.php +47 -0
  58. app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product.php +33 -0
  59. app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product/Repricing.php +81 -0
  60. app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product/Repricing/Collection.php +21 -0
  61. app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Account/RepricingController.php +80 -82
  62. app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/AccountController.php +18 -0
  63. app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php +212 -90
  64. app/code/community/Ess/M2ePro/etc/config.xml +8 -1
  65. app/code/community/Ess/M2ePro/sql/M2ePro_setup/{mysql4-install-6.4.6.php → mysql4-install-6.4.7.php} +91 -12
  66. app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.4.6.1-6.4.7.php +255 -0
  67. app/design/adminhtml/default/default/template/M2ePro/common/amazon/account/tabs/general.phtml +4 -1
  68. app/design/adminhtml/default/default/template/M2ePro/common/amazon/account/tabs/repricing.phtml +407 -20
  69. js/M2ePro/Common/Amazon/AccountHandler.js +174 -20
  70. js/M2ePro/Common/Amazon/Listing/RepricingHandler.js +13 -15
  71. package.xml +5 -5
  72. skin/adminhtml/default/default/M2ePro/images/money.png +0 -0
  73. skin/adminhtml/default/default/M2ePro/images/money_disabled.png +0 -0
  74. skin/adminhtml/default/default/M2ePro/images/money_mixed.png +0 -0
  75. skin/adminhtml/default/enterprise/M2ePro/images/money_disabled.png +0 -0
  76. skin/adminhtml/default/enterprise/M2ePro/images/money_mixed.png +0 -0
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Account/Edit/Tabs.php CHANGED
@@ -46,7 +46,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Account_Edit_Tabs extends Mage_Ad
46
->createBlock('M2ePro/adminhtml_common_amazon_account_edit_tabs_order')->toHtml(),
47
));
48
49
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() &&
50
Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getId()) {
51
52
$this->addTab('repricing', array(
46
->createBlock('M2ePro/adminhtml_common_amazon_account_edit_tabs_order')->toHtml(),
47
));
48
49
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() &&
50
Mage::helper('M2ePro/Data_Global')->getValue('temp_data')->getId()) {
51
52
$this->addTab('repricing', array(
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Account/Edit/Tabs/Repricing.php CHANGED
@@ -8,6 +8,14 @@
8
9
class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Account_Edit_Tabs_Repricing extends Mage_Adminhtml_Block_Widget
10
{
11
//########################################
12
13
public function __construct()
@@ -32,23 +40,25 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Account_Edit_Tabs_Repricing exten
32
/** @var $accountObj Ess_M2ePro_Model_Account */
33
$accountObj = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
34
35
- $this->isRepricingLinked = $accountObj->getChildObject()->isRepricingLinked();
36
37
if ($this->isRepricingLinked) {
38
- $this->repricingData = $accountObj->getChildObject()->getRepricing();
39
40
/** @var Ess_M2ePro_Model_Mysql4_Amazon_Listing_Product_Collection $collection */
41
$collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
42
43
- $collection->getSelect()
44
- ->join(array('l' => Mage::getResourceModel('M2ePro/Listing')->getMainTable()),
45
- '(`l`.`id` = `main_table`.`listing_id`)', array());
46
47
$collection->getSelect()->where("`second_table`.`is_variation_parent` = 0");
48
$collection->getSelect()->where("`second_table`.`is_repricing` = 1");
49
$collection->getSelect()->where("`l`.`account_id` = ?", $accountObj->getId());
50
51
- $this->m2eproRepricingProducts = $collection->count();
52
}
53
}
54
8
9
class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Account_Edit_Tabs_Repricing extends Mage_Adminhtml_Block_Widget
10
{
11
+ public $isRepricingLinked;
12
+ public $m2eProRepricingProducts;
13
+
14
+ /**
15
+ * @var Ess_M2ePro_Model_Amazon_Account_Repricing
16
+ */
17
+ public $repricingObj;
18
+
19
//########################################
20
21
public function __construct()
40
/** @var $accountObj Ess_M2ePro_Model_Account */
41
$accountObj = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
42
43
+ $this->isRepricingLinked = $accountObj->getChildObject()->isRepricing();
44
45
if ($this->isRepricingLinked) {
46
+ $this->repricingObj = $accountObj->getChildObject()->getRepricing();
47
48
/** @var Ess_M2ePro_Model_Mysql4_Amazon_Listing_Product_Collection $collection */
49
$collection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
50
51
+ $collection->getSelect()->join(
52
+ array('l' => Mage::getResourceModel('M2ePro/Listing')->getMainTable()),
53
+ '(`l`.`id` = `main_table`.`listing_id`)',
54
+ array()
55
+ );
56
57
$collection->getSelect()->where("`second_table`.`is_variation_parent` = 0");
58
$collection->getSelect()->where("`second_table`.`is_repricing` = 1");
59
$collection->getSelect()->where("`l`.`account_id` = ?", $accountObj->getId());
60
61
+ $this->m2eProRepricingProducts = $collection->count();
62
}
63
}
64
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Grid/Column/Filter/Price.php CHANGED
@@ -17,7 +17,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Grid_Column_Filter_Price
17
18
return parent::getHtml() .
19
'<div class="range"><div class="range-line" style="width: auto;"><span class="label" style="width: auto;">'.
20
- Mage::helper('M2ePro')->__('Repricing ON') . ': </span>' .
21
'<input style="margin-left:6px;float:none;width:auto !important;" type="checkbox" value="1" name="'.
22
$this->_getHtmlName() . '[is_repricing]" ' . $afnChecked . '></div></div>';
23
}
17
18
return parent::getHtml() .
19
'<div class="range"><div class="range-line" style="width: auto;"><span class="label" style="width: auto;">'.
20
+ Mage::helper('M2ePro')->__('Repricing') . ': </span>' .
21
'<input style="margin-left:6px;float:none;width:auto !important;" type="checkbox" value="1" name="'.
22
$this->_getHtmlName() . '[is_repricing]" ' . $afnChecked . '></div></div>';
23
}
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Other/View.php CHANGED
@@ -99,6 +99,9 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Other_View extends Mage_A
99
$unmappingProductsUrl = $this->getUrl('*/adminhtml_listing_other_mapping/unmapping');
100
101
$getAFNQtyBySku = $this->getUrl('*/adminhtml_common_amazon_listing/getAFNQtyBySku');
102
103
$someProductsWereNotMappedMessage = 'No matches were found. Please change the Mapping Attributes in <strong>';
104
$someProductsWereNotMappedMessage .= 'Configuration > Account > 3rd Party Listings</strong> ';
@@ -203,6 +206,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Other_View extends Mage_A
203
M2eProAmazon.url.unmappingProducts = '{$unmappingProductsUrl}';
204
205
M2ePro.url.getAFNQtyBySku = '{$getAFNQtyBySku}';
206
207
M2eProAmazon.text.create_listing = '{$createListing}';
208
M2eProAmazon.text.popup_title = '{$popupTitle}';
99
$unmappingProductsUrl = $this->getUrl('*/adminhtml_listing_other_mapping/unmapping');
100
101
$getAFNQtyBySku = $this->getUrl('*/adminhtml_common_amazon_listing/getAFNQtyBySku');
102
+ $getUpdatedRepricingPriceBySkus = $this->getUrl(
103
+ '*/adminhtml_common_amazon_listing_repricing/getUpdatedPriceBySkus'
104
+ );
105
106
$someProductsWereNotMappedMessage = 'No matches were found. Please change the Mapping Attributes in <strong>';
107
$someProductsWereNotMappedMessage .= 'Configuration > Account > 3rd Party Listings</strong> ';
206
M2eProAmazon.url.unmappingProducts = '{$unmappingProductsUrl}';
207
208
M2ePro.url.getAFNQtyBySku = '{$getAFNQtyBySku}';
209
+ M2ePro.url.getUpdatedRepricingPriceBySkus = '{$getUpdatedRepricingPriceBySkus}';
210
211
M2eProAmazon.text.create_listing = '{$createListing}';
212
M2eProAmazon.text.popup_title = '{$popupTitle}';
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Other/View/Grid.php CHANGED
@@ -123,7 +123,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Other_View_Grid extends M
123
'filter_condition_callback' => array($this, 'callbackFilterPrice')
124
);
125
126
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled()) {
127
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
128
}
129
@@ -281,7 +281,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Other_View_Grid extends M
281
if (is_null($value)) {
282
$value = '<i style="color:gray;">receiving...</i>';
283
} else {
284
- $value = '<span>' . Mage::helper('M2ePro')->escapeHtml($value) . '</span>';
285
}
286
287
$tempSku = $row->getData('sku');
@@ -341,20 +341,33 @@ HTML;
341
342
public function callbackColumnPrice($value, $row, $column, $isExport)
343
{
344
- $html ='';
345
346
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() &&
347
- (int)$row->getData('is_repricing') === Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES) {
348
$text = Mage::helper('M2ePro')->__(
349
- 'This product is used by Amazon Repricing Tool.
350
- The Price cannot be updated through the M2E Pro.'
351
);
352
353
$html = <<<HTML
354
- <span style="float:right; text-align: left;">
355
<img class="tool-tip-image"
356
style="vertical-align: middle; width: 16px;"
357
- src="{$this->getSkinUrl('M2ePro/images/money.png')}">
358
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
359
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
360
<span>{$text}</span>
@@ -471,11 +484,11 @@ HTML;
471
$where .= 'online_price <= ' . $value['to'];
472
}
473
474
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() && !empty($value['is_repricing'])) {
475
if (!empty($where)) {
476
$where = '(' . $where . ') OR ';
477
}
478
- $where .= 'is_repricing = ' . Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES;
479
}
480
481
$collection->getSelect()->where($where);
123
'filter_condition_callback' => array($this, 'callbackFilterPrice')
124
);
125
126
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled()) {
127
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
128
}
129
281
if (is_null($value)) {
282
$value = '<i style="color:gray;">receiving...</i>';
283
} else {
284
+ $value = '<span>' .Mage::helper('M2ePro')->escapeHtml($value). '</span>';
285
}
286
287
$tempSku = $row->getData('sku');
341
342
public function callbackColumnPrice($value, $row, $column, $isExport)
343
{
344
+ $html = '';
345
346
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() &&
347
+ (int)$row->getData('is_repricing') == 1) {
348
+
349
+ $image = 'money';
350
$text = Mage::helper('M2ePro')->__(
351
+ 'This Product is used by Amazon Repricing Tool, so its Price cannot be managed via M2E Pro. <br>
352
+ <strong>Please note</strong> that the Price value(s) shown in the grid might
353
+ be different from the actual one from Amazon. It is caused by the delay
354
+ in the values updating made via the Repricing Service'
355
);
356
357
+ if ((int)$row->getData('is_repricing_disabled') == 1) {
358
+ $image = 'money_disabled';
359
+ $text = Mage::helper('M2ePro')->__(
360
+ 'This product is disabled on Amazon Repricing Tool. <br>
361
+ You can map it to Magento Product and Move into M2E Pro Listing to make the
362
+ Price being updated via M2E Pro.'
363
+ );
364
+ }
365
+
366
$html = <<<HTML
367
+ <span style="float:right; text-align: left;">&nbsp;
368
<img class="tool-tip-image"
369
style="vertical-align: middle; width: 16px;"
370
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
371
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
372
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
373
<span>{$text}</span>
484
$where .= 'online_price <= ' . $value['to'];
485
}
486
487
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && !empty($value['is_repricing'])) {
488
if (!empty($where)) {
489
$where = '(' . $where . ') OR ';
490
}
491
+ $where .= 'is_repricing = 1';
492
}
493
494
$collection->getSelect()->where($where);
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Search/Grid.php CHANGED
@@ -40,6 +40,11 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
40
->join(array('l'=>Mage::getResourceModel('M2ePro/Listing')->getMainTable()),
41
'(`l`.`id` = `main_table`.`listing_id`)',
42
array('listing_title'=>'title','store_id','marketplace_id'))
43
->join(array('al'=>Mage::getResourceModel('M2ePro/Amazon_Listing')->getMainTable()),
44
'(`al`.`listing_id` = `l`.`id`)',
45
array('template_selling_format_id'));
@@ -130,7 +135,9 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
130
`second_table`.`online_price`
131
),
132
`t`.`variation_max_price`
133
- )'
134
)
135
);
136
$listingProductCollection->getSelect()->joinLeft(
@@ -169,7 +176,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
169
'second_table.listing_product_id=t.variation_parent_id',
170
array(
171
'variation_min_price' => 'variation_min_price',
172
- 'variation_max_price' => 'variation_max_price',
173
)
174
);
175
@@ -209,7 +216,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
209
'general_id' => 'second_table.general_id',
210
'is_afn_channel' => 'second_table.is_afn_channel',
211
'is_variation_parent' => new Zend_Db_Expr('NULL'),
212
- 'is_repricing' => 'second_table.is_repricing',
213
'variation_child_statuses' => new Zend_Db_Expr('NULL'),
214
'online_sku' => 'second_table.sku',
215
'online_qty' => 'second_table.online_qty',
@@ -219,8 +226,10 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
219
'online_sale_price_end_date' => new Zend_Db_Expr('NULL'),
220
'min_online_price' => 'second_table.online_price',
221
'max_online_price' => 'second_table.online_price',
222
'variation_min_price' => new Zend_Db_Expr('NULL'),
223
- 'variation_max_price' => new Zend_Db_Expr('NULL')
224
)
225
);
226
// ---------------------------------------
@@ -243,6 +252,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
243
'is_in_stock',
244
'product_name',
245
'listing_title',
246
'store_id',
247
'account_id',
248
'marketplace_id',
@@ -266,7 +276,9 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
266
'min_online_price',
267
'max_online_price',
268
'variation_min_price',
269
- 'variation_max_price'
270
)
271
);
272
@@ -379,7 +391,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Search_Grid extends Mage_
379
'filter_condition_callback' => array($this, 'callbackFilterPrice')
380
);
381
382
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled()) {
383
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
384
}
385
@@ -692,33 +704,100 @@ HTML;
692
return '<span style="color: gray;">' . Mage::helper('M2ePro')->__('Not Listed') . '</span>';
693
}
694
695
- $repricingHtml ='';
696
697
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() &&
698
- (int)$row->getData('is_repricing') === Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES) {
699
if ($row->getData('is_variation_parent')) {
700
$text = Mage::helper('M2ePro')->__(
701
- 'Some Child Products are used by Amazon Repricing Tool.
702
- The Price cannot be updated through the M2E Pro.'
703
- );
704
- } else {
705
- $text = Mage::helper('M2ePro')->__(
706
- 'This product is used by Amazon Repricing Tool.
707
- The Price cannot be updated through the M2E Pro.'
708
);
709
- }
710
711
- $repricingHtml = <<<HTML
712
- <span style="float:right; text-align: left;">
713
<img class="tool-tip-image"
714
style="vertical-align: middle; width: 16px;"
715
- src="{$this->getSkinUrl('M2ePro/images/money.png')}">
716
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
717
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
718
<span>{$text}</span>
719
</span>
720
</span>
721
HTML;
722
}
723
724
$onlineMinPrice = $row->getData('min_online_price');
@@ -736,7 +815,7 @@ HTML;
736
737
$marketplaceId = $row->getData('marketplace_id');
738
$currency = Mage::helper('M2ePro/Component_Amazon')
739
- ->getCachedObject('Marketplace',$marketplaceId)
740
->getChildObject()
741
->getDefaultCurrency();
742
@@ -758,7 +837,7 @@ HTML;
758
$resultHtml = '';
759
760
$salePrice = $row->getData('online_sale_price');
761
- if (!$row->getData('is_variation_parent') && (float)$salePrice > 0) {
762
$currentTimestamp = strtotime(Mage::helper('M2ePro')->getCurrentGmtDate(false,'Y-m-d 00:00:00'));
763
764
$startDateTimestamp = strtotime($row->getData('online_sale_price_start_date'));
@@ -1009,7 +1088,7 @@ HTML;
1009
1010
}
1011
1012
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() && !empty($value['is_repricing'])) {
1013
if (!empty($condition)) {
1014
$condition = '(' . $condition . ') OR ';
1015
}
40
->join(array('l'=>Mage::getResourceModel('M2ePro/Listing')->getMainTable()),
41
'(`l`.`id` = `main_table`.`listing_id`)',
42
array('listing_title'=>'title','store_id','marketplace_id'))
43
+ ->joinLeft(array('malpr'=>Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')
44
+ ->getMainTable()
45
+ ),
46
+ '(`malpr`.`listing_product_id` = `main_table`.`id`)',
47
+ array('is_repricing_disabled' => 'is_online_disabled'))
48
->join(array('al'=>Mage::getResourceModel('M2ePro/Amazon_Listing')->getMainTable()),
49
'(`al`.`listing_id` = `l`.`id`)',
50
array('template_selling_format_id'));
135
`second_table`.`online_price`
136
),
137
`t`.`variation_max_price`
138
+ )',
139
+ 'additional_data' => 'main_table.additional_data',
140
+ 'is_repricing_disabled' => 'malpr.is_online_disabled'
141
)
142
);
143
$listingProductCollection->getSelect()->joinLeft(
176
'second_table.listing_product_id=t.variation_parent_id',
177
array(
178
'variation_min_price' => 'variation_min_price',
179
+ 'variation_max_price' => 'variation_max_price'
180
)
181
);
182
216
'general_id' => 'second_table.general_id',
217
'is_afn_channel' => 'second_table.is_afn_channel',
218
'is_variation_parent' => new Zend_Db_Expr('NULL'),
219
+ 'is_repricing' => 'second_table.is_repricing',
220
'variation_child_statuses' => new Zend_Db_Expr('NULL'),
221
'online_sku' => 'second_table.sku',
222
'online_qty' => 'second_table.online_qty',
226
'online_sale_price_end_date' => new Zend_Db_Expr('NULL'),
227
'min_online_price' => 'second_table.online_price',
228
'max_online_price' => 'second_table.online_price',
229
+ 'additional_data' => new Zend_Db_Expr('NULL'),
230
+ 'is_repricing_disabled' => 'second_table.is_repricing_disabled',
231
'variation_min_price' => new Zend_Db_Expr('NULL'),
232
+ 'variation_max_price' => new Zend_Db_Expr('NULL'),
233
)
234
);
235
// ---------------------------------------
252
'is_in_stock',
253
'product_name',
254
'listing_title',
255
+ 'additional_data',
256
'store_id',
257
'account_id',
258
'marketplace_id',
276
'min_online_price',
277
'max_online_price',
278
'variation_min_price',
279
+ 'variation_max_price',
280
+ 'additional_data',
281
+ 'is_repricing_disabled'
282
)
283
);
284
391
'filter_condition_callback' => array($this, 'callbackFilterPrice')
392
);
393
394
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled()) {
395
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
396
}
397
704
return '<span style="color: gray;">' . Mage::helper('M2ePro')->__('Not Listed') . '</span>';
705
}
706
707
+ $repricingHtml = '';
708
+
709
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && $row->getData('is_repricing')) {
710
711
if ($row->getData('is_variation_parent')) {
712
+
713
+ $additionalData = (array)json_decode($row->getData('additional_data'), true);
714
+
715
+ $enabledCount = isset($additionalData['repricing_enabled_count'])
716
+ ? $additionalData['repricing_enabled_count'] : null;
717
+
718
+ $disabledCount = isset($additionalData['repricing_disabled_count'])
719
+ ? $additionalData['repricing_disabled_count'] : null;
720
+
721
+ if ($enabledCount && $disabledCount) {
722
+ $image = 'money_mixed';
723
+ $text = Mage::helper('M2ePro')->__(
724
+ 'This Parent has either Enabled and Disabled for dynamic repricing Child Products. <br>
725
+ <strong>Please note</strong> that the Price value(s) shown in the grid might be
726
+ different from the actual one from Amazon. It is caused by the delay in the values
727
+ updating made via the Repricing Service.'
728
+ );
729
+ } elseif ($enabledCount) {
730
+ $image = 'money';
731
+ $text = Mage::helper('M2ePro')->__(
732
+ 'All Child Products of this Parent are Enabled for dynamic repricing. <br>
733
+ <strong>Please note</strong> that the Price value(s) shown in the grid might be different
734
+ from the actual one from Amazon. It is caused by the delay in the values updating
735
+ made via the Repricing Service.'
736
+ );
737
+ } elseif ($disabledCount) {
738
+ $image = 'money_disabled';
739
+ $text = Mage::helper('M2ePro')->__(
740
+ 'All Child Products of this Parent are Disabled for Repricing.'
741
+ );
742
+ } else {
743
+ $image = 'money';
744
+ $text = Mage::helper('M2ePro')->__(
745
+ 'Some Child Products of this Parent are managed by the Repricing Service. <br>
746
+ <strong>Please note</strong> that the Price value(s) shown in the grid might be
747
+ different from the actual one from Amazon. It is caused by the delay in the
748
+ values updating made via the Repricing Service.'
749
+ );
750
+ }
751
+
752
+ $repricingHtml = <<<HTML
753
+ <br/><span style="float:right; text-align: left;">
754
+ <img class="tool-tip-image"
755
+ style="vertical-align: middle; width: 16px;"
756
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
757
+ <span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
758
+ <img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
759
+ <span>{$text}</span>
760
+ </span>
761
+ </span>
762
+ HTML;
763
+ } elseif (!$row->getData('is_variation_parent')) {
764
+ $image = 'money';
765
$text = Mage::helper('M2ePro')->__(
766
+ 'This Product is used by Amazon Repricing Tool, so its Price cannot be managed via M2E Pro.<br>
767
+ <strong>Please note</strong> that the Price value shown in the grid might be different
768
+ from the actual one from Amazon. It is caused by the delay in the values
769
+ updating made via the Repricing Service.'
770
);
771
772
+ if ((int)$row->getData('is_repricing_disabled') == 1) {
773
+ $image = 'money_disabled';
774
+
775
+ if ($this->getId() == 'amazonListingSearchOtherGrid') {
776
+ $text = Mage::helper('M2ePro')->__(
777
+ 'This product is disabled on Amazon Repricing Tool. <br>
778
+ You can map it to Magento Product and Move into M2E Pro Listing to make the
779
+ Price being updated via M2E Pro.'
780
+ );
781
+ } else {
782
+ $text = Mage::helper('M2ePro')->__(
783
+ 'This product is disabled on Amazon Repricing Tool.
784
+ The Price is updated through the M2E Pro.'
785
+ );
786
+ }
787
+ }
788
+
789
+ $repricingHtml = <<<HTML
790
+ <span style="float:right; text-align: left;">&nbsp;
791
<img class="tool-tip-image"
792
style="vertical-align: middle; width: 16px;"
793
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
794
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
795
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
796
<span>{$text}</span>
797
</span>
798
</span>
799
HTML;
800
+ }
801
}
802
803
$onlineMinPrice = $row->getData('min_online_price');
815
816
$marketplaceId = $row->getData('marketplace_id');
817
$currency = Mage::helper('M2ePro/Component_Amazon')
818
+ ->getCachedObject('Marketplace', $marketplaceId)
819
->getChildObject()
820
->getDefaultCurrency();
821
837
$resultHtml = '';
838
839
$salePrice = $row->getData('online_sale_price');
840
+ if (!$row->getData('is_variation_parent') && (float)$salePrice > 0 && !$row->getData('is_repricing')) {
841
$currentTimestamp = strtotime(Mage::helper('M2ePro')->getCurrentGmtDate(false,'Y-m-d 00:00:00'));
842
843
$startDateTimestamp = strtotime($row->getData('online_sale_price_start_date'));
1088
1089
}
1090
1091
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && !empty($value['is_repricing'])) {
1092
if (!empty($condition)) {
1093
$condition = '(' . $condition . ') OR ';
1094
}
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/Variation/Product/Manage/Tabs/Variations/Grid.php CHANGED
@@ -95,6 +95,15 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Variation_Product_Manage_
95
)
96
);
97
98
// Set collection to grid
99
$this->setCollection($collection);
100
@@ -175,7 +184,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Variation_Product_Manage_
175
'filter_condition_callback' => array($this, 'callbackFilterQty')
176
));
177
178
- $this->addColumn('online_price', array(
179
'header' => Mage::helper('M2ePro')->__('Price'),
180
'align' => 'right',
181
'width' => '70px',
@@ -184,7 +193,13 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_Variation_Product_Manage_
184
'filter_index' => 'online_price',
185
'frame_callback' => array($this, 'callbackColumnPrice'),
186
'filter_condition_callback' => array($this, 'callbackFilterPrice')
187
- ));
188
189
$this->addColumn('status', array(
190
'header' => Mage::helper('M2ePro')->__('Status'),
@@ -543,8 +558,42 @@ HTML;
543
return '<span style="color: gray;">' . Mage::helper('M2ePro')->__('Not Listed') . '</span>';
544
}
545
546
if (is_null($value) || $value === '') {
547
- return Mage::helper('M2ePro')->__('N/A');
548
}
549
550
$marketplaceId = $this->getListingProduct()->getListing()->getMarketplaceId();
@@ -600,10 +649,11 @@ HTML;
600
$currentTimestamp <= $endDateTimestamp &&
601
$salePrice < (float)$value
602
) {
603
- $resultHtml .= '<span style="color: grey; text-decoration: line-through;">'.$priceValue.'</span>';
604
$resultHtml .= '<br/>'.$intervalHtml.'&nbsp;'.$salePriceValue;
605
} else {
606
- $resultHtml .= $priceValue;
607
$resultHtml .= '<br/>'.$intervalHtml.
608
'<span style="color:gray;">'.'&nbsp;'.$salePriceValue.'</span>';
609
}
@@ -611,7 +661,7 @@ HTML;
611
}
612
613
if (empty($resultHtml)) {
614
- $resultHtml = $priceValue;
615
}
616
617
return $resultHtml;
@@ -801,22 +851,58 @@ HTML;
801
return;
802
}
803
804
- $from = $value['from'];
805
- $to = $value['to'];
806
807
- $collection->getSelect()->where(
808
- '(online_price >= \''.$from.'\' AND online_price <= \''.$to.'\' AND
809
(
810
online_sale_price IS NULL OR
811
- online_sale_price_start_date > NOW() OR
812
- online_sale_price_end_date < NOW()
813
- )) OR (online_sale_price >= \''.$from.'\' AND online_sale_price <= \''.$to.'\' AND
814
(
815
online_sale_price IS NOT NULL AND
816
- online_sale_price_start_date < NOW() AND
817
- online_sale_price_end_date > NOW()
818
- ))'
819
- );
820
}
821
822
//########################################
95
)
96
);
97
98
+ $collection->getSelect()->joinLeft(
99
+ array('malpr' => Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getMainTable()),
100
+ '(`second_table`.`listing_product_id` = `malpr`.`listing_product_id`)',
101
+ array(
102
+ 'is_repricing' => 'listing_product_id',
103
+ 'is_repricing_disabled' => 'is_online_disabled',
104
+ )
105
+ );
106
+
107
// Set collection to grid
108
$this->setCollection($collection);
109
184
'filter_condition_callback' => array($this, 'callbackFilterQty')
185
));
186
187
+ $priceColumn = array(
188
'header' => Mage::helper('M2ePro')->__('Price'),
189
'align' => 'right',
190
'width' => '70px',
193
'filter_index' => 'online_price',
194
'frame_callback' => array($this, 'callbackColumnPrice'),
195
'filter_condition_callback' => array($this, 'callbackFilterPrice')
196
+ );
197
+
198
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled()) {
199
+ $priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
200
+ }
201
+
202
+ $this->addColumn('online_price', $priceColumn);
203
204
$this->addColumn('status', array(
205
'header' => Mage::helper('M2ePro')->__('Status'),
558
return '<span style="color: gray;">' . Mage::helper('M2ePro')->__('Not Listed') . '</span>';
559
}
560
561
+ $repricingHtml ='';
562
+
563
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() &&
564
+ (bool)(int)$row->getData('is_repricing')) {
565
+
566
+ $image = 'money';
567
+ $text = Mage::helper('M2ePro')->__(
568
+ 'This Product is used by Amazon Repricing Tool, so its Price cannot be managed via M2E Pro. <br>
569
+ <strong>Please note</strong> that the Price value(s) shown in the grid might
570
+ be different from the actual one from Amazon. It is caused by the delay
571
+ in the values updating made via the Repricing Service'
572
+ );
573
+
574
+ if ((int)$row->getData('is_repricing_disabled') == 1) {
575
+ $image = 'money_disabled';
576
+ $text = Mage::helper('M2ePro')->__(
577
+ 'This product is disabled on Amazon Repricing Tool.
578
+ The Price is updated through the M2E Pro.'
579
+ );
580
+ }
581
+
582
+ $repricingHtml = <<<HTML
583
+ <span style="float:right; text-align: left;">&nbsp;
584
+ <img class="tool-tip-image"
585
+ style="vertical-align: middle; width: 16px;"
586
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
587
+ <span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
588
+ <img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
589
+ <span>{$text}</span>
590
+ </span>
591
+ </span>
592
+ HTML;
593
+ }
594
+
595
if (is_null($value) || $value === '') {
596
+ return Mage::helper('M2ePro')->__('N/A') . $repricingHtml;
597
}
598
599
$marketplaceId = $this->getListingProduct()->getListing()->getMarketplaceId();
649
$currentTimestamp <= $endDateTimestamp &&
650
$salePrice < (float)$value
651
) {
652
+ $resultHtml .= '<span style="color: grey; text-decoration: line-through;">'.$priceValue.'</span>' .
653
+ $repricingHtml;
654
$resultHtml .= '<br/>'.$intervalHtml.'&nbsp;'.$salePriceValue;
655
} else {
656
+ $resultHtml .= $priceValue . $repricingHtml;
657
$resultHtml .= '<br/>'.$intervalHtml.
658
'<span style="color:gray;">'.'&nbsp;'.$salePriceValue.'</span>';
659
}
661
}
662
663
if (empty($resultHtml)) {
664
+ $resultHtml = $priceValue . $repricingHtml;
665
}
666
667
return $resultHtml;
851
return;
852
}
853
854
+ $condition = '';
855
+
856
+ if (isset($value['from']) || isset($value['to'])) {
857
858
+ if (isset($value['from']) && $value['from'] != '') {
859
+ $condition = 'online_price >= \''.$value['from'].'\'';
860
+ }
861
+ if (isset($value['to']) && $value['to'] != '') {
862
+ if (isset($value['from']) && $value['from'] != '') {
863
+ $condition .= ' AND ';
864
+ }
865
+ $condition .= 'online_price <= \''.$value['to'].'\'';
866
+ }
867
+
868
+ $condition = '(' . $condition . ' AND
869
(
870
+ (online_sale_price_start_date IS NULL AND
871
+ online_sale_price_end_date IS NULL) OR
872
online_sale_price IS NULL OR
873
+ online_sale_price_start_date > CURRENT_DATE() OR
874
+ online_sale_price_end_date < CURRENT_DATE()
875
+ )) OR (';
876
+
877
+ if (isset($value['from']) && $value['from'] != '') {
878
+ $condition .= 'online_sale_price >= \''.$value['from'].'\'';
879
+ }
880
+ if (isset($value['to']) && $value['to'] != '') {
881
+ if (isset($value['from']) && $value['from'] != '') {
882
+ $condition .= ' AND ';
883
+ }
884
+ $condition .= 'online_sale_price <= \''.$value['to'].'\'';
885
+ }
886
+
887
+ $condition .= ' AND
888
(
889
+ online_sale_price_start_date IS NOT NULL AND
890
+ online_sale_price_end_date IS NOT NULL AND
891
online_sale_price IS NOT NULL AND
892
+ online_sale_price_start_date < CURRENT_DATE() AND
893
+ online_sale_price_end_date > CURRENT_DATE()
894
+ ))';
895
+
896
+ }
897
+
898
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && !empty($value['is_repricing'])) {
899
+ if (!empty($condition)) {
900
+ $condition = '(' . $condition . ') OR ';
901
+ }
902
+ $condition .= '`malpr`.`listing_product_id` IS NOT NULL';
903
+ }
904
+
905
+ $collection->getSelect()->where($condition);
906
}
907
908
//########################################
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View.php CHANGED
@@ -302,6 +302,9 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View extends Mage_Adminht
302
$switchToMFN = $this->getUrl('*/adminhtml_common_amazon_listing/switchToMFN');
303
304
$getAFNQtyBySku = $this->getUrl('*/adminhtml_common_amazon_listing/getAFNQtyBySku');
305
306
$variationProductManage = $this->getUrl(
307
'*/adminhtml_common_amazon_listing_variation_product_manage/index');
@@ -449,6 +452,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View extends Mage_Adminht
449
M2ePro.url.switchToMFN = '{$switchToMFN}';
450
451
M2ePro.url.getAFNQtyBySku = '{$getAFNQtyBySku}';
452
453
M2ePro.url.variationProductManage = '{$variationProductManage}';
454
M2ePro.url.variationProductSetGeneralIdOwner = '{$variationProductSetGeneralIdOwner}';
302
$switchToMFN = $this->getUrl('*/adminhtml_common_amazon_listing/switchToMFN');
303
304
$getAFNQtyBySku = $this->getUrl('*/adminhtml_common_amazon_listing/getAFNQtyBySku');
305
+ $getUpdatedRepricingPriceBySkus = $this->getUrl(
306
+ '*/adminhtml_common_amazon_listing_repricing/getUpdatedPriceBySkus'
307
+ );
308
309
$variationProductManage = $this->getUrl(
310
'*/adminhtml_common_amazon_listing_variation_product_manage/index');
452
M2ePro.url.switchToMFN = '{$switchToMFN}';
453
454
M2ePro.url.getAFNQtyBySku = '{$getAFNQtyBySku}';
455
+ M2ePro.url.getUpdatedRepricingPriceBySkus = '{$getUpdatedRepricingPriceBySkus}';
456
457
M2ePro.url.variationProductManage = '{$variationProductManage}';
458
M2ePro.url.variationProductSetGeneralIdOwner = '{$variationProductSetGeneralIdOwner}';
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View/Amazon/Grid.php CHANGED
@@ -122,10 +122,10 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Amazon_Grid
122
)',
123
'online_sale_price_start_date' => 'online_sale_price_start_date',
124
'online_sale_price_end_date' => 'online_sale_price_end_date',
125
'is_afn_channel' => 'is_afn_channel',
126
'is_general_id_owner' => 'is_general_id_owner',
127
'is_variation_parent' => 'is_variation_parent',
128
- 'is_repricing' => 'is_repricing',
129
'defected_messages' => 'defected_messages',
130
'min_online_price' => 'IF(
131
(`t`.`variation_min_price` IS NULL),
@@ -155,6 +155,14 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Amazon_Grid
155
'{{table}}.variation_parent_id is NULL'
156
);
157
158
$collection->getSelect()->joinLeft(
159
new Zend_Db_Expr('(
160
SELECT
@@ -276,7 +284,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Amazon_Grid
276
'filter_condition_callback' => array($this, 'callbackFilterPrice')
277
);
278
279
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled()) {
280
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
281
}
282
@@ -775,33 +783,108 @@ HTML;
775
return '<span style="color: gray;">' . Mage::helper('M2ePro')->__('Not Listed') . '</span>';
776
}
777
778
$repricingHtml ='';
779
780
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() &&
781
- (int)$row->getData('is_repricing') === Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES) {
782
if ($row->getData('is_variation_parent')) {
783
$text = Mage::helper('M2ePro')->__(
784
- 'Some Child Products are used by Amazon Repricing Tool.
785
- The Price cannot be updated through the M2E Pro.'
786
- );
787
- } else {
788
- $text = Mage::helper('M2ePro')->__(
789
- 'This product is used by Amazon Repricing Tool.
790
- The Price cannot be updated through the M2E Pro.'
791
);
792
- }
793
794
- $repricingHtml = <<<HTML
795
- <span style="float:right; text-align: left;">
796
<img class="tool-tip-image"
797
style="vertical-align: middle; width: 16px;"
798
- src="{$this->getSkinUrl('M2ePro/images/money.png')}">
799
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
800
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
801
<span>{$text}</span>
802
</span>
803
</span>
804
HTML;
805
}
806
807
$onlineMinPrice = $row->getData('min_online_price');
@@ -827,8 +910,7 @@ HTML;
827
$onlineMinPriceStr = Mage::app()->getLocale()->currency($currency)->toCurrency($onlineMinPrice);
828
$onlineMaxPriceStr = Mage::app()->getLocale()->currency($currency)->toCurrency($onlineMaxPrice);
829
830
- return $onlineMinPriceStr . (($onlineMinPrice != $onlineMaxPrice) ? ' - ' . $onlineMaxPriceStr : '') .
831
- $repricingHtml;
832
}
833
834
$onlinePrice = $row->getData('online_price');
@@ -1175,10 +1257,11 @@ HTML;
1175
1176
}
1177
1178
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() && !empty($value['is_repricing'])) {
1179
if (!empty($condition)) {
1180
$condition = '(' . $condition . ') OR ';
1181
}
1182
$condition .= 'is_repricing = ' . Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES;
1183
}
1184
122
)',
123
'online_sale_price_start_date' => 'online_sale_price_start_date',
124
'online_sale_price_end_date' => 'online_sale_price_end_date',
125
+ 'is_repricing' => 'is_repricing',
126
'is_afn_channel' => 'is_afn_channel',
127
'is_general_id_owner' => 'is_general_id_owner',
128
'is_variation_parent' => 'is_variation_parent',
129
'defected_messages' => 'defected_messages',
130
'min_online_price' => 'IF(
131
(`t`.`variation_min_price` IS NULL),
155
'{{table}}.variation_parent_id is NULL'
156
);
157
158
+ $collection->getSelect()->joinLeft(
159
+ array('malpr' => Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getMainTable()),
160
+ '(`alp`.`listing_product_id` = `malpr`.`listing_product_id`)',
161
+ array(
162
+ 'is_repricing_disabled' => 'is_online_disabled',
163
+ )
164
+ );
165
+
166
$collection->getSelect()->joinLeft(
167
new Zend_Db_Expr('(
168
SELECT
284
'filter_condition_callback' => array($this, 'callbackFilterPrice')
285
);
286
287
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled()) {
288
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
289
}
290
783
return '<span style="color: gray;">' . Mage::helper('M2ePro')->__('Not Listed') . '</span>';
784
}
785
786
+ $listingProductId = (int)$row->getData('id');
787
+
788
$repricingHtml ='';
789
790
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && $row->getData('is_repricing')) {
791
+
792
if ($row->getData('is_variation_parent')) {
793
+
794
+ $additionalData = (array)json_decode($row->getData('additional_data'), true);
795
+
796
+ $enabledCount = isset($additionalData['repricing_enabled_count'])
797
+ ? $additionalData['repricing_enabled_count'] : null;
798
+
799
+ $disabledCount = isset($additionalData['repricing_disabled_count'])
800
+ ? $additionalData['repricing_disabled_count'] : null;
801
+
802
+ if ($enabledCount && $disabledCount) {
803
+ $image = 'money_mixed';
804
+ $text = Mage::helper('M2ePro')->__(
805
+ 'This Parent has either Enabled and Disabled for dynamic repricing Child Products. <br>
806
+ <strong>Please note</strong> that the Price value(s) shown in the grid might be
807
+ different from the actual one from Amazon. It is caused by the delay in the values
808
+ updating made via the Repricing Service.'
809
+ );
810
+ } elseif ($enabledCount) {
811
+ $image = 'money';
812
+ $text = Mage::helper('M2ePro')->__(
813
+ 'All Child Products of this Parent are Enabled for dynamic repricing. <br>
814
+ <strong>Please note</strong> that the Price value(s) shown in the grid might be different
815
+ from the actual one from Amazon. It is caused by the delay in the values updating
816
+ made via the Repricing Service.'
817
+ );
818
+ } elseif ($disabledCount) {
819
+ $image = 'money_disabled';
820
+ $text = Mage::helper('M2ePro')->__('All Child Products of this Parent are Disabled for Repricing.');
821
+ } else {
822
+ $image = 'money';
823
+ $text = Mage::helper('M2ePro')->__(
824
+ 'Some Child Products of this Parent are managed by the Repricing Service. <br>
825
+ <strong>Please note</strong> that the Price value(s) shown in the grid might be
826
+ different from the actual one from Amazon. It is caused by the delay in the
827
+ values updating made via the Repricing Service.'
828
+ );
829
+ }
830
+
831
+ $filter = base64_encode('online_price[is_repricing]=1');
832
+
833
+ $productTitle = Mage::helper('M2ePro')->escapeHtml($row->getData('name'));
834
+ $vpmt = Mage::helper('M2ePro')->__('Manage Variations of &quot;%s&quot; ', $productTitle);
835
+ $vpmt = addslashes($vpmt);
836
+
837
+ $generalId = $row->getData('general_id');
838
+ if (!empty($generalId)) {
839
+ $vpmt .= '('. $generalId .')';
840
+ }
841
+
842
+ $linkTitle = Mage::helper('M2ePro')->__('Show Child Products managed by Amazon Repricing Service.');
843
+
844
+ $repricingHtml = <<<HTML
845
+ <br /><span style="float:right; text-align: left;">
846
+ <img class="tool-tip-image"
847
+ style="vertical-align: middle; width: 16px;"
848
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
849
+ <span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
850
+ <img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
851
+ <span>{$text}</span>
852
+ </span>&nbsp;<a href="javascript:void(0)"
853
+ class="hover-underline"
854
+ title="{$linkTitle}"
855
+ onclick="ListingGridHandlerObj.variationProductManageHandler.openPopUp(
856
+ {$listingProductId}, '{$vpmt}', '{$filter}'
857
+ )">[show]</a>
858
+ </span>
859
+ HTML;
860
+ } elseif (!$row->getData('is_variation_parent')) {
861
+ $image = 'money';
862
$text = Mage::helper('M2ePro')->__(
863
+ 'This Product is used by Amazon Repricing Tool, so its Price cannot be managed via M2E Pro.<br>
864
+ <strong>Please note</strong> that the Price value shown in the grid might be different
865
+ from the actual one from Amazon. It is caused by the delay in the values
866
+ updating made via the Repricing Service.'
867
);
868
869
+ if ((int)$row->getData('is_repricing_disabled') == 1) {
870
+ $image = 'money_disabled';
871
+ $text = Mage::helper('M2ePro')->__(
872
+ 'This product is disabled on Amazon Repricing Tool. The Price is updated through the M2E Pro.'
873
+ );
874
+ }
875
+
876
+ $repricingHtml = <<<HTML
877
+ <span style="float:right; text-align: left;">&nbsp;
878
<img class="tool-tip-image"
879
style="vertical-align: middle; width: 16px;"
880
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
881
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
882
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
883
<span>{$text}</span>
884
</span>
885
</span>
886
HTML;
887
+ }
888
}
889
890
$onlineMinPrice = $row->getData('min_online_price');
910
$onlineMinPriceStr = Mage::app()->getLocale()->currency($currency)->toCurrency($onlineMinPrice);
911
$onlineMaxPriceStr = Mage::app()->getLocale()->currency($currency)->toCurrency($onlineMaxPrice);
912
913
+ return $onlineMinPriceStr.(($onlineMinPrice != $onlineMaxPrice)?' - '.$onlineMaxPriceStr:'').$repricingHtml;
914
}
915
916
$onlinePrice = $row->getData('online_price');
1257
1258
}
1259
1260
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && !empty($value['is_repricing'])) {
1261
if (!empty($condition)) {
1262
$condition = '(' . $condition . ') OR ';
1263
}
1264
+
1265
$condition .= 'is_repricing = ' . Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES;
1266
}
1267
app/code/community/Ess/M2ePro/Block/Adminhtml/Common/Amazon/Listing/View/Sellercentral/Grid.php CHANGED
@@ -120,13 +120,13 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Sellercentral_Grid
120
'online_sale_price_start_date' => 'online_sale_price_start_date',
121
'online_sale_price_end_date' => 'online_sale_price_end_date',
122
'is_afn_channel' => 'is_afn_channel',
123
'is_general_id_owner' => 'is_general_id_owner',
124
'is_variation_parent' => 'is_variation_parent',
125
- 'is_repricing' => 'is_repricing',
126
'variation_child_statuses' => 'variation_child_statuses',
127
'variation_parent_id' => 'variation_parent_id',
128
'defected_messages' => 'defected_messages',
129
- 'min_online_price' => 'IF(
130
`alp`.`online_sale_price_start_date` IS NOT NULL AND
131
`alp`.`online_sale_price_end_date` IS NOT NULL AND
132
`alp`.`online_sale_price_start_date` <= CURRENT_DATE() AND
@@ -137,6 +137,13 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Sellercentral_Grid
137
),
138
'{{table}}.is_variation_parent = 0'
139
);
140
// ---------------------------------------
141
142
// Set collection to grid
@@ -210,7 +217,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Sellercentral_Grid
210
'filter_condition_callback' => array($this, 'callbackFilterPrice')
211
);
212
213
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled()) {
214
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
215
}
216
@@ -264,7 +271,7 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Sellercentral_Grid
264
'edit_fulfillment' => Mage::helper('M2ePro')->__('Fulfillment')
265
);
266
267
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled()) {
268
$groups['edit_repricing'] = Mage::helper('M2ePro')->__('Repricing Tool');
269
}
270
@@ -312,7 +319,19 @@ class Ess_M2ePro_Block_Adminhtml_Common_Amazon_Listing_View_Sellercentral_Grid
312
'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
313
), 'edit_fulfillment');
314
315
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled()) {
316
$this->getMassactionBlock()->addItem('addToRepricing', array(
317
'label' => Mage::helper('M2ePro')->__('Add Item(s)'),
318
'url' => '',
@@ -330,12 +349,6 @@ 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
- $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
@@ -609,18 +622,30 @@ HTML;
609
610
$repricingHtml ='';
611
612
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() &&
613
- (int)$row->getData('is_repricing') === Ess_M2ePro_Model_Amazon_Listing_Product::IS_REPRICING_YES) {
614
$text = Mage::helper('M2ePro')->__(
615
- 'This product is used by Amazon Repricing Tool.
616
- The Price cannot be updated through the M2E Pro.'
617
);
618
619
$repricingHtml = <<<HTML
620
- <span style="float:right; text-align: left;">
621
<img class="tool-tip-image"
622
style="vertical-align: middle; width: 16px;"
623
- src="{$this->getSkinUrl('M2ePro/images/money.png')}">
624
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
625
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
626
<span>{$text}</span>
@@ -850,7 +875,7 @@ HTML;
850
$condition .= 'min_online_price <= \''.$value['to'].'\'';
851
}
852
853
- if (Mage::helper('M2ePro/Component_Amazon')->isRepricingEnabled() && !empty($value['is_repricing'])) {
854
if (!empty($condition)) {
855
$condition = '(' . $condition . ') OR ';
856
}
120
'online_sale_price_start_date' => 'online_sale_price_start_date',
121
'online_sale_price_end_date' => 'online_sale_price_end_date',
122
'is_afn_channel' => 'is_afn_channel',
123
+ 'is_repricing' => 'is_repricing',
124
'is_general_id_owner' => 'is_general_id_owner',
125
'is_variation_parent' => 'is_variation_parent',
126
'variation_child_statuses' => 'variation_child_statuses',
127
'variation_parent_id' => 'variation_parent_id',
128
'defected_messages' => 'defected_messages',
129
+ 'min_online_price' => 'IF(
130
`alp`.`online_sale_price_start_date` IS NOT NULL AND
131
`alp`.`online_sale_price_end_date` IS NOT NULL AND
132
`alp`.`online_sale_price_start_date` <= CURRENT_DATE() AND
137
),
138
'{{table}}.is_variation_parent = 0'
139
);
140
+ $collection->getSelect()->joinLeft(
141
+ array('malpr' => Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getMainTable()),
142
+ '(`alp`.`listing_product_id` = `malpr`.`listing_product_id`)',
143
+ array(
144
+ 'is_repricing_disabled' => 'is_online_disabled',
145
+ )
146
+ );
147
// ---------------------------------------
148
149
// Set collection to grid
217
'filter_condition_callback' => array($this, 'callbackFilterPrice')
218
);
219
220
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled()) {
221
$priceColumn['filter'] = 'M2ePro/adminhtml_common_amazon_grid_column_filter_price';
222
}
223
271
'edit_fulfillment' => Mage::helper('M2ePro')->__('Fulfillment')
272
);
273
274
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled()) {
275
$groups['edit_repricing'] = Mage::helper('M2ePro')->__('Repricing Tool');
276
}
277
319
'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
320
), 'edit_fulfillment');
321
322
+ $listingData = Mage::helper('M2ePro/Data_Global')->getValue('temp_data');
323
+ /** @var Ess_M2ePro_Model_Account $account */
324
+ $account = Mage::helper('M2ePro/Component_Amazon')->getObject('Account', $listingData['account_id']);
325
+
326
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() &&
327
+ $account->getChildObject()->isRepricing()) {
328
+
329
+ $this->getMassactionBlock()->addItem('showDetails', array(
330
+ 'label' => Mage::helper('M2ePro')->__('Show Details'),
331
+ 'url' => '',
332
+ 'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
333
+ ), 'edit_repricing');
334
+
335
$this->getMassactionBlock()->addItem('addToRepricing', array(
336
'label' => Mage::helper('M2ePro')->__('Add Item(s)'),
337
'url' => '',
349
'url' => '',
350
'confirm' => Mage::helper('M2ePro')->__('Are you sure?')
351
), 'edit_repricing');
352
}
353
// ---------------------------------------
354
622
623
$repricingHtml ='';
624
625
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() &&
626
+ (bool)(int)$row->getData('is_repricing')) {
627
+
628
+ $image = 'money';
629
$text = Mage::helper('M2ePro')->__(
630
+ 'This Product is used by Amazon Repricing Tool, so its Price cannot be managed via M2E Pro. <br>
631
+ <strong>Please note</strong> that the Price value(s) shown in the grid might
632
+ be different from the actual one from Amazon. It is caused by the delay
633
+ in the values updating made via the Repricing Service'
634
);
635
636
+ if ((int)$row->getData('is_repricing_disabled') == 1) {
637
+ $image = 'money_disabled';
638
+ $text = Mage::helper('M2ePro')->__(
639
+ 'This product is disabled on Amazon Repricing Tool.
640
+ The Price is updated through the M2E Pro.'
641
+ );
642
+ }
643
+
644
$repricingHtml = <<<HTML
645
+ <span style="float:right; text-align: left;">&nbsp;
646
<img class="tool-tip-image"
647
style="vertical-align: middle; width: 16px;"
648
+ src="{$this->getSkinUrl('M2ePro/images/'.$image.'.png')}">
649
<span class="tool-tip-message tool-tip-message tip-left" style="display:none;">
650
<img src="{$this->getSkinUrl('M2ePro/images/i_icon.png')}">
651
<span>{$text}</span>
875
$condition .= 'min_online_price <= \''.$value['to'].'\'';
876
}
877
878
+ if (Mage::helper('M2ePro/Component_Amazon_Repricing')->isEnabled() && !empty($value['is_repricing'])) {
879
if (!empty($condition)) {
880
$condition = '(' . $condition . ') OR ';
881
}
app/code/community/Ess/M2ePro/CHANGELOG CHANGED
@@ -1,3 +1,14 @@
1
* 6.4.6.1 (r10945) (22/11/2016)
2
3
* Fix: critical bug during 6.4.5 - 6.4.6 upgrade
1
+ * 6.4.7 (r10970) (28/11/2016)
2
+
3
+ * Added: [Amazon] Ability to use Repricing Service without the need to contact support of M2E Pro
4
+ * Added: [Amazon] Max, Min, Regular Prices of Repricing Service Products can be synchronized with Magento Attribute
5
+ * Added: [Amazon] Ability to disable Products automatically on Repricing Service depending on Magento Attribute Value
6
+ * Improvement: [Amazon] Prices will be updated every hour instead of one time a day for Products which are processed by Repricing Service
7
+ * Improvement: [Amazon] When Products which are processed by Repricing Service are added to the Listing, they will be marked immediately
8
+ * Fix: [Amazon] Adding a lot of Products to the Repricing Service from Listing Grid did not work correctly
9
+ * Fix: [Amazon] Sometimes, Products could be marked by Repricing Service Label even if they are not used by it
10
+ * Fix: [Amazon] When Product is being disabled on Repricing Service then M2E Pro will revise their own Price immediately
11
+
12
* 6.4.6.1 (r10945) (22/11/2016)
13
14
* Fix: critical bug during 6.4.5 - 6.4.6 upgrade
app/code/community/Ess/M2ePro/Helper/Component/Amazon.php CHANGED
@@ -146,11 +146,6 @@ class Ess_M2ePro_Helper_Component_Amazon extends Mage_Core_Helper_Abstract
146
return true;
147
}
148
149
- public function isRepricingEnabled()
150
- {
151
- return (bool)Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/repricing/', 'mode');
152
- }
153
-
154
public function getApplicationName()
155
{
156
return Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/', 'application_name');
146
return true;
147
}
148
149
public function getApplicationName()
150
{
151
return Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/', 'application_name');
app/code/community/Ess/M2ePro/Helper/Component/Amazon/Repricing.php ADDED
@@ -0,0 +1,110 @@
1
+ <?php
2
+
3
+ /*
4
+ * @author M2E Pro Developers Team
5
+ * @copyright 2011-2015 ESS-UA [M2E Pro]
6
+ * @license Commercial use is forbidden
7
+ */
8
+
9
+ class Ess_M2ePro_Helper_Component_Amazon_Repricing extends Mage_Core_Helper_Abstract
10
+ {
11
+ const COMMAND_ACCOUNT_LINK = 'account/link';
12
+ const COMMAND_ACCOUNT_UNLINK = 'account/unlink';
13
+ const COMMAND_SYNCHRONIZE = 'synchronize';
14
+ const COMMAND_SYNCHRONIZE_USER_CHANGES = 'synchronize/userChanges';
15
+ const COMMAND_GOTO_SERVICE = 'goto_service';
16
+ const COMMAND_OFFERS_ADD = 'offers/add';
17
+ const COMMAND_OFFERS_DETAILS = 'offers/details';
18
+ const COMMAND_OFFERS_EDIT = 'offers/edit';
19
+ const COMMAND_OFFERS_REMOVE = 'offers/remove';
20
+ const COMMAND_DATA_SET_REQUEST = 'data/setRequest';
21
+ const COMMAND_DATA_GET_RESPONSE = 'data/getResponse';
22
+
23
+ const REQUEST_TIMEOUT = 300;
24
+
25
+ //########################################
26
+
27
+ public function isEnabled()
28
+ {
29
+ return (bool)Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/repricing/', 'mode');
30
+ }
31
+
32
+ //########################################
33
+
34
+ public function sendRequest($command, array $postData)
35
+ {
36
+ $curlObject = curl_init();
37
+
38
+ $url = $this->getBaseUrl().$command;
39
+
40
+ //set the url
41
+ curl_setopt($curlObject, CURLOPT_URL, $url);
42
+
43
+ // stop CURL from verifying the peer's certificate
44
+ curl_setopt($curlObject, CURLOPT_SSL_VERIFYPEER, false);
45
+ curl_setopt($curlObject, CURLOPT_SSL_VERIFYHOST, false);
46
+
47
+ // set the data body of the request
48
+ curl_setopt($curlObject, CURLOPT_POST, true);
49
+ curl_setopt($curlObject, CURLOPT_POSTFIELDS, http_build_query($postData,'','&'));
50
+
51
+ // set it to return the transfer as a string from curl_exec
52
+ curl_setopt($curlObject, CURLOPT_RETURNTRANSFER, true);
53
+ curl_setopt($curlObject, CURLOPT_CONNECTTIMEOUT, 15);
54
+ curl_setopt($curlObject, CURLOPT_TIMEOUT, self::REQUEST_TIMEOUT);
55
+
56
+ $response = curl_exec($curlObject);
57
+
58
+ $curlInfo = curl_getinfo($curlObject);
59
+ $errorNumber = curl_errno($curlObject);
60
+
61
+ curl_close($curlObject);
62
+
63
+ if ($response === false) {
64
+
65
+ throw new Ess_M2ePro_Model_Exception_Connection(
66
+ 'The Action was not completed because connection with M2E Pro Repricing Service was not set.
67
+ There are several possible reasons: temporary connection problem – please wait and try again later;
68
+ block of outgoing connection by firewall',
69
+ array(
70
+ 'curl_error_number' => $errorNumber,
71
+ 'curl_info' => $curlInfo
72
+ )
73
+ );
74
+ }
75
+
76
+ return array(
77
+ 'curl_error_number' => $errorNumber,
78
+ 'curl_info' => $curlInfo,
79
+ 'response' => $response
80
+ );
81
+ }
82
+
83
+ public function getBaseUrl()
84
+ {
85
+ $baseUrl = Mage::helper('M2ePro/Module')->getConfig()->getGroupValue('/amazon/repricing/', 'base_url');
86
+ return rtrim($baseUrl, '/').'/';
87
+ }
88
+
89
+ //########################################
90
+
91
+ public function prepareActionUrl($command, $serverRequestToken)
92
+ {
93
+ return $this->getBaseUrl().$command.'?'.http_build_query(array('request_token' => $serverRequestToken));
94
+ }
95
+
96
+ public function getManagementUrl(Ess_M2ePro_Model_Account $account)
97
+ {
98
+ /** @var Ess_M2ePro_Model_Amazon_Account $amazonAccount */
99
+ $amazonAccount = $account->getChildObject();
100
+ if (!$amazonAccount->isRepricing()) {
101
+ return false;
102
+ }
103
+
104
+ return $this->getBaseUrl().self::COMMAND_GOTO_SERVICE.'?'.http_build_query(array(
105
+ 'account_token' => $amazonAccount->getRepricing()->getToken()
106
+ ));
107
+ }
108
+
109
+ //########################################
110
+ }
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 = '10945';
76
77
if ($revision == str_replace('|','#','|REVISION|')) {
78
$revision = (int)exec('svnversion');
72
73
public function getRevision()
74
{
75
+ $revision = '10970';
76
77
if ($revision == str_replace('|','#','|REVISION|')) {
78
$revision = (int)exec('svnversion');
app/code/community/Ess/M2ePro/Helper/Module/Database/Structure.php CHANGED
@@ -105,6 +105,7 @@ class Ess_M2ePro_Helper_Module_Database_Structure extends Mage_Core_Helper_Abstr
105
'm2epro_ebay_template_synchronization',
106
107
'm2epro_amazon_account',
108
'm2epro_amazon_dictionary_category',
109
'm2epro_amazon_dictionary_category_product_data',
110
'm2epro_amazon_dictionary_marketplace',
@@ -114,6 +115,7 @@ class Ess_M2ePro_Helper_Module_Database_Structure extends Mage_Core_Helper_Abstr
114
'm2epro_amazon_listing_auto_category_group',
115
'm2epro_amazon_listing_other',
116
'm2epro_amazon_listing_product',
117
'm2epro_amazon_listing_product_variation',
118
'm2epro_amazon_listing_product_variation_option',
119
'm2epro_amazon_marketplace',
105
'm2epro_ebay_template_synchronization',
106
107
'm2epro_amazon_account',
108
+ 'm2epro_amazon_account_repricing',
109
'm2epro_amazon_dictionary_category',
110
'm2epro_amazon_dictionary_category_product_data',
111
'm2epro_amazon_dictionary_marketplace',
115
'm2epro_amazon_listing_auto_category_group',
116
'm2epro_amazon_listing_other',
117
'm2epro_amazon_listing_product',
118
+ 'm2epro_amazon_listing_product_repricing',
119
'm2epro_amazon_listing_product_variation',
120
'm2epro_amazon_listing_product_variation_option',
121
'm2epro_amazon_marketplace',
app/code/community/Ess/M2ePro/Helper/Module/License.php CHANGED
@@ -318,4 +318,41 @@ class Ess_M2ePro_Helper_Module_License extends Mage_Core_Helper_Abstract
318
}
319
320
//########################################
321
}
318
}
319
320
//########################################
321
+
322
+ public function getUserInfo()
323
+ {
324
+ $defaultStoreId = Mage::helper('M2ePro/Magento_Store')->getDefaultStoreId();
325
+
326
+ $userId = Mage::getSingleton('admin/session')->getUser()->getId();
327
+ $userInfo = Mage::getModel('admin/user')->load($userId)->getData();
328
+
329
+ $tempPath = defined('Mage_Shipping_Model_Config::XML_PATH_ORIGIN_CITY')
330
+ ? Mage_Shipping_Model_Config::XML_PATH_ORIGIN_CITY : 'shipping/origin/city';
331
+ $userInfo['city'] = Mage::getStoreConfig($tempPath, $defaultStoreId);
332
+
333
+ $tempPath = defined('Mage_Shipping_Model_Config::XML_PATH_ORIGIN_POSTCODE')
334
+ ? Mage_Shipping_Model_Config::XML_PATH_ORIGIN_POSTCODE : 'shipping/origin/postcode';
335
+ $userInfo['postal_code'] = Mage::getStoreConfig($tempPath, $defaultStoreId);
336
+
337
+ $userInfo['country'] = Mage::getStoreConfig('general/country/default', $defaultStoreId);
338
+
339
+ $requiredKeys = array(
340
+ 'email',
341
+ 'firstname',
342
+ 'lastname',
343
+ 'country',
344
+ 'city',
345
+ 'postal_code',
346
+ );
347
+
348
+ foreach ($userInfo as $key => $value) {
349
+ if (!in_array($key, $requiredKeys)) {
350
+ unset($userInfo[$key]);
351
+ }
352
+ }
353
+
354
+ return $userInfo;
355
+ }
356
+
357
+ //########################################
358
}
app/code/community/Ess/M2ePro/Model/Amazon/Account.php CHANGED
@@ -97,6 +97,11 @@ class Ess_M2ePro_Model_Amazon_Account extends Ess_M2ePro_Model_Component_Child_A
97
*/
98
private $marketplaceModel = NULL;
99
100
//########################################
101
102
public function _construct()
@@ -118,6 +123,11 @@ class Ess_M2ePro_Model_Amazon_Account extends Ess_M2ePro_Model_Component_Child_A
118
$item->deleteInstance();
119
}
120
121
$this->marketplaceModel = NULL;
122
123
$this->delete();
@@ -158,6 +168,43 @@ class Ess_M2ePro_Model_Amazon_Account extends Ess_M2ePro_Model_Component_Child_A
158
159
//########################################
160
161
public function getServerHash()
162
{
163
return $this->getData('server_hash');
@@ -854,33 +901,6 @@ class Ess_M2ePro_Model_Amazon_Account extends Ess_M2ePro_Model_Component_Child_A
854
return $setting == self::MAGENTO_ORDERS_FBA_STOCK_MODE_YES;
855
}
856
857
- // ---------------------------------------
858
-
859
- public function isRepricingLinked()
860
- {
861
- return !is_null($this->getData('repricing'));
862
- }
863
-
864
- public function getRepricing()
865
- {
866
- return $this->getSettings('repricing');
867
- }
868
-
869
- public function getRepricingEmail()
870
- {
871
- return $this->getSetting('repricing', 'email');
872
- }
873
-
874
- public function getRepricingToken()
875
- {
876
- return $this->getSetting('repricing', 'token');
877
- }
878
-
879
- public function getRepricingInfo()
880
- {
881
- return $this->getSetting('repricing', 'info');
882
- }
883
-
884
//########################################
885
886
public function save()
97
*/
98
private $marketplaceModel = NULL;
99
100
+ /**
101
+ * @var Ess_M2ePro_Model_Amazon_Account_Repricing
102
+ */
103
+ private $repricingModel = NULL;
104
+
105
//########################################
106
107
public function _construct()
123
$item->deleteInstance();
124
}
125
126
+ if ($this->isRepricing()) {
127
+ $this->getRepricing()->deleteInstance();
128
+ $this->repricingModel = NULL;
129
+ }
130
+
131
$this->marketplaceModel = NULL;
132
133
$this->delete();
168
169
//########################################
170
171
+ /**
172
+ * @return bool
173
+ */
174
+ public function isRepricing()
175
+ {
176
+ $cacheKey = 'amazon_account_'.$this->getId().'_is_repricing';
177
+ $cacheData = Mage::helper('M2ePro/Data_Cache_Permanent')->getValue($cacheKey);
178
+
179
+ if ($cacheData !== false) {
180
+ return (bool)$cacheData;
181
+ }
182
+
183
+ $repricingCollection = Mage::getResourceModel('M2ePro/Amazon_Account_Repricing_Collection');
184
+ $repricingCollection->addFieldToFilter('account_id', $this->getId());
185
+ $isRepricing = (int)(bool)$repricingCollection->getSize();
186
+
187
+ Mage::helper('M2ePro/Data_Cache_Permanent')->setValue($cacheKey, $isRepricing, array('account'), 60*60*24);
188
+
189
+ return (bool)$isRepricing;
190
+ }
191
+
192
+ /**
193
+ * @return Ess_M2ePro_Model_Amazon_Account_Repricing
194
+ */
195
+ public function getRepricing()
196
+ {
197
+ if (is_null($this->repricingModel)) {
198
+ $this->repricingModel = Mage::helper('M2ePro')->getCachedObject(
199
+ 'Amazon_Account_Repricing', $this->getId(), NULL, array('account')
200
+ );
201
+ }
202
+
203
+ return $this->repricingModel;
204
+ }
205
+
206
+ //########################################
207
+
208
public function getServerHash()
209
{
210
return $this->getData('server_hash');
901
return $setting == self::MAGENTO_ORDERS_FBA_STOCK_MODE_YES;
902
}
903
904
//########################################
905
906
public function save()
app/code/community/Ess/M2ePro/Model/Amazon/Account/Repricing.php ADDED
@@ -0,0 +1,571 @@
1
+ <?php
2
+
3
+ /*
4
+ * @author M2E Pro Developers Team
5
+ * @copyright 2011-2015 ESS-UA [M2E Pro]
6
+ * @license Commercial use is forbidden
7
+ */
8
+
9
+ class Ess_M2ePro_Model_Amazon_Account_Repricing extends Ess_M2ePro_Model_Component_Abstract
10
+ {
11
+ const PRICE_MODE_MANUAL = 0;
12
+ const PRICE_MODE_PRODUCT = 1;
13
+ const PRICE_MODE_SPECIAL = 2;
14
+ const PRICE_MODE_ATTRIBUTE = 3;
15
+
16
+ const REGULAR_PRICE_MODE_PRODUCT_POLICY = 4;
17
+
18
+ const MIN_PRICE_MODE_REGULAR_VALUE = 4;
19
+ const MIN_PRICE_MODE_REGULAR_PERCENT = 5;
20
+
21
+ const MAX_PRICE_MODE_REGULAR_VALUE = 4;
22
+ const MAX_PRICE_MODE_REGULAR_PERCENT = 5;
23
+
24
+ const PRICE_VARIATION_MODE_PARENT = 1;
25
+ const PRICE_VARIATION_MODE_CHILDREN = 2;
26
+
27
+ const DISABLE_MODE_MANUAL = 0;
28
+ const DISABLE_MODE_PRODUCT_STATUS = 1;
29
+ const DISABLE_MODE_ATTRIBUTE = 2;
30
+
31
+ /**
32
+ * @var Ess_M2ePro_Model_Account
33
+ */
34
+ private $accountModel = NULL;
35
+
36
+ //########################################
37
+
38
+ public function _construct()
39
+ {
40
+ parent::_construct();
41
+ $this->_init('M2ePro/Amazon_Account_Repricing');
42
+ }
43
+
44
+ //########################################
45
+
46
+ public function deleteInstance()
47
+ {
48
+ $temp = parent::deleteInstance();
49
+ $temp && $this->accountModel = NULL;
50
+ return $temp;
51
+ }
52
+
53
+ //########################################
54
+
55
+ /**
56
+ * @return Ess_M2ePro_Model_Account
57
+ */
58
+ public function getAccount()
59
+ {
60
+ if (is_null($this->accountModel)) {
61
+ $this->accountModel = Mage::helper('M2ePro/Component_Amazon')->getCachedObject(
62
+ 'Account',$this->getAccountId()
63
+ );
64
+ }
65
+
66
+ return $this->accountModel;
67
+ }
68
+
69
+ /**
70
+ * @param Ess_M2ePro_Model_Account $instance
71
+ */
72
+ public function setAccount(Ess_M2ePro_Model_Account $instance)
73
+ {
74
+ $this->accountModel = $instance;
75
+ }
76
+
77
+ //########################################
78
+
79
+ /**
80
+ * @return int
81
+ */
82
+ public function getAccountId()
83
+ {
84
+ return (int)$this->getData('account_id');
85
+ }
86
+
87
+ /**
88
+ * @return string
89
+ */
90
+ public function getEmail()
91
+ {
92
+ return $this->getData('email');
93
+ }
94
+
95
+ /**
96
+ * @return string
97
+ */
98
+ public function getToken()
99
+ {
100
+ return $this->getData('token');
101
+ }
102
+
103
+ /**
104
+ * @return int
105
+ */
106
+ public function getTotalProducts()
107
+ {
108
+ return $this->getData('total_products');
109
+ }
110
+
111
+ //########################################
112
+
113
+ /**
114
+ * @return int
115
+ */
116
+ public function getRegularPriceMode()
117
+ {
118
+ return (int)$this->getData('regular_price_mode');
119
+ }
120
+
121
+ /**
122
+ * @return bool
123
+ */
124
+ public function isRegularPriceModeManual()
125
+ {
126
+ return $this->getRegularPriceMode() == self::PRICE_MODE_MANUAL;
127
+ }
128
+
129
+ /**
130
+ * @return bool
131
+ */
132
+ public function isRegularPriceModeProductPolicy()
133
+ {
134
+ return $this->getRegularPriceMode() == self::REGULAR_PRICE_MODE_PRODUCT_POLICY;
135
+ }
136
+
137
+ /**
138
+ * @return bool
139
+ */
140
+ public function isRegularPriceModeProduct()
141
+ {
142
+ return $this->getRegularPriceMode() == self::PRICE_MODE_PRODUCT;
143
+ }
144
+
145
+ /**
146
+ * @return bool
147
+ */
148
+ public function isRegularPriceModeSpecial()
149
+ {
150
+ return $this->getRegularPriceMode() == self::PRICE_MODE_SPECIAL;
151
+ }
152
+
153
+ /**
154
+ * @return bool
155
+ */
156
+ public function isRegularPriceModeAttribute()
157
+ {
158
+ return $this->getRegularPriceMode() == self::PRICE_MODE_ATTRIBUTE;
159
+ }
160
+
161
+ public function getRegularPriceCoefficient()
162
+ {
163
+ return $this->getData('regular_price_coefficient');
164
+ }
165
+
166
+ /**
167
+ * @return array
168
+ */
169
+ public function getRegularPriceSource()
170
+ {
171
+ return array(
172
+ 'mode' => $this->getRegularPriceMode(),
173
+ 'coefficient' => $this->getRegularPriceCoefficient(),
174
+ 'attribute' => $this->getData('regular_price_attribute')
175
+ );
176
+ }
177
+
178
+ /**
179
+ * @return array
180
+ */
181
+ public function getRegularPriceAttributes()
182
+ {
183
+ $attributes = array();
184
+ $src = $this->getRegularPriceSource();
185
+
186
+ if ($src['mode'] == self::PRICE_MODE_ATTRIBUTE) {
187
+ $attributes[] = $src['attribute'];
188
+ }
189
+
190
+ return $attributes;
191
+ }
192
+
193
+ //########################################
194
+
195
+ /**
196
+ * @return int
197
+ */
198
+ public function getRegularPriceVariationMode()
199
+ {
200
+ return (int)$this->getData('regular_price_variation_mode');
201
+ }
202
+
203
+ /**
204
+ * @return bool
205
+ */
206
+ public function isRegularPriceVariationModeParent()
207
+ {
208
+ return $this->getRegularPriceVariationMode() == self::PRICE_VARIATION_MODE_PARENT;
209
+ }
210
+
211
+ /**
212
+ * @return bool
213
+ */
214
+ public function isRegularPriceVariationModeChildren()
215
+ {
216
+ return $this->getRegularPriceVariationMode() == self::PRICE_VARIATION_MODE_CHILDREN;
217
+ }
218
+
219
+ //########################################
220
+
221
+ /**
222
+ * @return int
223
+ */
224
+ public function getMinPriceMode()
225
+ {
226
+ return (int)$this->getData('min_price_mode');
227
+ }
228
+
229
+ /**
230
+ * @return bool
231
+ */
232
+ public function isMinPriceModeManual()
233
+ {
234
+ return $this->getMinPriceMode() == self::PRICE_MODE_MANUAL;
235
+ }
236
+
237
+ /**
238
+ * @return bool
239
+ */
240
+ public function isMinPriceModeRegularValue()
241
+ {
242
+ return $this->getMinPriceMode() == self::MIN_PRICE_MODE_REGULAR_VALUE;
243
+ }
244
+
245
+ /**
246
+ * @return bool
247
+ */
248
+ public function isMinPriceModeRegularPercent()
249
+ {
250
+ return $this->getMinPriceMode() == self::MIN_PRICE_MODE_REGULAR_PERCENT;
251
+ }
252
+
253
+ /**
254
+ * @return bool
255
+ */
256
+ public function isMinPriceModeAttribute()
257
+ {
258
+ return $this->getMinPriceMode() == self::PRICE_MODE_ATTRIBUTE;
259
+ }
260
+
261
+ public function getMinPriceCoefficient()
262
+ {
263
+ return $this->getData('min_price_coefficient');
264
+ }
265
+
266
+ /**
267
+ * @return array
268
+ */
269
+ public function getMinPriceSource()
270
+ {
271
+ return array(
272
+ 'mode' => $this->getMinPriceMode(),
273
+ 'coefficient' => $this->getMinPriceCoefficient(),
274
+ 'attribute' => $this->getData('min_price_attribute'),
275
+ 'regular_value' => $this->getData('min_price_value'),
276
+ 'regular_percent' => $this->getData('min_price_percent'),
277
+ );
278
+ }
279
+
280
+ /**
281
+ * @return array
282
+ */
283
+ public function getMinPriceAttributes()
284
+ {
285
+ $attributes = array();
286
+ $src = $this->getMinPriceSource();
287
+
288
+ if ($src['mode'] == self::PRICE_MODE_ATTRIBUTE) {
289
+ $attributes[] = $src['attribute'];
290
+ }
291
+
292
+ return $attributes;
293
+ }
294
+
295
+ //########################################
296
+
297
+ /**
298
+ * @return int
299
+ */
300
+ public function getMinPriceVariationMode()
301
+ {
302
+ return (int)$this->getData('min_price_variation_mode');
303
+ }
304
+
305
+ /**
306
+ * @return bool
307
+ */
308
+ public function isMinPriceVariationModeParent()
309
+ {
310
+ return $this->getMinPriceVariationMode() == self::PRICE_VARIATION_MODE_PARENT;
311
+ }
312
+
313
+ /**
314
+ * @return bool
315
+ */
316
+ public function isMinPriceVariationModeChildren()
317
+ {
318
+ return $this->getMinPriceVariationMode() == self::PRICE_VARIATION_MODE_CHILDREN;
319
+ }
320
+
321
+ //########################################
322
+
323
+ /**
324
+ * @return int
325
+ */
326
+ public function getMaxPriceMode()
327
+ {
328
+ return (int)$this->getData('max_price_mode');
329
+ }
330
+
331
+ /**
332
+ * @return bool
333
+ */
334
+ public function isMaxPriceModeManual()
335
+ {
336
+ return $this->getMaxPriceMode() == self::PRICE_MODE_MANUAL;
337
+ }
338
+
339
+ /**
340
+ * @return bool
341
+ */
342
+ public function isMaxPriceModeRegularValue()
343
+ {
344
+ return $this->getMaxPriceMode() == self::MAX_PRICE_MODE_REGULAR_VALUE;
345
+ }
346
+
347
+ /**
348
+ * @return bool
349
+ */
350
+ public function isMaxPriceModeRegularPercent()
351
+ {
352
+ return $this->getMaxPriceMode() == self::MAX_PRICE_MODE_REGULAR_PERCENT;
353
+ }
354
+
355
+ /**
356
+ * @return bool
357
+ */
358
+ public function isMaxPriceModeAttribute()
359
+ {
360
+ return $this->getMaxPriceMode() == self::PRICE_MODE_ATTRIBUTE;
361
+ }
362
+
363
+ public function getMaxPriceCoefficient()
364
+ {
365
+ return $this->getData('max_price_coefficient');
366
+ }
367
+
368
+ /**
369
+ * @return array
370
+ */
371
+ public function getMaxPriceSource()
372
+ {
373
+ return array(
374
+ 'mode' => $this->getMaxPriceMode(),
375
+ 'coefficient' => $this->getMaxPriceCoefficient(),
376
+ 'attribute' => $this->getData('max_price_attribute'),
377
+ 'regular_value' => $this->getData('max_price_value'),
378
+ 'regular_percent' => $this->getData('max_price_percent'),
379
+ );
380
+ }
381
+
382
+ /**
383
+ * @return array
384
+ */
385
+ public function getMaxPriceAttributes()
386
+ {
387
+ $attributes = array();
388
+ $src = $this->getMaxPriceSource();
389
+
390
+ if ($src['mode'] == self::PRICE_MODE_ATTRIBUTE) {
391
+ $attributes[] = $src['attribute'];
392
+ }
393
+
394
+ return $attributes;
395
+ }
396
+
397
+ //########################################
398
+
399
+ /**
400
+ * @return int
401
+ */
402
+ public function getMaxPriceVariationMode()
403
+ {
404
+ return (int)$this->getData('max_price_variation_mode');
405
+ }
406
+
407
+ /**
408
+ * @return bool
409
+ */
410
+ public function isMaxPriceVariationModeParent()
411
+ {
412
+ return $this->getMaxPriceVariationMode() == self::PRICE_VARIATION_MODE_PARENT;
413
+ }
414
+
415
+ /**
416
+ * @return bool
417
+ */
418
+ public function isMaxPriceVariationModeChildren()
419
+ {
420
+ return $this->getMaxPriceVariationMode() == self::PRICE_VARIATION_MODE_CHILDREN;
421
+ }
422
+
423
+ //########################################
424
+
425
+ /**
426
+ * @return string|null
427
+ */
428
+ public function getLastCheckedListingProductDate()
429
+ {
430
+ return $this->getData('last_checked_listing_product_update_date');
431
+ }
432
+
433
+ //########################################
434
+
435
+ /**
436
+ * @return int
437
+ */
438
+ public function getDisableMode()
439
+ {
440
+ return (int)$this->getData('disable_mode');
441
+ }
442
+
443
+ /**
444
+ * @return bool
445
+ */
446
+ public function isDisableModeManual()
447
+ {
448
+ return $this->getDisableMode() == self::DISABLE_MODE_MANUAL;
449
+ }
450
+
451
+ /**
452
+ * @return bool
453
+ */
454
+ public function isDisableModeProductStatus()
455
+ {
456
+ return $this->getDisableMode() == self::DISABLE_MODE_PRODUCT_STATUS;
457
+ }
458
+
459
+ /**
460
+ * @return bool
461
+ */
462
+ public function isDisableModeAttribute()
463
+ {
464
+ return $this->getDisableMode() == self::DISABLE_MODE_ATTRIBUTE;
465
+ }
466
+
467
+ /**
468
+ * @return array
469
+ */
470
+ public function getDisableSource()
471
+ {
472
+ return array(
473
+ 'mode' => $this->getDisableMode(),
474
+ 'attribute' => $this->getData('disable_mode_attribute')
475
+ );
476
+ }
477
+
478
+ /**
479
+ * @return array
480
+ */
481
+ public function getDisableAttributes()
482
+ {
483
+ $attributes = array();
484
+ $src = $this->getDisableSource();
485
+
486
+ if ($src['mode'] == self::DISABLE_MODE_ATTRIBUTE) {
487
+ $attributes[] = $src['attribute'];
488
+ }
489
+
490
+ return $attributes;
491
+ }
492
+
493
+ //########################################
494
+
495
+ /**
496
+ * @return array
497
+ */
498
+ public function getTrackingAttributes()
499
+ {
500
+ return $this->getUsedAttributes();
501
+ }
502
+
503
+ /**
504
+ * @return array
505
+ */
506
+ public function getUsedAttributes()
507
+ {
508
+ return array_unique(array_merge(
509
+ $this->getRegularPriceAttributes(),
510
+ $this->getMinPriceAttributes(),
511
+ $this->getMaxPriceAttributes(),
512
+ $this->getDisableAttributes()
513
+ ));
514
+ }
515
+
516
+ //########################################
517
+
518
+ /**
519
+ * @param bool $asArrays
520
+ * @param string|array $columns
521
+ * @param bool $onlyPhysicalUnits
522
+ * @return array
523
+ */
524
+ public function getAffectedListingsProducts($asArrays = true, $columns = '*')
525
+ {
526
+ /** @var Ess_M2ePro_Model_Mysql4_Listing_Collection $listingCollection */
527
+ $listingCollection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing');
528
+ $listingCollection->addFieldToFilter('account_id', $this->getAccountId());
529
+ $listingCollection->getSelect()->reset(Zend_Db_Select::COLUMNS);
530
+ $listingCollection->getSelect()->columns('id');
531
+
532
+ /** @var Ess_M2ePro_Model_Mysql4_Listing_Product_Collection $listingProductCollection */
533
+ $listingProductCollection = Mage::helper('M2ePro/Component_Amazon')->getCollection('Listing_Product');
534
+ $listingProductCollection->addFieldToFilter('is_variation_parent', 0);
535
+ $listingProductCollection->addFieldToFilter('is_repricing', 1);
536
+ $listingProductCollection->addFieldToFilter('listing_id', array('in' => $listingCollection->getSelect()));
537
+
538
+ if (is_array($columns) && !empty($columns)) {
539
+ $listingProductCollection->getSelect()->reset(Zend_Db_Select::COLUMNS);
540
+ $listingProductCollection->getSelect()->columns($columns);
541
+ }
542
+
543
+ return $asArrays ? (array)$listingProductCollection->getData() : (array)$listingProductCollection->getItems();
544
+ }
545
+
546
+ public function setProcessRequired($newData, $oldData)
547
+ {
548
+ $listingsProducts = $this->getAffectedListingsProducts(true, array('id'));
549
+ if (empty($listingsProducts)) {
550
+ return;
551
+ }
552
+
553
+ $this->getResource()->setProcessRequired($newData, $oldData, $listingsProducts);
554
+ }
555
+
556
+ //########################################
557
+
558
+ public function save()
559
+ {
560
+ Mage::helper('M2ePro/Data_Cache_Permanent')->removeTagValues('account');
561
+ return parent::save();
562
+ }
563
+
564
+ public function delete()
565
+ {
566
+ Mage::helper('M2ePro/Data_Cache_Permanent')->removeTagValues('account');
567
+ return parent::delete();
568
+ }
569
+
570
+ //########################################
571
+ }
app/code/community/Ess/M2ePro/Model/Amazon/Listing.php CHANGED
@@ -990,6 +990,7 @@ class Ess_M2ePro_Model_Amazon_Listing extends Ess_M2ePro_Model_Component_Child_A
990
'sku' => $amazonListingOther->getSku(),
991
'online_price' => $amazonListingOther->getOnlinePrice(),
992
'online_qty' => $amazonListingOther->getOnlineQty(),
993
'is_afn_channel' => (int)$amazonListingOther->isAfnChannel(),
994
'is_isbn_general_id' => (int)$amazonListingOther->isIsbnGeneralId(),
995
'status' => $listingOtherProduct->getStatus(),
@@ -998,6 +999,17 @@ class Ess_M2ePro_Model_Amazon_Listing extends Ess_M2ePro_Model_Component_Child_A
998
999
$listingProduct->addData($dataForUpdate)->save();
1000
1001
return $listingProduct;
1002
}
1003
990
'sku' => $amazonListingOther->getSku(),
991
'online_price' => $amazonListingOther->getOnlinePrice(),
992
'online_qty' => $amazonListingOther->getOnlineQty(),
993
+ 'is_repricing' => (int)$amazonListingOther->isRepricing(),
994
'is_afn_channel' => (int)$amazonListingOther->isAfnChannel(),
995
'is_isbn_general_id' => (int)$amazonListingOther->isIsbnGeneralId(),
996
'status' => $listingOtherProduct->getStatus(),
999
1000
$listingProduct->addData($dataForUpdate)->save();
1001
1002
+ if ($amazonListingOther->isRepricing()) {
1003
+ $listingProductRepricing = Mage::getModel('M2ePro/Amazon_Listing_Product_Repricing');
1004
+ $listingProductRepricing->setData(array(
1005
+ 'listing_product_id' => $listingProduct->getId(),
1006
+ 'is_online_disabled' => $amazonListingOther->isRepricingDisabled(),
1007
+ 'update_date' => Mage::helper('M2ePro')->getCurrentGmtDate(),
1008
+ 'create_date' => Mage::helper('M2ePro')->getCurrentGmtDate(),
1009
+ ));
1010
+ $listingProductRepricing->save();
1011
+ }
1012
+
1013
return $listingProduct;
1014
}
1015
app/code/community/Ess/M2ePro/Model/Amazon/Listing/Other.php CHANGED
@@ -113,6 +113,24 @@ class Ess_M2ePro_Model_Amazon_Listing_Other extends Ess_M2ePro_Model_Component_C
113
Ess_M2ePro_Model_Amazon_Listing_Product::IS_ISBN_GENERAL_ID_YES;
114
}
115
116
//########################################
117
118
/**
113
Ess_M2ePro_Model_Amazon_Listing_Product::IS_ISBN_GENERAL_ID_YES;
114
}
115
116
+ // ---------------------------------------
117
+
118
+ /**
119
+ * @return bool
120
+ */
121
+ public function isRepricing()
122
+ {
123
+ return (bool)$this->getData('is_repricing');
124
+ }
125
+
126
+ /**
127
+ * @return bool
128
+ */
129