Integration with presta shop webinar

Preview:

Citation preview

Developer Training

Integrate your data into OroCRM:

integration with PrestaShop

Developer Training

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

with PrestaShop- Share best practices

Developer Training

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

Developer Training

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

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

Developer Training

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

Developer Training

Integrations in OroCRM- Magento- ZenDesk- MailChimp

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

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

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

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

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

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

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

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

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

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

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

Developer Training

Integration with PrestaShopIntegration with PrestaShop

Wrap upAre we missing anything ?

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

Developer Training

Integration with PrestaShopIntegration with PrestaShop

useoro:process:configuration:load

to load your changes from process.yml

Developer Training

Integration with PrestaShopIntegration with PrestaShop

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

oro:cron:integration:sync

Developer Training

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

Developer Training

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

Summary

Developer Training

Q & A

Quality Control

Recommended