Error when using QuickBooks PHP DevKit examples -


i have setup quickbooks php devkit, trying run example_customer_add script sandbox. when do, following error:

notice: undefined variable: context in /applications/mamp/htdocs/quickbooks-php/test_qb.php on line 54

i've tried track down $context variable, used on place, , i'm unsure of being set, etc...

any appreciated! thanks!

edit

i'm using script included in docs folder of quickbooks php devkit:

<?php require_once dirname(__file__) . '/config.php'; require_once dirname(__file__) . '/views/header.tpl.php'; ?>  <pre>  <?php  $customerservice = new quickbooks_ipp_service_customer();  $customer = new quickbooks_ipp_object_customer(); $customer->settitle('ms'); $customer->setgivenname('shannon'); $customer->setmiddlename('b'); $customer->setfamilyname('palmer'); $customer->setdisplayname('shannon b palmer ' . mt_rand(0, 1000));  // terms (e.g. net 30, etc.) $customer->setsalestermref(4);  // phone # $primaryphone = new quickbooks_ipp_object_primaryphone(); $primaryphone->setfreeformnumber('860-532-0089'); $customer->setprimaryphone($primaryphone);  // mobile # $mobile = new quickbooks_ipp_object_mobile(); $mobile->setfreeformnumber('860-532-0089'); $customer->setmobile($mobile);  // fax # $fax = new quickbooks_ipp_object_fax(); $fax->setfreeformnumber('860-532-0089'); $customer->setfax($fax);  // bill address $billaddr = new quickbooks_ipp_object_billaddr(); $billaddr->setline1('72 e blue grass road'); $billaddr->setline2('suite d'); $billaddr->setcity('mt pleasant'); $billaddr->setcountrysubdivisioncode('mi'); $billaddr->setpostalcode('48858'); $customer->setbilladdr($billaddr);  // email $primaryemailaddr = new quickbooks_ipp_object_primaryemailaddr(); $customer->setprimaryemailaddr($primaryemailaddr);  if ($resp = $customerservice->add($context, $realm, $customer)) {   print('our new customer id is: [' . $resp . '] (name "' . $customer-    >getdisplayname() . '")'); } else {   print($customerservice->lasterror($context)); }   ?>  </pre> <?php require_once dirname(__file__) . '/views/footer.tpl.php'; 

the quickbooks_oauth table looks after attempting connect:

'1', 'do_not_change_me', '12345', 'qyprdax1yo1uyqu3gu8xxpvs8raotss2zvrbe3fhwy7qzdab', 'iwzhlw2e956sqr9gvixa2jou82ndsrjixzlpb3af', 'knwike2buxtqfqj/vb0nhjzbgymxwrrct9xtfoqiv6f8aeguoqgza7aherlpj/z6epyy1zs4e6zuvptebaqtxc5h0cn5vccmwlfj+lryacplgw8mgk5+e/muv2wj+3uwboyqvstu+pyqw/yngfkhfsua3logjgqctuo6zpmk1wwr42iyca05qrjuob4+lq==', 'rcj1v3zl4jj5mhgtw+bpcpn7sdcjkzlqpwb1tyerexedsqb0wsz+camcbafs+hfn3eczl3mfndsyiqkdk+t8rseakyfwwrspoh3ucwdcdehxrtsuddmkhoiq6pl6yvtneyetyntfmakyn+u6uiwsemkzb/4iujk8c0gp5khoksl0dv+bp9w=', '1391140255', 'qbo', null, '2015-06-04 19:57:58', '2015-06-04 19:58:36', '2015-06-04 19:58:36' 

the code posted missing several lines @ top of script. @ example on github:

https://github.com/consolibyte/quickbooks-php/blob/master/docs/partner_platform/example_app_ipp_v3/example_customer_add.php#l3

there 2 require_once statements missing. $context defined in required files.

require_once dirname(__file__) . '/config.php'; require_once dirname(__file__) . '/views/header.tpl.php'; 

fix code you're using example code completely, , making sure required files included.

if continue have trouble, please post updated code.

you can see $context gets defined here:

note you must connected quickbooks run example. i'm assuming have clicked "connect quickbooks" button , gotten connected already... right?


Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -