From 70a96e83692400503f2fa39ece22b3e8cca3173c Mon Sep 17 00:00:00 2001 From: Raphael Petrini Date: Wed, 9 Mar 2016 14:58:52 +0100 Subject: [PATCH 01/10] fix issue #3704 regarding integer attribute values being cast to decimal --- .../Eav/Model/Entity/Collection/AbstractCollection.php | 6 +++++- app/code/Magento/Eav/Model/ResourceModel/Helper.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 0e151c5de831f..0780129130212 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -1175,7 +1175,11 @@ public function _loadAttributes($printQuery = false, $logQuery = false) foreach ($selectGroups as $selects) { if (!empty($selects)) { try { - $select = implode(' UNION ALL ', $selects); + if (is_array($selects)) + { + $select = implode(' UNION ALL ', $selects); + } + else $select = $selects; $values = $this->getConnection()->fetchAll($select); } catch (\Exception $e) { $this->printLogQuery(true, true, $select); diff --git a/app/code/Magento/Eav/Model/ResourceModel/Helper.php b/app/code/Magento/Eav/Model/ResourceModel/Helper.php index 994b131bfd78f..2521e76af3e4c 100644 --- a/app/code/Magento/Eav/Model/ResourceModel/Helper.php +++ b/app/code/Magento/Eav/Model/ResourceModel/Helper.php @@ -80,6 +80,6 @@ public function getLoadAttributesSelectGroups($selects) foreach ($selects as $selectGroup) { $mainGroup = array_merge($mainGroup, $selectGroup); } - return [$mainGroup]; + return $mainGroup; } } From 516bbe8dbb6b792d2dc92296e5c6aee53269a007 Mon Sep 17 00:00:00 2001 From: Raphael Petrini Date: Wed, 9 Mar 2016 16:40:45 +0100 Subject: [PATCH 02/10] fix code style --- .../Eav/Model/Entity/Collection/AbstractCollection.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php index 0780129130212..8114b0db256fd 100644 --- a/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php +++ b/app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php @@ -1175,11 +1175,11 @@ public function _loadAttributes($printQuery = false, $logQuery = false) foreach ($selectGroups as $selects) { if (!empty($selects)) { try { - if (is_array($selects)) - { + if (is_array($selects)) { $select = implode(' UNION ALL ', $selects); + } else { + $select = $selects; } - else $select = $selects; $values = $this->getConnection()->fetchAll($select); } catch (\Exception $e) { $this->printLogQuery(true, true, $select); From 3f9b64b5bed667c0a03070270bbcdc62898b65ba Mon Sep 17 00:00:00 2001 From: Raphael Petrini Date: Thu, 10 Mar 2016 09:37:12 +0100 Subject: [PATCH 03/10] apply fix to the AbstractEntity --- app/code/Magento/Eav/Model/Entity/AbstractEntity.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php index f9bc1bb9617d7..d6aaab6c34d56 100644 --- a/app/code/Magento/Eav/Model/Entity/AbstractEntity.php +++ b/app/code/Magento/Eav/Model/Entity/AbstractEntity.php @@ -1064,7 +1064,11 @@ protected function _loadModelAttributes($object) $selectGroups = $this->_resourceHelper->getLoadAttributesSelectGroups($selects); foreach ($selectGroups as $selects) { if (!empty($selects)) { - $select = $this->_prepareLoadSelect($selects); + if (is_array($selects)) { + $select = $this->_prepareLoadSelect($selects); + } else { + $select = $selects; + } $values = $this->getConnection()->fetchAll($select); foreach ($values as $valueRow) { $this->_setAttributeValue($object, $valueRow); From a4830a20d10f6315ace9dd7f758320af1ae93795 Mon Sep 17 00:00:00 2001 From: Yurii Torbyk Date: Sat, 12 Mar 2016 21:26:26 +0200 Subject: [PATCH 04/10] Add ability to show custom error message on Authorizenet place order --- .../Authorizenet/Controller/Directpost/Payment/Place.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php index 2cb3ea5421054..86caa3eac715f 100644 --- a/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php +++ b/app/code/Magento/Authorizenet/Controller/Directpost/Payment/Place.php @@ -15,6 +15,7 @@ use Magento\Framework\Registry; use Magento\Payment\Model\IframeConfigProvider; use Magento\Quote\Api\CartManagementInterface; +use Magento\Framework\Exception\LocalizedException; /** * Class Place @@ -125,6 +126,9 @@ protected function placeCheckoutOrder() 'action' => $this ] ); + } catch (LocalizedException $exception) { + $result->setData('error', true); + $result->setData('error_messages', $exception->getMessage()); } catch (\Exception $exception) { $result->setData('error', true); $result->setData('error_messages', __('Cannot place order.')); From a551025a2a9fa2388301167723d120938b020482 Mon Sep 17 00:00:00 2001 From: ddonnini Date: Tue, 22 Mar 2016 12:15:03 +0100 Subject: [PATCH 05/10] Fixes _toHtml method of Checkout/Block/Cart/Link class --- app/code/Magento/Checkout/Block/Cart/Link.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Block/Cart/Link.php b/app/code/Magento/Checkout/Block/Cart/Link.php index 1319ac9888db4..5b4a9aabd6b21 100644 --- a/app/code/Magento/Checkout/Block/Cart/Link.php +++ b/app/code/Magento/Checkout/Block/Cart/Link.php @@ -65,7 +65,7 @@ public function getHref() */ protected function _toHtml() { - if ($this->_moduleManager->isOutputEnabled('Magento_Checkout')) { + if (!$this->_moduleManager->isOutputEnabled('Magento_Checkout')) { return ''; } return parent::_toHtml(); From 6d6cb82c4ee01924d3f969082968ed9ac831ced7 Mon Sep 17 00:00:00 2001 From: ddonnini Date: Tue, 22 Mar 2016 12:16:22 +0100 Subject: [PATCH 06/10] Update LinkTest --- app/code/Magento/Checkout/Test/Unit/Block/Cart/LinkTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/Test/Unit/Block/Cart/LinkTest.php b/app/code/Magento/Checkout/Test/Unit/Block/Cart/LinkTest.php index 453fac8dd5fa6..528a4e3e49ae7 100644 --- a/app/code/Magento/Checkout/Test/Unit/Block/Cart/LinkTest.php +++ b/app/code/Magento/Checkout/Test/Unit/Block/Cart/LinkTest.php @@ -57,7 +57,7 @@ public function testToHtml() )->with( 'Magento_Checkout' )->will( - $this->returnValue(true) + $this->returnValue(false) ); $this->assertSame('', $block->toHtml()); } From 2ae3d5ed22bd01ee2b237ce73f518f1097f2dd4c Mon Sep 17 00:00:00 2001 From: mamzellejuu Date: Tue, 5 Apr 2016 10:00:54 -0400 Subject: [PATCH 07/10] Add the $t to translate the message --- .../Magento/Checkout/view/frontend/web/js/view/shipping.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index 1c28c2a444129..f17f684206150 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -245,10 +245,11 @@ define( var shippingAddress, addressData, loginFormSelector = 'form[data-role=email-with-possible-login]', - emailValidationResult = customer.isLoggedIn(); + emailValidationResult = customer.isLoggedIn(), + errortext = $t('Please specify a shipping method.'); if (!quote.shippingMethod()) { - this.errorValidationMessage('Please specify a shipping method.'); + this.errorValidationMessage(errortext); return false; } From 8bd2dc1b52ff0848faf94f786710fc0685c2f375 Mon Sep 17 00:00:00 2001 From: mamzellejuu Date: Wed, 6 Apr 2016 13:05:28 -0400 Subject: [PATCH 08/10] Add the $t to translate the message --- .../Magento/Checkout/view/frontend/web/js/view/shipping.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index f17f684206150..f6e076763ee72 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -245,11 +245,10 @@ define( var shippingAddress, addressData, loginFormSelector = 'form[data-role=email-with-possible-login]', - emailValidationResult = customer.isLoggedIn(), - errortext = $t('Please specify a shipping method.'); + emailValidationResult = customer.isLoggedIn(); if (!quote.shippingMethod()) { - this.errorValidationMessage(errortext); + this.errorValidationMessage($t('Please specify a shipping method.')); return false; } From 5f4d342f31f394186a3853aa0a11a41f6767972f Mon Sep 17 00:00:00 2001 From: mamzellejuu Date: Wed, 6 Apr 2016 14:10:36 -0400 Subject: [PATCH 09/10] use $.mage.__('') otherwise $t() because is doesn't seem to translate it --- app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js index f6e076763ee72..3daee38a76b5c 100644 --- a/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js +++ b/app/code/Magento/Checkout/view/frontend/web/js/view/shipping.js @@ -248,7 +248,7 @@ define( emailValidationResult = customer.isLoggedIn(); if (!quote.shippingMethod()) { - this.errorValidationMessage($t('Please specify a shipping method.')); + this.errorValidationMessage($.mage.__('Please specify a shipping method.')); return false; } From 228dc003cd689095ededf7078273ce3e5dcf5068 Mon Sep 17 00:00:00 2001 From: liolemaire Date: Wed, 20 Apr 2016 13:14:30 +0200 Subject: [PATCH 10/10] Attribute Model specifiable in Propertymapper This way you can specify an attribute model using data upgrade script. Multi select attribute only work if there is a backend model specified. --- app/code/Magento/Eav/Model/Entity/Setup/PropertyMapper.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/code/Magento/Eav/Model/Entity/Setup/PropertyMapper.php b/app/code/Magento/Eav/Model/Entity/Setup/PropertyMapper.php index a87aa208cbec5..5919527a0d56d 100644 --- a/app/code/Magento/Eav/Model/Entity/Setup/PropertyMapper.php +++ b/app/code/Magento/Eav/Model/Entity/Setup/PropertyMapper.php @@ -22,6 +22,7 @@ class PropertyMapper extends PropertyMapperAbstract public function map(array $input, $entityTypeId) { return [ + 'attribute_model' => $this->_getValue($input, 'attribute_model'), 'backend_model' => $this->_getValue($input, 'backend'), 'backend_type' => $this->_getValue($input, 'type', 'varchar'), 'backend_table' => $this->_getValue($input, 'table'),