Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1
    Join Date
    Jul 2012
    Posts
    15
    Plugin Contributions
    0

    Idea or Suggestion Execute API on successful order

    Hi,

    I am using version 1.3.9h.

    I am trying to integrate an API which uses CURL and having a URL based submission of SMS to customer mobile number on successful order creation.

    I need help regarding where to insert this code in zencart?

    I can provide the API snippet if required.

    Thanks & Regards,
    Last edited by max4u; 14 Jul 2012 at 01:40 PM.

  2. #2
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Execute SMS API on successful order

    includes/classes/order.php is where you'll need to do the work. down at the bottom you'll find 'function send_order_email' which might be one place you could bundle it in.

  3. #3
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,532
    Plugin Contributions
    127

    Default Re: Execute SMS API on successful order

    If you look at "SMS on Sale," you'll see how to do it without changing core Zen Cart files.

    http://www.zen-cart.com/downloads.php?do=file&id=291
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  4. #4
    Join Date
    Jul 2012
    Posts
    15
    Plugin Contributions
    0

    Default Re: Execute SMS API on successful order

    Hi,

    Thanks all for your reply.

    @swguy:
    That addon uses email link for SMS trigerring which is not a case for my service provider. My service provider has provided a URL link which triggers SMS. Any way that can be modified? It would be great ifyour addon support this type of API calls as it is very common here in INDIA. Mostly service providers are providing URL API call instead of email-to-SMS link.

    @niccol:
    I will try to update this file and will update you with the result.

  5. #5
    Join Date
    Apr 2009
    Posts
    2,134
    Plugin Contributions
    3

    Default Re: Execute SMS API on successful order

    swguys approach is better. He said to look at it to learn how to structure the code so that you do not have to edit core files. You should do that. You just need to edit the observer class so that it does what you wish rather than what his version does.

  6. #6
    Join Date
    Jul 2012
    Posts
    15
    Plugin Contributions
    0

    Default Re: Execute SMS API on successful order

    Quote Originally Posted by niccol View Post
    swguys approach is better. He said to look at it to learn how to structure the code so that you do not have to edit core files. You should do that. You just need to edit the observer class so that it does what you wish rather than what his version does.
    Thanks a lot. I will definitely try to do this and update you.

  7. #7
    Join Date
    Jul 2012
    Posts
    15
    Plugin Contributions
    0

    Default Re: Execute SMS API on successful order

    HI,

    How to add order number in SMS? I mean which variable will return the order ID value for SMS.

    Thanks & Regards,

  8. #8
    Join Date
    Jul 2012
    Posts
    15
    Plugin Contributions
    0

    Default Re: Execute SMS API on successful order

    Quote Originally Posted by swguy View Post
    If you look at "SMS on Sale," you'll see how to do it without changing core Zen Cart files.

    http://www.zen-cart.com/downloads.php?do=file&id=291
    HI,

    How to add order number in SMS? I mean which variable will return the order ID value for SMS.

    Thanks & Regards,

  9. #9
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,532
    Plugin Contributions
    127

    Default Re: Execute SMS API on successful order

    If you switch to using NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL, then $zf_insert_id (the order id) is one of the parameters.
    In ./includes/classes/observers/class.msg_owner.php, change

    $zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'));
    to

    $zco_notifier->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));

    then change

    function update(&$callingClass, $eventID) {

    to


    function update(&$callingClass, $eventID, $paramsArray = array()) {
    list($zf_insert_id, $email_order, $extra_info, $html_msg) = $paramsArray;

    and you have the order id in $zf_insert_id.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  10. #10
    Join Date
    Jul 2012
    Posts
    15
    Plugin Contributions
    0

    Default Re: Execute SMS API on successful order

    Quote Originally Posted by swguy View Post
    If you switch to using NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL, then $zf_insert_id (the order id) is one of the parameters.
    In ./includes/classes/observers/class.msg_owner.php, change

    $zco_notifier->attach($this, array('NOTIFY_CHECKOUT_PROCESS_AFTER_SEND_ORDER_EMAIL'));
    to

    $zco_notifier->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));

    then change

    function update(&$callingClass, $eventID) {

    to


    function update(&$callingClass, $eventID, $paramsArray = array()) {
    list($zf_insert_id, $email_order, $extra_info, $html_msg) = $paramsArray;

    and you have the order id in $zf_insert_id.
    Hi,

    Thanks a lot. Thanks a lot for your HELP.

    It worked for me like a charm...

    You are genius..

    I am using your Module with CURL API from my SMS provider for sending sms to customer on successful order.

    But I am facing problem that on checkout confirmation, SMS is generated but checkout_success.php shows a blank page.

    So, how can I get my website working?

    CURL Code which I am using:

    PHP Code:
    <?php
    $ch 
    curl_init();
    $user="user_id:password";
    $receipientno="900XXXXXX";
    $senderID="TEST SMS";
    $msgtxt="this is test message , test";
    curl_setopt($ch,CURLOPT_URL,  "http://api.xxxxxxxx.com/xxwwxx/MessageCompose");
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    curl_setopt($chCURLOPT_POST1);
    curl_setopt($ch,CURLOPT_POSTFIELDS,"user=$user&senderID=$senderID&receipientno=$receipientno&msgtxt=$msgtxt&state=0");
    $buffer curl_exec($ch);
    if(empty (
    $buffer))
    { echo 
    " buffer is empty "; }
    else
    { echo 
    $buffer; }
    curl_close($ch);
    ?>
    Thanks in Advance.

 

 
Page 1 of 3 123 LastLast

Similar Threads

  1. v151 Order placed - did not show up - Payment was successful
    By puddlesofpaint in forum General Questions
    Replies: 5
    Last Post: 3 Mar 2014, 12:21 AM
  2. can't receive and show order after paypal successful
    By gueston in forum Managing Customers and Orders
    Replies: 3
    Last Post: 15 Aug 2009, 05:21 AM
  3. Authorize.net AIM - Successful - No Order?
    By Cylants in forum Built-in Shipping and Payment Modules
    Replies: 4
    Last Post: 24 May 2009, 09:27 PM
  4. Custom function upon successful order placement
    By Gwixel in forum General Questions
    Replies: 8
    Last Post: 17 May 2008, 06:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg