OroCRM Forums

Covering OroCRM topics, including community updates and company announcements.

Forums Forums OroCRM OroCRM – How do I? Questions Import Coupon code in Customer Entity from Magento

This topic contains 6 replies, has 4 voices, and was last updated by  Ivan Klymenko 8 years, 6 months ago.

Starting from March 1, 2020 the forum has been switched to the read-only mode. Please head to StackOverflow for support.

  • Creator
    Topic
  • #28528

    Brian Essig
    Participant

    Hello,

    We are using the oro bridge to sync customers and order data from magento. We want to add the coupon code to be in the order entity, so reps can see if the order had a coupon code attached to it and which one. We also want to create custom reports base don this coupon code. I was wondering if you had any tips or advice on how to get started on this.

    Thanks,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Author
    Replies
  • #28529

    Rodolfo
    Participant

    Using the Entity Management you can create a new string field called: ‘coupon_code’ on Magento Orders.

    Since the wsdl code already has the coupon_code field, I believe it should fill it up automatically.
    https://github.com/orocrm/magento-orocrm-bridge/blob/bd6766030060e2032e52a63733390d6e3bd47a6f/app/code/community/Oro/Api/etc/wsdl.xml#L81

    #28530

    Dima Soroka
    Keymaster

    We are going to enable coupon code support out of the box very soon as well.

    #28531

    Brian Essig
    Participant

    Rodolfo,

    That did not seem to work automatigically. I added the custom field, type: string, name: coupon_code and then updated schema. Following that, I placed a fresh test order using a coupon code. I then ran the sync, and the Coupon Code is “N/A” in the order/view.

    Any other ideas?

    Dima, it’s not in 1.9 is it?

    #28532

    Rodolfo
    Participant

    Hi Brian,

    I thought it was automatically. I did this a long time ago so I’m sorry. Actually in addition to what you did you’ll need to change the Oro-Api extension in Magento side. (If you don’t want to wait for the next orocrm/api release)

    On app/code/community/Oro/Api/etc/wsdl.xml add this:

    <complexType name="salesOrderEntity">
    <all>
    <element name="coupon_code" type="xsd:string" minOccurs="0" />
    </all>
    </complexType>

    On this line of app/code/community/Oro/Api/Model/Sales/Order/Api.php

    $result['coupon_code'] = $order->getCouponCode();

    Add the same code for quotes in: app/code/community/Oro/Api/Model/Sales/Quote/Api.php

    Don’t forget to clean the wsdl/api cache to see the changes in your wsdl (index.php/api/v2_soap/?wsdl=1). Sometimes it’s also necessary remove the wsdl file from /tmp in your server because sometimes PHP saves it there.

    Make sure to test it in development environment before pushing to production. As far as I remember that was the changes I have to do in order to add coupon_code in our orders entity.
    Good luck!

    #28533

    Brian Essig
    Participant

    Hmm, I think I am still missing a step here.

    I verified with Soapui that the magento api oroOrderInfo is returning the coupon_code node with the correct value. I run the sync inside of oro and then view the order, it’s still coming up as N/A.

    Perhaps I’m missing a step in oro?

    #28534

    Ivan Klymenko
    Spectator

    Hi Brian,
    support of the coupon code for the Magento orders was pushed to master, you can check.

Viewing 6 replies - 1 through 6 (of 6 total)

The forum ‘OroCRM – How do I? Questions’ is closed to new topics and replies.

Back to top