Skip to content

Commit de2c15d

Browse files
committed
1.13.0 (FINAL RELEASE)
1 parent 781e7ff commit de2c15d

File tree

152 files changed

+7324
-3001
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

152 files changed

+7324
-3001
lines changed

Block/Adminhtml/Amazon/Account/Edit/Tabs/Order.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -662,6 +662,33 @@ protected function _prepareForm()
662662
]
663663
);
664664

665+
$fieldset->addField(
666+
'magento_orders_tax_amazon_collects_for_uk_shipment',
667+
'select',
668+
[
669+
'container_id' => 'magento_orders_tax_amazon_collects_for_uk_shipment_container',
670+
'name' => 'magento_orders_settings[tax][amazon_collect_for_uk]',
671+
'label' => $this->__('Skip Tax in UK Orders'),
672+
'values' => [
673+
Account::SKIP_TAX_FOR_UK_SHIPMENT_NONE => $this->__('None'),
674+
Account::SKIP_TAX_FOR_UK_SHIPMENT => $this->__('All orders with UK shipments'),
675+
Account::SKIP_TAX_FOR_UK_SHIPMENT_WITH_CERTAIN_PRICE => $this->__(
676+
'Orders under 135GBP price'
677+
)
678+
],
679+
'value' => $formData['magento_orders_settings']['tax']['amazon_collect_for_uk'],
680+
'after_element_html' => $this->getTooltipHtml(
681+
$this->__(
682+
'The option allows skipping tax for orders with UK shipment.</br></br>
683+
<strong>None</strong> - the tax won\'t be skipped and will be displayed in all orders.</br></br>
684+
<strong>All orders with UK shipments</strong> - M2E Pro will skip tax for all orders with UK shipments.</br></br>
685+
<strong>Orders under 135GBP price</strong> -
686+
M2E Pro will skip tax only for orders with a total price of all products under 135GBP price.'
687+
)
688+
)
689+
]
690+
);
691+
665692
$fieldset->addField(
666693
'magento_orders_tax_excluded_states',
667694
'hidden',

Block/Adminhtml/Amazon/Listing/Other/View.php

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,7 @@ public function getGridHtml()
9595
);
9696
// ---------------------------------------
9797

98-
$mapToProductBlock = $this->createBlock(
99-
'Listing_Other_Mapping'
100-
);
101-
102-
return $viewHeaderBlock->toHtml() . $mapToProductBlock->toHtml() . parent::getGridHtml();
98+
return $viewHeaderBlock->toHtml() . parent::getGridHtml();
10399
}
104100

105101
//########################################
@@ -109,6 +105,13 @@ protected function _toHtml()
109105
$componentMode = \Ess\M2ePro\Helper\Component\Amazon::NICK;
110106

