Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
  1. #11
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Sending order data to a script

    You're probably right about thinking you need to check the server's logs. But I'm guessing it's your server's mod_sec logs you need, and that you've probably tripped a rule that's intended to block hackers because something you're passing is very similar.

    The script you're posting TO isn't running any Zen Cart code, is it?
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  2. #12
    Join Date
    Dec 2005
    Location
    Kalamazoo, MI
    Posts
    64
    Plugin Contributions
    0

    Have a Drink Re: Sending order data to a script

    It turned out to be a PHP error after all, including a problem from calling that submit_form function from within the class. There was also an error in the urlencode code for countries. Here's the finished product, which will post to our custom script every time a new item is ordered and paid for. Thanks very much for your help.
    PHP Code:
    <?php
    class orderNotifier extends base {
    function 
    orderNotifier() {
    # $this->attach($this, array('NOTIFY_CHECKOUT_PROCESS_BEGIN', 'NOTIFY_HEADER_START_CHECKOUT_PAYMENT', 'NOTIFIER_CART_SHOW_TOTAL_START'));
    $this->attach($this, array('NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL'));
    }
    function 
    update(&$Class$notifier$paramsArray) {
    $num $paramsArray[0];
    $cust $Class->customer;
    $country urlencode($cust['country']['title']);
    foreach (
    $cust as $k => $v)
    if (!
    is_array($v))
    $cust[$k] = urlencode($v);
    $inf $Class->info;
    if (
    $inf['order_status'] == 2) {
    foreach(
    $Class->products as $prod) {
    $url 'http://www.yoururl.com/yourpage.php?num=' $num '&firstname=' $cust['firstname'] . '&lastname=' $cust['lastname'] . '&email=' $cust['email_address'] . '&company=' $cust['company'] . '&address=' $cust['street_address'] . '&city=' $cust['city'] . '&state=' $cust['state'] . '&postcode=' $cust['postcode'] . '&country=' $country '&telephone=' $cust['telephone'] . '&qty=' $prod['qty'] . '&prod_name=' urlencode($prod['name']) . '&id=' urlencode($prod['id']);
    $ch curl_init();
    curl_setopt($chCURLOPT_INTERFACE'yourip');
    curl_setopt($chCURLOPT_URL$url);
    curl_setopt($chCURLOPT_TIMEOUT20);
    curl_setopt($chCURLOPT_RETURNTRANSFER1);
    $data curl_exec($ch);
    }
    }
    }
    }
    ?>
    J.J. Meddaugh
    http://www.atguys.com

  3. #13
    Join Date
    Jan 2012
    Location
    Fort Worth, Texas
    Posts
    14
    Plugin Contributions
    0

    Default Re: Sending order data to a script

    It looks like y'all knocked this out pretty well. I have a couple of questions, so I can understand how this was accomplished.

    Is 'NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL' the event that happens when an admin changes the order status via the drop down in the orders area?

    Where does the new php code go? in orders.php somewhere? If so is this really the only file that gets modified in this mod?

    Thanks

    Paul

  4. #14
    Join Date
    Jan 2012
    Location
    Fort Worth, Texas
    Posts
    14
    Plugin Contributions
    0

    Default Re: Sending order data to a script

    How do I find out what other variables are available like this one? $cust['lastname']

    For example I'm after customer ID, I'll bet it's $cust['id'], but I imagine there is a defining location for it. I used the DEV tool kit and found all kinds of things, but nothing definate.

    Thanks

    Paul

  5. #15
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Sending order data to a script

    Quote Originally Posted by glitzsfa View Post
    Is 'NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL' the event that happens when an admin changes the order status via the drop down in the orders area?
    No. It's only related to the storefront side. It has nothing to do with the admin side.
    If you're targeting admin-related updates, that's a completely separate topic beyond the scope of the discussion in this thread.
    Quote Originally Posted by glitzsfa View Post
    Where does the new php code go? in orders.php somewhere? If so is this really the only file that gets modified in this mod?
    See my first post in this thread, as it contains links to examples which answer that question.

    Quote Originally Posted by glitzsfa View Post
    How do I find out what other variables are available like this one? $cust['lastname']
    You can output your own debug code for seeing what else is in the $cust array by using something like this in your code:
    Code:
     die('$cust data=' . print_r($cust, true));
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  6. #16
    Join Date
    Dec 2005
    Location
    Kalamazoo, MI
    Posts
    64
    Plugin Contributions
    0

    Default Re: Sending order data to a script

    I'm successfully sending product information to my external notifier. However, I also need to extract the attributes for a given product. Is there an attributes class under products tha can get me this, or is there another prefered way?
    I'm using the code from earlier in this thread.
    J.J. Meddaugh
    http://www.atguys.com

  7. #17
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Sending order data to a script

    When hooking the NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL notifier point, the $Class->products array contains many components, including a sub-array of all that product's attributes details. So, you've already got all that information.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #18
    Join Date
    Dec 2005
    Location
    Kalamazoo, MI
    Posts
    64
    Plugin Contributions
    0

    Default Re: Sending order data to a script

    Great. I added this and am now sending attributes with the data as well.

    foreach($prod['attributes'] as $attr) {
    $url .= '&attr_' . $attr['option_id'] . '=' . urlencode($attr['value']);
    }


    Thanks for the help.
    J.J. Meddaugh
    http://www.atguys.com

  9. #19
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,399
    Plugin Contributions
    87

    Default Re: Sending order data to a script

    Rather than doing the various print_r's when I'm in 'debug mode', I use the Super Globals plugin and (when enabled) have it dump "all" the superglobals. That way, I've got clues as to the various data elements that were created as part of the page.

  10. #20
    Join Date
    Dec 2005
    Location
    Kalamazoo, MI
    Posts
    64
    Plugin Contributions
    0

    Default Re: Sending order data to a script

    That's a cool idea.
    One minor problem.
    It doesn't seem to be firing when the customer uses Paypal as payment method.
    I'm currently using NOTIFY_ORDER_AFTER_SEND_ORDER_EMAIL.
    Should I be using a different notifier to catch these orders?
    J.J. Meddaugh
    http://www.atguys.com

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Custom Customer Data To Order Data
    By fotofx in forum General Questions
    Replies: 1
    Last Post: 22 Aug 2010, 08:10 PM
  2. Sending data back to opening window (greybox)
    By blackwolf in forum General Questions
    Replies: 0
    Last Post: 19 May 2010, 09:11 PM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR