cancel
Showing results for 
Search instead for 
Did you mean: 

How to call an external webservice to import coupon code real time?

How to call an external webservice to import coupon code real time?

Are there any tutorials or examples to make calls to an external webservice to import coupons real time?

 

1 REPLY 1

Re: How to call an external webservice to import coupon code real time?

"Real time" is always a tricky term when dealing with connecting to an external web service.   It's never "real time" unless they are pushing the data as soon as something changes.   I assume this is some sort of API you can hit regularly to get your coupon codes.     

 

1.  Setup a module with a Cron connection that runs as frequently as you want it to run.   The more frequently it runs, the more "real time" this seems.  More info here: http://stackoverflow.com/questions/11202463/how-to-setup-a-cron-job-in-magento-module

 

2.  Find some code online that documents how to connect to the API you want to connect to.   Put this code in your cron job function.

 

3.  Use the data gathered to manage coupons.  Here is a little info I found googling around about someone programmatically creating coupons:  http://stackoverflow.com/questions/11621194/create-magento-coupon-via-api  

 

I have not tested any of these code snippets linked to but based my understanding of what you are trying to do this is the rough outline of what you need.

Certified Plus Magento Developer | Top 50 Magento Contributor for 2017 | CEO/Founder at Jamersan | I make Magento videos at Ecommerce-aholic