diff --git a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Create/Selling/Form.php b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Create/Selling/Form.php index d2c42eb0..b48ce4db 100644 --- a/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Create/Selling/Form.php +++ b/app/code/community/Ess/M2ePro/Block/Adminhtml/Amazon/Listing/Create/Selling/Form.php @@ -1247,7 +1247,7 @@ protected function getListingData() $data = array_merge($this->getDefaultFieldsValues(), $data); } - if (!empty($data['restock_date_value']) && strtotime($data['restock_date_value'])) { + if ($this->getRequest()->getParam('id') !== null && !empty($data['restock_date_value']) && strtotime($data['restock_date_value'])) { $data['restock_date_value'] = Mage::helper('M2ePro')->gmtDateToTimezone($data['restock_date_value']); } diff --git a/app/code/community/Ess/M2ePro/CHANGELOG b/app/code/community/Ess/M2ePro/CHANGELOG index dec0d04c..175763f2 100644 --- a/app/code/community/Ess/M2ePro/CHANGELOG +++ b/app/code/community/Ess/M2ePro/CHANGELOG @@ -1,4 +1,9 @@ -* 6.22.2 (27/05/2022) +* 6.23.0 (30/05/2022) + +Common: [Added] Possibility to disable import of Ship by date to Magento orders [#3504] +Amazon: [Fixed] The time is offset according to the Magento time zone when the Restock Date is set to a Custom Value [#3533] + +* 6.22.2 (27/05/2022) eBay: [Fixed] Message "The Sell API token for eBay Account expires. You need to generate a new access token to reauthorize M2E Pro" after the upgrade to v6.22.1 [#3648] diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Account.php b/app/code/community/Ess/M2ePro/Model/Amazon/Account.php index 64295183..233bc637 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Account.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Account.php @@ -388,6 +388,18 @@ public function isOtherListingsMappingEnabled() return $this->getOtherListingsMappingMode() == 1; } + /** + * @return bool + */ + public function isImportShipByDateToMagentoOrder() + { + return (bool)$this->getSetting( + 'magento_orders_settings', + array('shipping_information', 'ship_by_date'), + true + ); + } + // --------------------------------------- /** diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Account/Builder.php b/app/code/community/Ess/M2ePro/Model/Amazon/Account/Builder.php index 7fade86e..29dea6e6 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Account/Builder.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Account/Builder.php @@ -310,7 +310,13 @@ protected function prepareData() } } - $data['magento_orders_settings'] = Mage::helper('M2ePro')->jsonEncode($data['magento_orders_settings']); + $data['magento_orders_settings']['shipping_information']['ship_by_date'] + = isset($this->_rawData['magento_orders_settings']['shipping_information']['ship_by_date']) + ? (int)$this->_rawData['magento_orders_settings']['shipping_information']['ship_by_date'] + : 1; + + $data['magento_orders_settings'] = Mage::helper('M2ePro') + ->jsonEncode($data['magento_orders_settings']); // tab: vat calculation service // --------------------------------------- @@ -404,7 +410,10 @@ public function getDefaultData() 'store_mode' => 0, 'store_id' => null, 'stock_mode' => 0 - ) + ), + 'shipping_information' => array( + 'ship_by_date' => 1, + ), ), // vcs_upload_invoices diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Order/Proxy.php b/app/code/community/Ess/M2ePro/Model/Amazon/Order/Proxy.php index d49b2f04..f6c898df 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Order/Proxy.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Order/Proxy.php @@ -204,7 +204,12 @@ public function getShippingData() } } - if ($shippingDateTo = $this->_order->getShippingDateTo()) { + $shippingDateTo = $this->_order->getShippingDateTo(); + $isImportShipByDate = $this->_order + ->getAmazonAccount() + ->isImportShipByDateToMagentoOrder(); + + if ($shippingDateTo && $isImportShipByDate) { $additionalData .= 'Ship By Date: ' . Mage::helper('core')->formatDate($shippingDateTo, 'medium', true) . ' | '; diff --git a/app/code/community/Ess/M2ePro/Model/Ebay/Account.php b/app/code/community/Ess/M2ePro/Model/Ebay/Account.php index 22a2e964..135122eb 100644 --- a/app/code/community/Ess/M2ePro/Model/Ebay/Account.php +++ b/app/code/community/Ess/M2ePro/Model/Ebay/Account.php @@ -183,6 +183,18 @@ public function isModeSandbox() return $this->getMode() == self::MODE_SANDBOX; } + /** + * @return bool + */ + public function isImportShipByDateToMagentoOrder() + { + return (bool)$this->getSetting( + 'magento_orders_settings', + array('shipping_information', 'ship_by_date'), + true + ); + } + // --------------------------------------- /** diff --git a/app/code/community/Ess/M2ePro/Model/Ebay/Account/Builder.php b/app/code/community/Ess/M2ePro/Model/Ebay/Account/Builder.php index 8afa5237..c6ee757d 100644 --- a/app/code/community/Ess/M2ePro/Model/Ebay/Account/Builder.php +++ b/app/code/community/Ess/M2ePro/Model/Ebay/Account/Builder.php @@ -321,7 +321,13 @@ protected function prepareData() } } - $data['magento_orders_settings'] = Mage::helper('M2ePro')->jsonEncode($data['magento_orders_settings']); + $data['magento_orders_settings']['shipping_information']['ship_by_date'] + = isset($this->_rawData['magento_orders_settings']['shipping_information']['ship_by_date']) + ? (int)$this->_rawData['magento_orders_settings']['shipping_information']['ship_by_date'] + : 1; + + $data['magento_orders_settings'] = Mage::helper('M2ePro') + ->jsonEncode($data['magento_orders_settings']); // tab invoice and shipment // --------------------------------------- @@ -422,6 +428,9 @@ public function getDefaultData() 'refund_and_cancellation' => array( 'refund_mode' => 0, ), + 'shipping_information' => array( + 'ship_by_date' => 1, + ), ), 'create_magento_invoice' => 1, diff --git a/app/code/community/Ess/M2ePro/Model/Ebay/Order/Proxy.php b/app/code/community/Ess/M2ePro/Model/Ebay/Order/Proxy.php index a0f440ed..41356ab0 100644 --- a/app/code/community/Ess/M2ePro/Model/Ebay/Order/Proxy.php +++ b/app/code/community/Ess/M2ePro/Model/Ebay/Order/Proxy.php @@ -322,7 +322,12 @@ public function getShippingData() } } - if ($shippingDateTo = $this->_order->getShippingDateTo()) { + $shippingDateTo = $this->_order->getShippingDateTo(); + $isImportShipByDate = $this->_order + ->getEbayAccount() + ->isImportShipByDateToMagentoOrder(); + + if ($shippingDateTo && $isImportShipByDate) { $additionalData .= 'Ship By Date: ' . Mage::helper('core')->formatDate($shippingDateTo, 'medium', true) . ' | '; diff --git a/app/code/community/Ess/M2ePro/Model/Walmart/Account.php b/app/code/community/Ess/M2ePro/Model/Walmart/Account.php index 735af8e4..29bc0bfc 100644 --- a/app/code/community/Ess/M2ePro/Model/Walmart/Account.php +++ b/app/code/community/Ess/M2ePro/Model/Walmart/Account.php @@ -431,6 +431,18 @@ public function isOtherListingsMappingEnabled() return $this->getOtherListingsMappingMode() == 1; } + /** + * @return bool + */ + public function isImportShipByDateToMagentoOrder() + { + return (bool)$this->getSetting( + 'magento_orders_settings', + array('shipping_information', 'ship_by_date'), + true + ); + } + // --------------------------------------- /** diff --git a/app/code/community/Ess/M2ePro/Model/Walmart/Account/Builder.php b/app/code/community/Ess/M2ePro/Model/Walmart/Account/Builder.php index 399cec2c..8b5ced84 100644 --- a/app/code/community/Ess/M2ePro/Model/Walmart/Account/Builder.php +++ b/app/code/community/Ess/M2ePro/Model/Walmart/Account/Builder.php @@ -280,7 +280,13 @@ protected function prepareData() } } - $data['magento_orders_settings'] = Mage::helper('M2ePro')->jsonEncode($data['magento_orders_settings']); + $data['magento_orders_settings']['shipping_information']['ship_by_date'] + = isset($this->_rawData['magento_orders_settings']['shipping_information']['ship_by_date']) + ? (int)$this->_rawData['magento_orders_settings']['shipping_information']['ship_by_date'] + : 1; + + $data['magento_orders_settings'] = Mage::helper('M2ePro') + ->jsonEncode($data['magento_orders_settings']); // tab invoice and shipment // --------------------------------------- @@ -367,6 +373,9 @@ public function getDefaultData() 'refund_and_cancellation' => array( 'refund_mode' => 1, ), + 'shipping_information' => array( + 'ship_by_date' => 1, + ), ), 'create_magento_invoice' => 1, 'create_magento_shipment' => 1, diff --git a/app/code/community/Ess/M2ePro/Model/Walmart/Order/Proxy.php b/app/code/community/Ess/M2ePro/Model/Walmart/Order/Proxy.php index 63175edf..32243fff 100644 --- a/app/code/community/Ess/M2ePro/Model/Walmart/Order/Proxy.php +++ b/app/code/community/Ess/M2ePro/Model/Walmart/Order/Proxy.php @@ -80,7 +80,12 @@ public function getShippingData() { $additionalData = ''; - if ($shippingDateTo = $this->_order->getShippingDateTo()) { + $shippingDateTo = $this->_order->getShippingDateTo(); + $isImportShipByDate = $this->_order + ->getWalmartAccount() + ->isImportShipByDateToMagentoOrder(); + + if ($shippingDateTo && $isImportShipByDate) { $additionalData .= 'Ship By Date: ' . Mage::helper('core')->formatDate($shippingDateTo, 'medium', true) . ' | '; diff --git a/app/code/community/Ess/M2ePro/composer.json b/app/code/community/Ess/M2ePro/composer.json index 1856e391..338c8b78 100644 --- a/app/code/community/Ess/M2ePro/composer.json +++ b/app/code/community/Ess/M2ePro/composer.json @@ -2,7 +2,7 @@ "name": "m2epro/magento1-extension", "description": "M2E Pro is a Magento trusted (TM), award-winning extension, which allows merchants of all sizes to fully integrate Magento based system(s) into eBay/Amazon/Walmart platforms.", "type": "magento-module", - "version": "6.22.2", + "version": "6.23.0", "license": "proprietary", "keywords": ["ebay", "amazon", "walmart", "magento"], "homepage": "https://www.m2epro.com/", diff --git a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Amazon/Listing/CreateController.php b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Amazon/Listing/CreateController.php index 6574a7d4..71021044 100644 --- a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Amazon/Listing/CreateController.php +++ b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Amazon/Listing/CreateController.php @@ -222,7 +222,7 @@ protected function createListing() if ($this->getSessionValue('restock_date_value') === '') { $data['restock_date_value'] = Mage::helper('M2ePro')->getCurrentGmtDate(); } else { - $data['restock_date_value'] = Mage::helper('M2ePro')->gmtDateToTimezone( + $data['restock_date_value'] = Mage::helper('M2ePro')->timezoneDateToGmt( $this->getSessionValue('restock_date_value') ); } diff --git a/app/code/community/Ess/M2ePro/etc/config.xml b/app/code/community/Ess/M2ePro/etc/config.xml index a5fc5902..fe3408c2 100644 --- a/app/code/community/Ess/M2ePro/etc/config.xml +++ b/app/code/community/Ess/M2ePro/etc/config.xml @@ -2,7 +2,7 @@ - 6.22.2 + 6.23.0 diff --git a/app/code/community/Ess/M2ePro/sql/Upgrade/v6_22_2__v6_23_0/Config.php b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_22_2__v6_23_0/Config.php new file mode 100644 index 00000000..91a3540d --- /dev/null +++ b/app/code/community/Ess/M2ePro/sql/Upgrade/v6_22_2__v6_23_0/Config.php @@ -0,0 +1,15 @@ + +
+ +
+

__('Shipping information'); ?>

+
+ +
+
+ + + + + + + + +
+ + + +
+ +
+
+ +
> diff --git a/app/design/adminhtml/default/default/template/M2ePro/ebay/account/tabs/order.phtml b/app/design/adminhtml/default/default/template/M2ePro/ebay/account/tabs/order.phtml index 245b4766..5c51c2c1 100644 --- a/app/design/adminhtml/default/default/template/M2ePro/ebay/account/tabs/order.phtml +++ b/app/design/adminhtml/default/default/template/M2ePro/ebay/account/tabs/order.phtml @@ -289,6 +289,36 @@
+
+ +
+

__('Shipping information'); ?>

+
+ +
+
+ + + + + + + + +
+ + + +
+ +
+
+ +
+
>
diff --git a/app/design/adminhtml/default/default/template/M2ePro/walmart/account/tabs/order.phtml b/app/design/adminhtml/default/default/template/M2ePro/walmart/account/tabs/order.phtml index 9940781c..289f96b4 100644 --- a/app/design/adminhtml/default/default/template/M2ePro/walmart/account/tabs/order.phtml +++ b/app/design/adminhtml/default/default/template/M2ePro/walmart/account/tabs/order.phtml @@ -209,6 +209,36 @@
+
+ +
+

__('Shipping information'); ?>

+
+ +
+
+ + + + + + + + +
+ + + +
+ +
+
+ +
+
>
diff --git a/composer.json b/composer.json index 1856e391..338c8b78 100644 --- a/composer.json +++ b/composer.json @@ -2,7 +2,7 @@ "name": "m2epro/magento1-extension", "description": "M2E Pro is a Magento trusted (TM), award-winning extension, which allows merchants of all sizes to fully integrate Magento based system(s) into eBay/Amazon/Walmart platforms.", "type": "magento-module", - "version": "6.22.2", + "version": "6.23.0", "license": "proprietary", "keywords": ["ebay", "amazon", "walmart", "magento"], "homepage": "https://www.m2epro.com/",