altimaº x m3.3 magento 2 api components

38
ctrlweb, 16 Février 2017 M3.3 Magento 2 API Components altima x M3

Upload: altima-north-america

Post on 22-Feb-2017

65 views

Category:

Internet


0 download

TRANSCRIPT

Page 1: altimaº x M3.3 Magento 2 api components

ctrlweb, 16 Février 2017

M3.3 Magento 2 API Componentsaltima x M3

Page 2: altimaº x M3.3 Magento 2 api components

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

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

pattern interceptor

Page 5: altimaº x M3.3 Magento 2 api components

quoi?

pattern interceptor

Page 6: altimaº x M3.3 Magento 2 api components

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

7

schéma

pattern interceptor

Page 8: altimaº x M3.3 Magento 2 api components

8

• before (preprocessing)

• after (postprocessing)

• around (preprocessing & postprocessing)

actions

pattern interceptor

Page 9: altimaº x M3.3 Magento 2 api components

pourquoi?

pattern interceptor

Page 10: altimaº x M3.3 Magento 2 api components

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

comment?

pattern interceptor

Page 12: altimaº x M3.3 Magento 2 api components

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

import catalogue

import catalogue

Page 14: altimaº x M3.3 Magento 2 api components

multistore/multilangue

import catalogue

Page 15: altimaº x M3.3 Magento 2 api components

avant

$product->setStoreId($storeId)->setData($data, ‘attribute’);

import catalogue

15

Page 16: altimaº x M3.3 Magento 2 api components

après

$this->_productAction->updateAttributes($productsIds, $Attributes, $storeId);

import catalogue

16

Page 17: altimaº x M3.3 Magento 2 api components

catégories

import catalogue

Page 18: altimaº x M3.3 Magento 2 api components

avant

$product->setCategoryIds($menus);

$product->save();

import catalogue

18

Page 19: altimaº x M3.3 Magento 2 api components

après

$this->getCategoryLinkManagement()->assignProductToCategories( $product->getSku(), $productCategories );

import catalogue

19

Page 20: altimaº x M3.3 Magento 2 api components

inventaire

import catalogue

Page 21: altimaº x M3.3 Magento 2 api components

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

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

gain de maturité?

gain de maturité?

Page 24: altimaº x M3.3 Magento 2 api components

oui…

gain de maturité?

Page 25: altimaº x M3.3 Magento 2 api components

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

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

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

mais non

gain de maturité?

Page 29: altimaº x M3.3 Magento 2 api components

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

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

retour d’expérience

retour d’expérience

Page 32: altimaº x M3.3 Magento 2 api components

contexte

retour d’expérience

Page 33: altimaº x M3.3 Magento 2 api components

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

mon ressenti

retour d’expérience

Page 35: altimaº x M3.3 Magento 2 api components

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

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 37: altimaº x M3.3 Magento 2 api components

Florian Salvaterra Développeur Magento Confirmé

[email protected]

merci

Page 38: altimaº x M3.3 Magento 2 api components