Forums › Forums › OroCRM › OroCRM – How do I? Questions › Get all info from Tracking Events into User Details
This topic contains 3 replies, has 2 voices, and was last updated by Rodolfo 9 years, 5 months ago.
Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.
- CreatorTopic
- November 24, 2014 at 6:31 pm #28266
I’d like to know if it’s possible for me to click in customers/account/contact details and get the information about this user using tracking events data. In other words, get all the data from Tracking Events using customer id as a reference.
Thanks!
- CreatorTopic
- AuthorReplies
- November 26, 2014 at 1:04 pm #28267
Hello !
It’s required additional development. But it’s not so hard to implement, as suggestion I can recommend use following code to find events in DB.
1234567891011121314151617181920/** @var EntityManager $em */$em = $this->getDoctrine()->getManager();$expr = $em->getExpressionBuilder();$customerId = $em->getRepository('OroCRMMagentoBundle:Customer')->createQueryBuilder('c')->select('c.originId')->where($expr->eq('c.account', $account))->getQuery()->getSingleScalarResult();$events = $em->getRepository('OroTrackingBundle:TrackingEvent')->createQueryBuilder('te')->innerJoin('te.website', 'tw')->andWhere('tw.identifier = :identifier')->andWhere($expr->like('te.userIdentifier', sprintf('id=%d;%%', $customerId)))->setParameter('identifier', '***YOUR_TRACKING_ID_HERE***')->getQuery()->getResult();November 27, 2014 at 3:38 pm #28268Thank you for your answer Alexandr,
I just need some help to convert your suggestion to yml format and I still have other question.
How can I add the mysql ‘like’ in yml?
For example: “userIdentifier like ‘%***MY_USER_ORIGIN_ID_HERE***%’By now, I’m getting this error:
“An exception has been thrown during the rendering of a template (“Unrecognized options “bind_parameters” under “query””) in”123456789101112131415161718192021222324252627282930313233tracking-events-grid-to-webcustomer:source:type: ormacl_resource: oro_tracking_website_viewquery:select:- e.id- e.name- e.value- e.userIdentifier- e.url- e.title- e.code- e.loggedAtfrom:- { table: Oro\Bundle\TrackingBundle\Entity\TrackingEvent, alias: e }where:and:- e.userIdentifier = :origin_idbind_parameters:origin_id: originIdwebsite-tracking-events-grid-to-webcustomer:extends: tracking-events-grid-to-webcustomersource:query:join:inner:- { join: e.website, alias: w }where:and:- w.identifier = :website_idbind_parameters:website_id: websiteIdAnd this what I put on my twig:
12345678{% set trackingEventsGrid %}{{dataGrid.renderGrid('website-tracking-events-grid-to-webcustomer',{'originId': 34015,'websiteId': 1})}}{% endset %}12345678910111213141516171819202122{% set dataBlocks = [{'title': 'General Information'|trans,'class': 'active','subblocks': generalSubBlocks},{'title': 'orocrm.magento.customer.sales.label'|trans,'subblocks': [{'data' : [salesTabsWidget] }]},{'title': 'oro.tracking.block.events'|trans,'subblocks': [{'data' : [trackingEventsGrid]}]}] %}November 28, 2014 at 12:30 pm #28269I fixed here! Removed the first bind_parameter and changed the datagrid.yml to use this:
123where:and:- e.userIdentifier LIKE :originIdand
1{% set entityConcat = '%' ~ entity.originId ~ '%' %} - AuthorReplies
The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.