Skip to content

Commit 3b5260e

Browse files
committed
MAGETWO-54200: Wrong "gift_message_available" parameter exported
1 parent 81a5c5a commit 3b5260e

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

app/code/Magento/CatalogImportExport/Model/Export/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class Product extends \Magento\ImportExport\Model\Export\Entity\AbstractEntity
8484
* @var string[]
8585
*/
8686
protected $_indexValueAttributes = [
87-
'status'
87+
'status',
8888
];
8989

9090
/**

app/code/Magento/GiftMessage/Model/GiftMessageConfigProvider.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,13 @@ protected function getItemLevelGiftMessages()
181181
$itemLevelConfig[$itemId] = [];
182182
$isMessageAvailable = $item->getProduct()->getGiftMessageAvailable();
183183

184-
if ($isMessageAvailable == Boolean::VALUE_USE_CONFIG || in_array($isMessageAvailable, [null, ''], true)) {
184+
if ($isMessageAvailable == Boolean::VALUE_USE_CONFIG) {
185185
$itemLevelConfig[$itemId]['is_available'] = (bool)$this->scopeConfiguration->getValue(
186186
GiftMessageHelper::XPATH_CONFIG_GIFT_MESSAGE_ALLOW_ITEMS,
187187
ScopeInterface::SCOPE_STORE
188188
);
189+
} else {
190+
$itemLevelConfig[$itemId]['is_available'] = (bool)$isMessageAvailable;
189191
}
190192
$message = $this->itemRepository->get($quote->getId(), $itemId);
191193
if ($message) {

app/code/Magento/GiftMessage/Setup/InstallData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public function install(ModuleDataSetupInterface $setup, ModuleContextInterface
9494
'label' => 'Allow Gift Message',
9595
'input' => 'select',
9696
'class' => '',
97-
'source' => 'Magento\Eav\Model\Entity\Attribute\Source\Boolean',
97+
'source' => 'Magento\Catalog\Model\Product\Attribute\Source\Boolean',
9898
'global' => true,
9999
'visible' => true,
100100
'required' => false,

app/code/Magento/GiftMessage/Ui/DataProvider/Product/Modifier/GiftMessage.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,13 +58,13 @@ public function __construct(
5858
public function modifyData(array $data)
5959
{
6060
$modelId = $this->locator->getProduct()->getId();
61-
$value = '';
61+
$value = Boolean::VALUE_USE_CONFIG;
6262

6363
if (isset($data[$modelId][static::DATA_SOURCE_DEFAULT][static::FIELD_MESSAGE_AVAILABLE])) {
6464
$value = $data[$modelId][static::DATA_SOURCE_DEFAULT][static::FIELD_MESSAGE_AVAILABLE];
6565
}
6666

67-
if ($value == Boolean::VALUE_USE_CONFIG || $value === '' || $value === null) {
67+
if ($value == Boolean::VALUE_USE_CONFIG) {
6868
$data[$modelId][static::DATA_SOURCE_DEFAULT][static::FIELD_MESSAGE_AVAILABLE] = $this->getValueFromConfig();
6969
$data[$modelId][static::DATA_SOURCE_DEFAULT]['use_config_' . static::FIELD_MESSAGE_AVAILABLE] = '1';
7070
}

0 commit comments

Comments
 (0)