Skip to content
This repository has been archived by the owner on Apr 29, 2019. It is now read-only.

Added notes and tooltip to import behavior field in import form #153

Merged
16 changes: 16 additions & 0 deletions app/code/Magento/ImportExport/Block/Adminhtml/Import/Edit/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected function _prepareForm()
'class' => $behaviorCode,
'onchange' => 'varienImport.handleImportBehaviorSelector();',
'note' => ' ',
'after_element_html' => $this->getImportBehaviorTooltip(),
]
);
$fieldsets[$behaviorCode]->addField(
Expand Down Expand Up @@ -252,4 +253,19 @@ protected function getDownloadSampleFileHtml()
. '</a></span>';
return $html;
}

/**
* Get Import Behavior field tooltip
*
* @return string
*/
private function getImportBehaviorTooltip()
{
$html = '<div class="admin__field-tooltip tooltip">
<a class="admin__field-tooltip-action action-help" target="_blank" title="What is this?"
href="https://docs.magento.com/m2/ce/user_guide/system/data-import.html"><span>'
. __('What is this?')
. '</span></a></div>';
return $html;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ public function getCode()
public function getNotes($entityCode)
{
$messages = ['catalog_product' => [
\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("Note: Product IDs will be regenerated.")
\Magento\ImportExport\Model\Import::BEHAVIOR_APPEND => __("New product data is added to the existing product data for the existing entries in the database. All fields except sku can be updated."),
federivo marked this conversation as resolved.
Show resolved Hide resolved
\Magento\ImportExport\Model\Import::BEHAVIOR_REPLACE => __("The existing product data is replaced with new data. <b>Exercise caution when replacing data because the existing product data will be completely cleared and all references in the system will be lost.</b>"),
\Magento\ImportExport\Model\Import::BEHAVIOR_DELETE => __("Any entities in the import data that already exist in the database are deleted from the database."),
]];
return isset($messages[$entityCode]) ? $messages[$entityCode] : [];
}
Expand Down
3 changes: 3 additions & 0 deletions app/code/Magento/ImportExport/i18n/en_US.csv
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,6 @@ User,User
"Error File","Error File"
"Execution Time","Execution Time"
Summary,Summary
"New product data is added to existing product data entries in the database. All fields except SKU can be updated.","New product data is added to existing product data entries in the database. All fields except SKU can be updated."
"All existing product data is replaced with the imported new data. <b>Exercise caution when replacing data. All existing product data will be completely cleared and all references in the system will be lost.</b>","All existing product data is replaced with the imported new data. <b>Exercise caution when replacing data. All existing product data will be completely cleared and all references in the system will be lost.</b>"
"Any entities in the import data that match existing entities in the database are deleted from the database.","Any entities in the import data that match existing entities in the database are deleted from the database."