際際滷

際際滷Share a Scribd company logo
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 PrestaShop
Integration with PrestaShop
Developer Training
Step 1: Bundle creation
src/OroTutorial/Bundle/PrestashopBundle
http://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: OroTutorialBundlePrestashopBundleOroTutorialPrestashopBundle, priority: 99 }
Integration with PrestaShop
Integration with PrestaShop
Developer Training
Step 2: Integration Channel Type
- implements OroBundleIntegrationBundleProviderChannelInterface
- 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:
OroBundleEntityConfigBundleMetadataAnnotationConfig)
- remoteId should be a configurable field (defined by annotation:
OroBundleEntityConfigBundleMetadataAnnotationConfigField)
Integration with PrestaShop
Integration with PrestaShop
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Step 4: Implement Transport
Responsibility of transport is communication between connector and channel
1. Implement transport type
- extends OroBundleIntegrationBundleProviderRestTransportAbstractRestTransport
- 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 OroBundleIntegrationBundleEntityTransport
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Step 5: Migrations
- create ot_prestashop_customer table
- add columns to oro_integration_transport to store connection settings
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Step 6: Connector
Getting 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 PrestaShop
Integration with PrestaShop
Lets check what we have so far
we should be able to configure and create our custom
PrestaShop integration
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Step 7: Iterator
- extends OroBundleIntegrationBundleProviderRestClientAbstractRestIterator
- implements methods:
loadPage()
getRowsFromPageData()
getTotalCountFromPageData()
Update RestTransport to use our iterator for retrieving customers from
Prestashop
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Step 8: Data Converter
Data converter is responsible for converting header of import data
- basically a map of entity fields between source (PrestaShop) and target
(OroCRM)
- extends OroBundleImportExportBundleConverterAbstractTableDataConverter
- registered by tag oro_integration.connector and injected into processor
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Step 9: Data Normalizer/Denormalizer
Required 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 PrestaShop
Integration with PrestaShop
Step 10: Strategy and Processor
Strategy
- extends OroBundleImportExportBundleStrategyImportConfigurableAddOrReplaceStrategy
- customize findExistingEntity() to filter entities by integration channel
- inject logger to show integration process
Processor
- extends OroBundleImportExportBundleProcessorImportProcessor
- no separate classes required for our simple case but we have to configure
processor in imporexport.yml
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Wrap up
Are we missing anything ?
Developer Training
Integration with PrestaShop
Integration with PrestaShop
What about Contacts and Accounts?
Well 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 PrestaShop
Integration with PrestaShop
use
oro:process:configuration:load
to load your changes from process.yml
Developer Training
Integration with PrestaShop
Integration with PrestaShop
Thats 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

More Related Content

Integration with presta shop webinar

  • 1. Developer Training Integrate your data into OroCRM: integration with PrestaShop
  • 2. Developer Training Goals - Overview of OroCRM integration techniques - Demonstrate implementation of integration with PrestaShop - Share best practices
  • 3. Developer Training Integration challenges - Keeping data synced - Performance - Full and incremental sync
  • 4. Developer Training Change Data Capture (CDC) - Timestamps - Version Numbers - Status indicators - Time/Version/Status
  • 5. 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
  • 6. Developer Training Terminology - Integration Channel Type - Integration Channel - Transport - Connector
  • 7. Developer Training Integrations in OroCRM - Magento - ZenDesk - MailChimp
  • 8. 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 PrestaShop Integration with PrestaShop
  • 9. Developer Training Step 1: Bundle creation src/OroTutorial/Bundle/PrestashopBundle http://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: OroTutorialBundlePrestashopBundleOroTutorialPrestashopBundle, priority: 99 } Integration with PrestaShop Integration with PrestaShop
  • 10. Developer Training Step 2: Integration Channel Type - implements OroBundleIntegrationBundleProviderChannelInterface - 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: OroBundleEntityConfigBundleMetadataAnnotationConfig) - remoteId should be a configurable field (defined by annotation: OroBundleEntityConfigBundleMetadataAnnotationConfigField) Integration with PrestaShop Integration with PrestaShop
  • 11. Developer Training Integration with PrestaShop Integration with PrestaShop Step 4: Implement Transport Responsibility of transport is communication between connector and channel 1. Implement transport type - extends OroBundleIntegrationBundleProviderRestTransportAbstractRestTransport - 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 OroBundleIntegrationBundleEntityTransport
  • 12. Developer Training Integration with PrestaShop Integration with PrestaShop Step 5: Migrations - create ot_prestashop_customer table - add columns to oro_integration_transport to store connection settings
  • 13. Developer Training Integration with PrestaShop Integration with PrestaShop Step 6: Connector Getting 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
  • 14. Developer Training Integration with PrestaShop Integration with PrestaShop Lets check what we have so far we should be able to configure and create our custom PrestaShop integration
  • 15. Developer Training Integration with PrestaShop Integration with PrestaShop Step 7: Iterator - extends OroBundleIntegrationBundleProviderRestClientAbstractRestIterator - implements methods: loadPage() getRowsFromPageData() getTotalCountFromPageData() Update RestTransport to use our iterator for retrieving customers from Prestashop
  • 16. Developer Training Integration with PrestaShop Integration with PrestaShop Step 8: Data Converter Data converter is responsible for converting header of import data - basically a map of entity fields between source (PrestaShop) and target (OroCRM) - extends OroBundleImportExportBundleConverterAbstractTableDataConverter - registered by tag oro_integration.connector and injected into processor
  • 17. Developer Training Integration with PrestaShop Integration with PrestaShop Step 9: Data Normalizer/Denormalizer Required 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
  • 18. Developer Training Integration with PrestaShop Integration with PrestaShop Step 10: Strategy and Processor Strategy - extends OroBundleImportExportBundleStrategyImportConfigurableAddOrReplaceStrategy - customize findExistingEntity() to filter entities by integration channel - inject logger to show integration process Processor - extends OroBundleImportExportBundleProcessorImportProcessor - no separate classes required for our simple case but we have to configure processor in imporexport.yml
  • 19. Developer Training Integration with PrestaShop Integration with PrestaShop Wrap up Are we missing anything ?
  • 20. Developer Training Integration with PrestaShop Integration with PrestaShop What about Contacts and Accounts? Well 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
  • 21. Developer Training Integration with PrestaShop Integration with PrestaShop use oro:process:configuration:load to load your changes from process.yml
  • 22. Developer Training Integration with PrestaShop Integration with PrestaShop Thats it. Now we can run our sync! oro:cron:integration:sync
  • 23. Developer Training Issues in real environments - Unexpected data - Large data sets - Timeouts - Connection issues - Time diff between nodes
  • 24. Developer Training Data sync challenges Methodology and Terminology Integration with PrestaShop Issues in real environments Summary
  • 25. Developer Training Q & A Quality Control