-
Notifications
You must be signed in to change notification settings - Fork 340
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Visual Merchandiser] Add product from sku #ESP-288
- Loading branch information
1 parent
39a19f7
commit bca174f
Showing
12 changed files
with
170 additions
and
43 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
src/module-elasticsuite-virtual-category/Plugin/Block/Category/RemovePosition.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteVirtualCategory | ||
* @author Pierre Gauthier <pigau@smile.fr> | ||
* @copyright 2020 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
namespace Smile\ElasticsuiteVirtualCategory\Plugin\Block\Category; | ||
|
||
use Magento\Catalog\Block\Adminhtml\Category\Tab\Product as ProductGrid; | ||
|
||
/** | ||
* Remove position from category product grid if the visual merchandiser module is enabled. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteVirtualCategory | ||
* @author Pierre Gauthier <pigau@smile.fr> | ||
*/ | ||
class RemovePosition | ||
{ | ||
/** | ||
* Remove position column from | ||
* | ||
* @param ProductGrid $subject Plugin subject. | ||
* @param ProductGrid $result Result. | ||
* @param string $columnId Column Id. | ||
* @return ProductGrid | ||
*/ | ||
public function afterAddColumn(ProductGrid $subject, $result, $columnId) | ||
{ | ||
if (in_array($columnId, ['position', 'draggable-position'])) { | ||
$subject->removeColumn($columnId); | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
"Add/Remove Products","Produkte hinzufügen/entfernen" | ||
"Virtual rule","Virtuelle Regel" | ||
"Virtual Category","Virtuelle Kategorie" | ||
"Virtual Category Root","Virtuelle Root-Kategorie" | ||
"Products List Preview and Sorting","Produktliste Vorschau und Sortierung" | ||
"Your product selection is empty for the selected Store View. If you are running a multi-store setup, please check this <a href='https://github.com/Smile-SA/elasticsuite/wiki/VirtualCategories#previewing-virtual-categories-on-a-multi-store-setup'>manual page</a> for more informations.","Für die gewählte Store View ist die Produktauswahl leer. Bei Einsatz eines Multi-Store Setups bitte folgende <a href='https://github.com/Smile-SA/elasticsuite/wiki/VirtualCategories#previewing-virtual-categories-on-a-multi-store-setup'>Anleitung</a> berücksichtigen." | ||
"Cannot move the category : '%2' is using '%1' as virtual root category.","Kategorie kann nicht verschoben werden: '%2' verwendet '%1' als virtuelle Root-Kategorie." | ||
"Use default positions","Standardpositionen verwenden" | ||
"In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'.","In diesem Modus können Sie nur eine Vorschau der Produktposition und der Sichtbarkeit anzeigen, sie jedoch nicht ändern. Wenn Sie sie global ändern möchten, wechseln Sie in die Store View 'All Store Views'. Wenn Sie sie für die aktuell ausgewählte Store View ändern möchten, ändern Sie "Standardpositionen verwenden" in 'Nein'." | ||
"In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'.","In diesem Modus können Sie nur eine Vorschau der Produktposition und der Sichtbarkeit anzeigen, sie jedoch nicht ändern. Wenn Sie sie global ändern möchten, wechseln Sie in die Store View 'All Store Views'. Wenn Sie sie für die aktuell ausgewählte Store View ändern möchten, ändern Sie "Standardpositionen verwenden" in 'Nein'." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
"Add/Remove Products","Add/Remove Products" | ||
"Virtual rule","Virtual rule" | ||
"Virtual Category","Virtual Category" | ||
"Virtual Category Root","Virtual Category Root" | ||
"Products List Preview and Sorting","Products List Preview and Sorting" | ||
"Your product selection is empty for the selected Store View. If you are running a multi-store setup, please check this <a href='https://github.com/Smile-SA/elasticsuite/wiki/VirtualCategories#previewing-virtual-categories-on-a-multi-store-setup'>manual page</a> for more informations.","Your product selection is empty for the selected Store View. If you are running a multi-store setup, please check this <a href='https://github.com/Smile-SA/elasticsuite/wiki/VirtualCategories#previewing-virtual-categories-on-a-multi-store-setup'>manual page</a> for more informations." | ||
"Cannot move the category : '%2' is using '%1' as virtual root category.","Cannot move the category : '%2' is using '%1' as virtual root category." | ||
"Use default positions","Use default positions" | ||
"In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'.","In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'." | ||
"In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'.","In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,9 @@ | ||
"Add/Remove Products","Ajouter/Supprimer des produits" | ||
"Virtual rule","Règle à appliquer" | ||
"Virtual Category","Catégorie virtuelle" | ||
"Virtual Category Root","Racine de la catégorie virtuelle" | ||
"Products List Preview and Sorting","Prévisualisation et tri" | ||
"Your product selection is empty for the selected Store View. If you are running a multi-store setup, please check this <a href='https://github.com/Smile-SA/elasticsuite/wiki/VirtualCategories#previewing-virtual-categories-on-a-multi-store-setup'>manual page</a> for more informations.","Votre sélection de produits est vide pour la vue magasin actuellement sélectionnée. Si votre site comporte plusieurs vues magasin, consultez cette <a href='https://github.com/Smile-SA/elasticsuite/wiki/VirtualCategories#previewing-virtual-categories-on-a-multi-store-setup'>page du manuel</a> pour plus d'informations." | ||
"Cannot move the category : '%2' is using '%1' as virtual root category.","Impossible de déplacer la catégorie : '%2' utilise actuellement '%1' comme racine." | ||
"Use default positions","Utiliser les positions par défaut" | ||
"In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'.","Dans ce mode, vous ne pouvez que prévisualiser la position des produits et leur visibilité. Si vous souhaitez les modifier de façon globale, basculer sur la Vue Magasin 'Toutes les vues magasin'. Si vous souhaitez les modifier pour la Vue Magasin actuellement sélectionnée, basculez 'Utiliser les positions par défaut' à 'Non'." | ||
"In this mode, you can only preview products position and visibility but not change them. If you want to change them globally, switch to the 'All Store Views' Store View. If you want to change them for the currently selected Store View, change 'Use default positions' to 'No'.","Dans ce mode, vous ne pouvez que prévisualiser la position des produits et leur visibilité. Si vous souhaitez les modifier de façon globale, basculer sur la Vue Magasin 'Toutes les vues magasin'. Si vous souhaitez les modifier pour la Vue Magasin actuellement sélectionnée, basculez 'Utiliser les positions par défaut' à 'Non'." |
30 changes: 30 additions & 0 deletions
30
src/module-elasticsuite-virtual-category/view/adminhtml/layout/merchandiser.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
/** | ||
* Smile_ElasticsuiteVirtualCategory category form modifications. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade Smile ElasticSuite to newer | ||
* versions in the future. | ||
* | ||
* @category Smile | ||
* @package Smile\ElasticsuiteVirtualCategory | ||
* @author Pierre Gauthier <pigau@smile.fr> | ||
* @copyright 2021 Smile | ||
* @license Open Software License ("OSL") v. 3.0 | ||
*/ | ||
--> | ||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd"> | ||
<body> | ||
<referenceBlock name="category.merchandiser.smart_category" remove="true" /> | ||
<referenceBlock name="category.merchandiser.sort_products_button" remove="true" /> | ||
<referenceBlock name="category.merchandiser.sort_order" remove="true" /> | ||
|
||
<referenceBlock name="category.merchandiser.add_product_button"> | ||
<arguments> | ||
<argument name="label" translate="true" xsi:type="string">Add/Remove Products</argument> | ||
</arguments> | ||
</referenceBlock> | ||
</body> | ||
</page> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
src/module-elasticsuite-virtual-category/view/adminhtml/web/js/merchandiser-mixin.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
define( | ||
['jquery'], | ||
function ($) { | ||
|
||
'use strict'; | ||
|
||
return function (targetWidget) { | ||
$.widget('mage.visualMerchandiser', targetWidget, { | ||
/** | ||
* Don't run smart category setup if block has been removed | ||
* | ||
* @returns void | ||
*/ | ||
setupSmartCategory: function () { | ||
if ($('#smart_category_rules').val() !== undefined) { | ||
this._super(); | ||
} | ||
}, | ||
|
||
/** | ||
* Don't run tile view setup if block has been removed | ||
* | ||
* @returns void | ||
*/ | ||
setupTileView: function () { | ||
// Disable tile view | ||
}, | ||
|
||
/** | ||
* Remove product by refresing the grids | ||
* Fix find entity_id because position column has been removed | ||
* | ||
* @param {Object} row | ||
*/ | ||
removeRow: function (row) { | ||
var data = this.getSortData(); | ||
data.unset(parseInt(row.find('.col-entity_id').text())); | ||
$('#vm_category_products').val(Object.toJSON(data)); | ||
this.savePositionCache(function () { | ||
this.reloadViews(); | ||
}.bind(this)); | ||
}, | ||
}); | ||
|
||
return $.mage.visualMerchandiser; | ||
}; | ||
} | ||
); |