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 2 years, 3 months ago.

  • Creator
  • #25718

    Brian Essig


    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.


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


    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.


    Dima Soroka

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


    Brian Essig


    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?



    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">
    <element name="coupon_code" type="xsd:string" minOccurs="0" />

    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!


    Brian Essig

    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?


    Ivan Klymenko

    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)

You must be logged in to reply to this topic.