111107
$this->jsUrl->addUrls([
108+
'mapProductPopupHtml' => $this->getUrl(
109+
'*/listing_other_mapping/mapProductPopupHtml',
110+
[
111+
'account_id' => $this->getRequest()->getParam('account'),
112+
'marketplace_id' => $this->getRequest()->getParam('marketplace')
113+
]
114+
),
112115
'listing_other_mapping/map' => $this->getUrl('*/listing_other_mapping/map'),
113116

114117
'prepareData' => $this->getUrl('*/listing_other_moving/prepareMoveToListing'),
@@ -140,9 +143,8 @@ protected function _toHtml()
140143
'Map Item "%product_title%" with Magento Product'
141144
),
142145
'Product does not exist.' => $this->__('Product does not exist.'),
143-
'Please enter correct Product ID.' => $this->__('Please enter correct Product ID.'),
144146
'Product(s) was Mapped.' => $this->__('Product(s) was Mapped.'),
145-
'Please enter correct Product ID or SKU' => $this->__('Please enter correct Product ID or SKU'),
147+
'Mapping Product' => $this->__('Mapping Product'),
146148

147149
'Current version only supports Simple Products. Please, choose Simple Product.' => $this->__(
148150
'Current version only supports Simple Products. Please, choose Simple Product.'
@@ -184,7 +186,7 @@ protected function _toHtml()
184186
'p' => 'M2ePro/Plugin/ProgressBar',
185187
'a' => 'M2ePro/Plugin/AreaWrapper',
186188
'lm' => 'M2ePro/Listing/Moving',
187-
'lom' => 'M2ePro/Listing/Other/Mapping',
189+
'lom' => 'M2ePro/Listing/Mapping',
188190
'loa' => 'M2ePro/Listing/Other/AutoMapping',
189191
'lor' => 'M2ePro/Listing/Other/Removing',
190192
'lou' => 'M2ePro/Listing/Other/Unmapping',
@@ -197,8 +199,8 @@ protected function _toHtml()
197199
M2ePro.customData.componentMode = '{$componentMode}';
198200
M2ePro.customData.gridId = 'amazonListingOtherGrid';
199201
200-
window.AmazonListingOtherGridObj = new AmazonListingOtherGrid('amazonListingOtherGrid');
201-
window.AmazonListingOtherMappingObj = new ListingOtherMapping(AmazonListingOtherGridObj, 'amazon');
202+
window.AmazonListingOtherGridObj = new AmazonListingOtherGrid('amazonListingOtherGrid');
203+
window.ListingOtherMappingObj = new ListingMapping(AmazonListingOtherGridObj, 'amazon');
202204
203205
AmazonListingOtherGridObj.movingHandler.setProgressBar('listing_other_progress_bar');
204206
AmazonListingOtherGridObj.movingHandler.setGridWrapper('listing_other_content_container');

Block/Adminhtml/Amazon/Listing/Other/View/Grid.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,10 @@ public function callbackColumnProductId($value, $row, $column, $isExport)
229229
$productTitle = $this->getHelper('Data')->escapeHtml($productTitle);
230230
$productTitle = $this->getHelper('Data')->escapeJs($productTitle);
231231
$htmlValue = '&nbsp;<a href="javascript:void(0);"
232-
onclick="AmazonListingOtherMappingObj.openPopUp(\''.
233-
$productTitle.
234-
'\','.
235-
(int)$row->getId().
236-
');">' . $this->__('Map') . '</a>';
237-
232+
onclick="ListingOtherMappingObj.openPopUp(
233+
'. (int)$row->getId(). ',
234+
\''. $productTitle. '\'
235+
);">' . $this->__('Map') . '</a>';
238236
return $htmlValue;
239237
}
240238

Block/Adminhtml/Amazon/Listing/Search/AbstractGrid.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -591,5 +591,24 @@ protected function _toHtml()
591591
return parent::_toHtml();
592592
}
593593

594+
protected function isFilterOrSortByPriceIsUsed($filterName = null, $advancedFilterName = null)
595+
{
596+
if ($filterName) {
597+
$filters = $this->getParam($this->getVarNameFilter());
598+
is_string($filters) && $filters = $this->_backendHelper->prepareFilterString($filters);
599+
600+
if (is_array($filters) && array_key_exists($filterName, $filters)) {
601+
return true;
602+
}
603+
604+
$sort = $this->getParam($this->getVarNameSort());
605+
if ($sort == $filterName) {
606+
return true;
607+
}
608+
}
609+
610+
return false;
611+
}
612+
594613
//########################################
595614
}

Block/Adminhtml/Amazon/Listing/View.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,15 @@ public function getGridHtml()
209209
$this->jsUrl->add($this->getUrl('*/listing_moving/prepareMoveToListing'), 'prepareData');
210210
$this->jsUrl->add($this->getUrl('*/listing_moving/moveToListing'), 'moveToListing');
211211

212+
$this->jsUrl->add($this->getUrl(
213+
'*/listing_mapping/mapProductPopupHtml',
214+
[
215+
'account_id' => $this->listing->getAccountId(),
216+
'marketplace_id' => $this->listing->getMarketplaceId()
217+
]
218+
), 'mapProductPopupHtml');
219+
$this->jsUrl->add($this->getUrl('*/listing_mapping/remap'), 'listing_mapping/remap');
220+
212221
$this->jsUrl->add($this->getUrl('*/amazon_marketplace/index'), 'marketplaceSynchUrl');
213222

