25
Developer Training Integrate your data into OroCRM: integration with PrestaShop

Integration with presta shop webinar

  • Upload
    orocrm

  • View
    152

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Integration with presta shop webinar

Developer Training

Integrate your data into OroCRM:

integration with PrestaShop

Page 2: Integration with presta shop webinar

Developer Training

Goals- Overview of OroCRM integration techniques- Demonstrate implementation of integration

with PrestaShop- Share best practices

Page 3: Integration with presta shop webinar

Developer Training

Integration challenges- Keeping data synced- Performance- Full and incremental sync

Page 4: Integration with presta shop webinar

Developer Training

Change Data Capture (CDC)- Timestamps- Version Numbers- Status indicators- Time/Version/Status

Page 5: Integration with presta shop webinar

Developer Training

Introduction

OroImportExportBundle:- provides abstraction for processors, converters, normalizers and strategies

OroIntegrationBundle:- interaction between third party services and the platform- provides abstraction for integrations, transports and connectors

Page 6: Integration with presta shop webinar

Developer Training

Terminology- Integration Channel Type- Integration Channel- Transport- Connector

Page 7: Integration with presta shop webinar

Developer Training

Integrations in OroCRM- Magento- ZenDesk- MailChimp

Page 8: Integration with presta shop webinar

Developer Training

Goals- Create UI for PrestaShop Integration management- Create PrestShop Customer entity- Import Customers from PrestaShop into our custom entity- Create associated Contacts and Accounts

Integration with PrestaShopIntegration with PrestaShop

Page 9: Integration with presta shop webinar

Developer Training

Step 1: Bundle creationsrc/OroTutorial/Bundle/PrestashopBundlehttp://www.orocrm.com/documentation/index/current/cookbook/how-to-create-new-bundle

Note: need to set bundle priority > 20 since we depend on Account and Contact bundles in oro/bundles.yml:bundles: - { name: OroTutorial\Bundle\PrestashopBundle\OroTutorialPrestashopBundle, priority: 99 }

Integration with PrestaShopIntegration with PrestaShop

Page 10: Integration with presta shop webinar

Developer Training

Step 2: Integration Channel Type- implements Oro\Bundle\IntegrationBundle\Provider\ChannelInterface

- register with oro_integration.channel tag using unique type

Step 3: PrestaShop Customer entity- extends BasePerson

- should use IntegrationEntityTrait

- should be a configurable entity (defined by annotation: Oro\Bundle\EntityConfigBundle\Metadata\Annotation\Config)

- remoteId should be a configurable field (defined by annotation: Oro\Bundle\EntityConfigBundle\Metadata\Annotation\ConfigField)

Integration with PrestaShopIntegration with PrestaShop

Page 11: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 4: Implement TransportResponsibility of transport is communication between connector and channel1. Implement transport type

- extends Oro\Bundle\IntegrationBundle\Provider\Rest\Transport\AbstractRestTransport

- registered by oro_integration.transport tag with specified type and channel_type

2. Create form to display on channel configuration page- PrestaShop API requires API key and connection endpoint

3. Create entity that will store transport settings- extends Oro\Bundle\IntegrationBundle\Entity\Transport

Page 12: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 5: Migrations- create ot_prestashop_customer table- add columns to oro_integration_transport to store connection settings

Page 13: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 6: ConnectorGetting customers from PrestaShop that have been updated after our last sync

- create importexport.yml for suitability- create batch_jobs.yml

Notes: - we injected RegistryInterface to be able to retrieve last sync date- importexport.yml is declared in extension file

Page 14: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Let’s check what we have so farwe should be able to configure and create our custom

PrestaShop integration

Page 15: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 7: Iterator- extends Oro\Bundle\IntegrationBundle\Provider\Rest\Client\AbstractRestIterator- implements methods:

loadPage()getRowsFromPageData()getTotalCountFromPageData()

Update RestTransport to use our iterator for retrieving customers from Prestashop

Page 16: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 8: Data ConverterData converter is responsible for converting header of import data

- basically a map of entity fields between source (PrestaShop) and target (OroCRM)

- extends Oro\Bundle\ImportExportBundle\Converter\AbstractTableDataConverter

- registered by tag oro_integration.connector and injected into processor

Page 17: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 9: Data Normalizer/DenormalizerRequired for converting array representation to entity objects and visa versa

- registered by oro_importexport.normalizer tag name- extends ConfigurableEntityNormalizer from OroIntegrationBundle

(This is why we created our PrestaShop customer as a configurable entity )

- on denormalize() set current integration to PrestaShop customer- introduced DateTimeNormalizer to take care in date/time format differences

Page 18: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Step 10: Strategy and Processor

Strategy- extends Oro\Bundle\ImportExportBundle\Strategy\Import\ConfigurableAddOrReplaceStrategy

- customize findExistingEntity() to filter entities by integration channel- inject logger to show integration process

Processor- extends Oro\Bundle\ImportExportBundle\Processor\ImportProcessor

- no separate classes required for our simple case but we have to configure processor in imporexport.yml

Page 19: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Wrap upAre we missing anything ?

Page 20: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

What about Contacts and Accounts?

We’ll utilize Workflow bundle and add a process definition into process.yml that will:

- be triggered upon creation of new PrestaShop customer- create new Contact associated to PrestaShop customer- create new Account associated to the new Contact

Note: we need to make sure that job queue daemon is running to execute our processes

Page 21: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

useoro:process:configuration:load

to load your changes from process.yml

Page 22: Integration with presta shop webinar

Developer Training

Integration with PrestaShopIntegration with PrestaShop

That’s it. Now we can run our sync!

oro:cron:integration:sync

Page 23: Integration with presta shop webinar

Developer Training

Issues in real environments- Unexpected data- Large data sets- Timeouts- Connection issues- Time diff between nodes

Page 24: Integration with presta shop webinar

Developer Training

• Data sync challenges• Methodology and Terminology• Integration with PrestaShop• Issues in real environments

Summary

Page 25: Integration with presta shop webinar

Developer Training

Q & A

Quality Control