altimaº x m3.3 magento 2 api components
TRANSCRIPT
![Page 1: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/1.jpg)
ctrlweb, 16 Février 2017
M3.3 Magento 2 API Componentsaltima x M3
![Page 2: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/2.jpg)
qui suis-je?
Florian Salvaterra
mon rôle Développeur Magento Confirmé
formation BTS - IG (DEC Technique) Informatique de Gestion
expérience Développeur Magento - Galilée Ingénieur Études et Développement - Smile Développeur Magento Confirmé - altima°
principaux projet Fits - Qwetch - Dalloz - Fleur’t - MontelleKrys - Total - Alltides
![Page 3: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/3.jpg)
1
2
3
4
5
pattern interceptor introduction à son utilisation
au programme
import catalogue multistore/multilangue, stock et catégories
gain de maturité? points clés sur la différence avec Magento 1.x
retour d’expérience appréciation personnelle
échange/questions à vous les studios
![Page 4: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/4.jpg)
pattern interceptor
![Page 5: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/5.jpg)
quoi?
pattern interceptor
![Page 6: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/6.jpg)
permet la modification d’un comportement de manière transparente
le processus reste identique
pattern interceptor
6
![Page 7: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/7.jpg)
7
schéma
pattern interceptor
![Page 8: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/8.jpg)
8
• before (preprocessing)
• after (postprocessing)
• around (preprocessing & postprocessing)
actions
pattern interceptor
![Page 9: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/9.jpg)
pourquoi?
pattern interceptor
![Page 10: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/10.jpg)
règle le problème de la surcharge multiple dans Magento 1.x
une variable sortOrder définit l’ordre de traitement
pattern interceptor
10
![Page 11: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/11.jpg)
comment?
pattern interceptor
![Page 12: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/12.jpg)
déclaration d’un plugin
<config> <type name="{ObservedType}"> <plugin name="{pluginName}" type="{PluginClassName}" sortOrder="1" disabled="false"/> </type> </config>
pattern interceptor
12
![Page 13: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/13.jpg)
import catalogue
import catalogue
![Page 14: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/14.jpg)
multistore/multilangue
import catalogue
![Page 15: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/15.jpg)
avant
$product->setStoreId($storeId)->setData($data, ‘attribute’);
import catalogue
15
![Page 16: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/16.jpg)
après
$this->_productAction->updateAttributes($productsIds, $Attributes, $storeId);
import catalogue
16
![Page 17: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/17.jpg)
catégories
import catalogue
![Page 18: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/18.jpg)
avant
$product->setCategoryIds($menus);
$product->save();
import catalogue
18
![Page 19: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/19.jpg)
après
$this->getCategoryLinkManagement()->assignProductToCategories( $product->getSku(), $productCategories );
import catalogue
19
![Page 20: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/20.jpg)
inventaire
import catalogue
![Page 21: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/21.jpg)
avant$product->setStockData( array( 'use_config_manage_stock' => 0, 'manage_stock' => 1, 'is_in_stock' => 1, 'qty' => 999999999 ) );
import catalogue
21
![Page 22: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/22.jpg)
après $stockItem = $this->_stockRegistry->getStockItemBySku($sku);
$stockItem->setQty($qty);
$stockItem->setIsInStock($qty>0);
$this->_stockRegistry->updateStockItemBySku($sku, $stockItem);
import catalogue
22
![Page 23: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/23.jpg)
gain de maturité?
gain de maturité?
![Page 24: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/24.jpg)
oui…
gain de maturité?
![Page 25: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/25.jpg)
une séparation des traitements plus claire permettant d’identifier exactement quel
composant fait quoi
et un apprentissage plus facile du fonctionnement
gain de maturité?
25
![Page 26: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/26.jpg)
l’utilisation des plugins qui permet l’intégration de la logique métier
spécifique au client
et la modification rapide de ces derniers
gain de maturité?
26
![Page 27: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/27.jpg)
le productRepository permet d’éviter de différencier création et mise à jour
association des données par Sku
gain de maturité?
27
![Page 28: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/28.jpg)
mais non
gain de maturité?
![Page 29: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/29.jpg)
l’utilisation à toutes les sauces de la méthode dépréciée
la méthode save() est dépréciée mais utilisée dans le core
gain de maturité?
29
![Page 30: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/30.jpg)
des composants qui lèvent des exceptions car non compatibles
avec le productRepository
entre autres: la gestion des données par storeview, la gestion des rôles d’image, …
gain de maturité?
30
![Page 31: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/31.jpg)
retour d’expérience
retour d’expérience
![Page 32: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/32.jpg)
contexte
retour d’expérience
![Page 33: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/33.jpg)
33
• Deux montées de version durant le développement
• Comportement métier spécifique
• Jeunesse de la plateforme et de l’équipe
ERP custom x Magento 2
retour d’expérience
![Page 34: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/34.jpg)
mon ressenti
retour d’expérience
![Page 35: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/35.jpg)
une expérience frustrante car un manque de logique dans
l’utilisation des composants
ce qui paraît évident ne l’est parfois pas du tout (ce qui n’est pas sans rappeler certains
comportements de Magento 1.x)
retour d’expérience
35
![Page 36: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/36.jpg)
une confiance plutôt timide envers l’avenir de Magento 2.x
beaucoup d’améliorations mais l’impression de faire face à beaucoup de balbutiements
retour d’expérience
36
![Page 38: altimaº x M3.3 Magento 2 api components](https://reader034.vdocuments.mx/reader034/viewer/2022050811/58acfb941a28abca0c8b5e03/html5/thumbnails/38.jpg)