“no data exchange required”

后端 未结 1 976
囚心锁ツ
囚心锁ツ 2020-12-21 18:48

I am new to quickbook and my client wants to sync his Magento orders with QuickBooks. He uses QuickBooks Enterprises desktop edition to sync the orders. We are using PHP dev

相关标签:
1条回答
  • 2020-12-21 18:59

    If you read the comments in the example file, you'll find this comment:

        // IMPORTANT NOTE: This particular example of queueing something up will 
        //  only ever happen *once* when these scripts are first run/used. After 
        //  this initial test, you MUST do your queueing in another script. DO NOT 
        //  DO YOUR OWN QUEUEING IN THIS FILE! See 
        //  docs/example_web_connector_queueing.php for more details and examples 
        //  of queueing things up.
    

    And a link to this page:

    • http://wiki.consolibyte.com/wiki/doku.php/quickbooks_integration_php_consolibyte#the_web_connector_keeps_telling_me_no_data_exchange_required__what_does_that_mean

    Which says:

    There's no data to exchange. There's nothing to do. The Web Connector and this framework work using a 'queue' concept. Once the queue is empty, there's nothing else to do, and you'll get that message. If you add something to the queue, then it will process those items until there's nothing left to do, and then you'll get the “No Data Exchange…” message again.

    So, for instance, say you want to build a process whereby every time a customer is created within your store, the customer gets created in QuickBooks. You'd then want to set up a process where when that customer is created within your store, you queue up a request to add the customer to QuickBooks.

    You do your queueing using the QuickBooks_Queue class, and the →enqueue() method.

    So essentially the problem is you haven't told it to do anything. The example only adds ONE customer to QuickBooks.

    If you want to add more customers, you need to queue something up so that it tries to do that.

    When you queue something up, note that you must do that somewhere else. DO NOT QUEUE STUFF UP IN THIS FILE (just like the comments above say).

    So somewhere else in your app, you probably have some code like this for when you add a new customer to your app database:

    // end-user submitted a form, let's save the customer to our database
    if ($_POST['customer_name'])
    {
      mysql_query("INSERT INTO my_customer_table ( ... ) VALUES ( ... )");
    }
    

    You should modify your app code to then look something like this:

    // end-user submitted a form, let's save the customer to our database
    if ($_POST['customer_name'])
    {
      mysql_query("INSERT INTO my_customer_table ( ... ) VALUES ( ... )");
    
      // ... and queue them up to be added to QB
      $primary_key_of_your_customer = mysql_insert_id();
      $Queue = new QuickBooks_WebConnector_Queue($dsn);
      $Queue->enqueue(QUICKBOOKS_ADD_CUSTOMER, $primary_key_of_your_customer);
    }
    

    As a side note, note that anything in this block:

    if (!QuickBooks_Utilities::initialized($dsn))
    {
    

    Only runs ONCE. So don't do anything in this block - it won't ever run again.

    0 讨论(0)
提交回复
热议问题