214223
$this->jsUrl->add($this->getUrl('*/listing/saveListingAdditionalData', [
@@ -315,6 +324,7 @@ public function getGridHtml()
315324
'Rule with the same Title already exists.' => $this->__('Rule with the same Title already exists.'),
316325
'Sell on Another Marketplace' => $this->__('Sell on Another Marketplace'),
317326
'Create new' => $this->__('Create new'),
327+
'Mapping Product' => $this->__('Mapping Product'),
318328

319329
'Add New Shipping Policy' => $this->__('Add New Shipping Policy'),
320330
'Add New Product Tax Code Policy' => $this->__('Add New Product Tax Code Policy'),

Block/Adminhtml/Amazon/Listing/View/Amazon/Grid.php

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,28 +79,18 @@ public function _construct()
7979

8080
protected function _prepareCollection()
8181
{
82-
// Get collection
83-
// ---------------------------------------
8482
/** @var $collection \Ess\M2ePro\Model\ResourceModel\Magento\Product\Collection */
8583
$collection = $this->magentoProductCollectionFactory->create();
8684

8785
$collection->setListingProductModeOn();
8886
$collection->setStoreId($this->listing->getStoreId());
8987
$collection->setListing($this->listing->getId());
9088

91-
if ($this->isFilterOrSortByPriceIsUsed('online_price', 'amazon_online_price')) {
92-
$collection->setIsNeedToUseIndexerParent(true);
93-
}
94-
9589
$collection
9690
->addAttributeToSelect('name')
9791
->addAttributeToSelect('sku')
9892
->joinStockItem();
9993

100-
// ---------------------------------------
101-
102-
// Join listing product tables
103-
// ---------------------------------------
10494
$lpTable = $this->activeRecordFactory->getObject('Listing\Product')->getResource()->getMainTable();
10595
$collection->joinTable(
10696
['lp' => $lpTable],
@@ -162,7 +152,7 @@ protected function _prepareCollection()
162152
]
163153
);
164154

165-
if ($collection->isNeedUseIndexerParent()) {
155+
if ($this->isFilterOrSortByPriceIsUsed('online_price', 'amazon_online_price')) {
166156
$collection->joinIndexerParent();
167157
} else {
168158
$collection->setIsNeedToInjectPrices(true);

Block/Adminhtml/Amazon/Listing/View/Settings/Grid.php

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,18 @@ public function _construct()
5454

5555
protected function _prepareCollection()
5656
{
57-
// Get collection
58-
// ---------------------------------------
5957
/** @var $collection \Ess\M2ePro\Model\ResourceModel\Magento\Product\Collection */
6058
$collection = $this->magentoProductCollectionFactory->create();
6159

6260
$collection->setListingProductModeOn();
6361
$collection->setStoreId($this->listing->getStoreId());
6462
$collection->setListing($this->listing->getId());
6563

66-
if ($this->isFilterOrSortByPriceIsUsed(null, 'amazon_online_price')) {
67-
$collection->setIsNeedToUseIndexerParent(true);
68-
}
69-
7064
$collection
7165
->addAttributeToSelect('name')
7266
->addAttributeToSelect('sku')
7367
->joinStockItem();
7468

75-
// ---------------------------------------
76-
77-
// Join listing product tables
78-
// ---------------------------------------
7969
$lpTable = $this->activeRecordFactory->getObject('Listing\Product')->getResource()->getMainTable();
8070
$collection->joinTable(
8171
['lp' => $lpTable],
@@ -168,13 +158,10 @@ protected function _prepareCollection()
168158
);
169159
}
170160

171-
if ($collection->isNeedUseIndexerParent()) {
161+
if ($this->isFilterOrSortByPriceIsUsed(null, 'amazon_online_price')) {
172162
$collection->joinIndexerParent();
173163
}
174164

175-
// ---------------------------------------
176-
177-
// Set collection to grid
178165
$this->setCollection($collection);
179166

180167
return parent::_prepareCollection();
@@ -286,7 +273,8 @@ protected function getGroupOrder()
286273
{
287274
$groups = [
288275
'edit_template_description' => $this->__('Description Policy'),
289-
'edit_template_shipping' => $this->__('Shipping Policy')
276+
'edit_template_shipping' => $this->__('Shipping Policy'),
277+
'other' => $this->__('Other')
290278
];
291279

292280
if ($this->listing->getMarketplace()->getChildObject()->isProductTaxCodePolicyAvailable() &&
@@ -348,6 +336,15 @@ protected function getColumnActionsItems()
348336
];
349337
}
350338

339+
$actions['remapProduct'] = [
340+
'caption' => $this->__('Link to another Magento Product'),
341+
'group' => 'other',
342+
'field' => 'id',
343+
'only_remap_product' => true,
344+
'style' => 'width: 130px',
345+
'onclick_action' => 'ListingGridObj.actions[\'remapProductAction\']'
346+
];
347+
351348
return $actions;
352349
}
353350

Block/Adminhtml/Amazon/Order/Grid.php

Lines changed: 63 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,44 @@ protected function _prepareColumns()
225225
'frame_callback' => [$this, 'callbackColumnStatus']
226226
]);
227227

228+
$this->addColumn('actions', [
229+
'header' => $this->__('Actions'),
230+
'align' => 'left',
231+
'width' => '100px',
232+
'type' => 'action',
233+
'index' => 'actions',
234+
'filter' => false,
235+
'sortable' => false,
236+
'renderer' => '\Ess\M2ePro\Block\Adminhtml\Magento\Grid\Column\Renderer\Action',
237+
'getter' => 'getId',
238+
'actions' => [
239+
[
240+
'caption' => $this->__('View'),
241+
'url' => [
242+
'base' => '*/amazon_order/view'
243+
],
244+
'field' => 'id'
245+
],
246+
[
247+
'caption' => $this->__('Create Magento Order'),
248+
'url' => [
249+
'base' => '*/amazon_order/createMagentoOrder',
250+
],
251+
'field' => 'id'
252+
],
253+
[
254+
'caption' => $this->__('Mark As Shipped'),
255+
'field' => 'id',
256+
'onclick_action' => 'AmazonOrderMerchantFulfillmentObj.markAsShippedAction'
257+
],
258+
[
259+
'caption' => $this->__('Amazon\'s Shipping Services'),
260+
'field' => 'id',
261+
'onclick_action' => 'AmazonOrderMerchantFulfillmentObj.getPopupAction'
262+
]
263+
]
264+
]);
265+
228266
return parent::_prepareColumns();
229267
}
230268

@@ -591,46 +629,61 @@ public function getRowUrl($row)
591629
return $this->getUrl('*/amazon_order/view', ['id' => $row->getId(), 'back' => $back]);
592630
}
593631

594-
protected function _toHtml()
632+
protected function _prepareLayout()
595633
{
596634
if ($this->getRequest()->isXmlHttpRequest()) {
597635
$this->js->add(
598636
<<<JS
599637
OrderObj.initializeGrids();
600638
JS
601639
);
602-
603-
return parent::_toHtml();
604640
}
605641

606-
$tempGridIds = [];
607-
$this->getHelper('Component\Amazon')->isEnabled() && $tempGridIds[] = $this->getId();
608-
609-
$tempGridIds = $this->getHelper('Data')->jsonEncode($tempGridIds);
610-
611642
$this->jsPhp->addConstants($this->getHelper('Data')
612643
->getClassConstants(\Ess\M2ePro\Model\Log\AbstractModel::class));
613644

614645
$this->jsUrl->addUrls([
615646
'amazon_order/view' => $this->getUrl(
616647
'*/amazon_order/view',
617648
['back'=>$this->getHelper('Data')->makeBackUrlParam('*/amazon_order/index')]
649+
),
650+
'getEditShippingAddressForm' => $this->getUrl(
651+
'*/amazon_order_shippingAddress/edit/'
618652
)
619653
]);
654+
$this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Amazon\Order'));
655+
$this->jsUrl->addUrls($this->getHelper('Data')->getControllerActions('Amazon\Order\MerchantFulfillment'));
656+
657+
$this->jsTranslator->addTranslations([
658+
'View Full Order Log' => $this->__('View Full Order Log'),
659+
'Amazon\'s Shipping Services' => $this->__('Amazon\'s Shipping Services'),
660+
'Please select an option.' => $this->__('Please select an option.'),
661+
'This is a required fields.' => $this->__('This is a required fields.'),
662+
'Please enter a number greater than 0 in this fields.' =>
663+
$this->__('Please enter a number greater than 0 in this fields.'),
664+
'Are you sure you want to create Shipment now?' =>
665+
$this->__('Are you sure you want to create Shipment now?'),
666+
'Please enter a valid date.' => $this->__('Please enter a valid date.'),
667+
]);
620668

621-
$this->jsTranslator->add('View Full Order Log', $this->__('View Full Order Log'));
669+
$tempGridIds = [];
670+
$this->getHelper('Component\Amazon')->isEnabled() && $tempGridIds[] = $this->getId();
671+
672+
$tempGridIds = $this->getHelper('Data')->jsonEncode($tempGridIds);
622673

623674
$this->js->add(<<<JS
624675
require([
625676
'M2ePro/Order',
677+
'M2ePro/Amazon/Order/MerchantFulfillment'
626678
], function(){
679+
window.AmazonOrderMerchantFulfillmentObj = new AmazonOrderMerchantFulfillment();
627680
window.OrderObj = new Order('$tempGridIds');
628681
OrderObj.initializeGrids();
629682
});
630683
JS
631684
);
632685

633-
return parent::_toHtml();
686+
return parent::_prepareLayout();
634687
}
635688

636689
//########################################

0 commit comments

Comments
 (0)