Example #1
0
<?php

//$mageFilename = '/mnt/data/html/zuri/public_html/app/Mage.php';
$mageFilename = '../app/Mage.php';
require_once $mageFilename;
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(-1);
umask(0);
Mage::app("default");
$complexFilter = array('complex_filter' => array(array('key' => 'email', 'value' => array('key' => 'eq', 'value' => '*****@*****.**'))));
$proxy = new SoapClient('http://52.11.138.2/index.php/api/v2_soap/?wsdl');
$sessionId = $proxy->login('testapi', 'justdoit');
$customerList = $proxy->customerCustomerList($sessionId, $complexFilter);
print_r($customerList);
<?php

$apiUrlV2 = "http://your.magento.host/api/v2_soap?wsdl";
$apiUser = '******';
$apiKey = 'your_wsdl_api_key';
$client = new SoapClient($apiUrlV2);
// retreive session id from login
$sessionId = $client->login($apiUser, $apiKey);
$filterByEmail = '*****@*****.**';
// using complex filter
$complexFilter = array('complex_filter' => array(array('key' => 'email', 'value' => array('key' => 'eq', 'value' => $filterByEmail))));
$result = $client->customerCustomerList($sessionId, $complexFilter);
var_dump($result);
Example #3
0
<?php

$proxy = new SoapClient('http://finaonation.com/shop/api/v2_soap/?wsdl');
// TODO : change url
$sessionId = $proxy->login('apiintegrator', 'ap11ntegrator');
// TODO : change login and pwd if necessary
/*
$result = $proxy->customerCustomerCreate($sessionId, array('email' => '*****@*****.**', 'firstname' => 'Dough', 'lastname' => 'Deeks', 'password' => 'password'));
print_r($result);
exit;
*/
$result = $proxy->customerCustomerList($sessionId);
$res = objectToArray($result);
$res = json_encode($res);
print_r($res);
function objectToArray($object)
{
    if (!is_object($object) && !is_array($object)) {
        return $object;
    }
    if (is_object($object)) {
        $object = get_object_vars($object);
    }
    return array_map('objectToArray', $object);
}
exit;
<?php

$apiUrlV2 = "http://your.magento.host/api/v2_soap?wsdl";
$apiUser = '******';
$apiKey = 'your_wsdl_api_key';
$client = new SoapClient($apiUrlV2);
// retreive session id from login
$sessionId = $client->login($apiUser, $apiKey);
$result = $client->customerCustomerList($sessionId);
var_dump($result);
Example #5
0
 /**
  * Dummy Function for testing and code
  * TODO remove the function from config.xml and here
  *
  * @param Varien_Event_Observer $observer            
  * @return Zoffio_WmsApi_Model_Observer
  */
 public function customerSaveAfter(Varien_Event_Observer $observer)
 {
     if (self::$_observerExecutionCounter > 1) {
         return $this;
     }
     self::$_observerExecutionCounter++;
     Mage::log(__CLASS__ . "_" . __FUNCTION__, null, 'shebin.log');
     // $event = $observer->getEvent();
     $customer = $observer->getCustomer();
     Mage::log(get_class($customer), null, 'shebin.log');
     $customer_id = $customer->getId();
     $zoff_domain = 'zoffio.com';
     $wms_email_id = $customer_id . "@" . $zoff_domain;
     Mage::log($wms_email_id, null, 'shebin.log');
     $complexFilter = array('complex_filter' => array(array('key' => 'email', 'value' => array('key' => 'eq', 'value' => $wms_email_id))));
     // Mage::log($complexFilter, null, 'shebin.log');
     // Mage::log(self::$_apiPassword, null, 'shebin.log');
     // establish the connection to WMS api
     $proxy = new SoapClient(self::$_apiUrl);
     $sessionId = $proxy->login(self::$_apiUser, self::$_apiPassword);
     try {
         $customerList = $proxy->customerCustomerList($sessionId, $complexFilter);
     } catch (Exception $e) {
         Mage::log($e->getMessage(), null, 'shebin.log');
         Mage::log($e->getTraceAsString(), null, 'shebin.log');
     }
     // Mage::log($event->getData(),null,'shebin.log');
     // Mage::log($customer->getData(), null, 'shebin.log');
     Mage::log($customerList, null, 'shebin.log');
     // If Customer doesn't exist in the WMS
     if (empty($customerList)) {
         // Add the customer
         $customer_details = array('email' => $wms_email_id, 'firstname' => $customer->getFirstname(), 'lastname' => $customer->getLastname(), 'website_id' => $customer->getWebsiteId(), 'store_id' => $customer->getStoreId(), 'group_id' => $customer->getGroupId());
         Mage::log($customer_details, null, 'shebin.log');
         try {
             $result = $proxy->customerCustomerCreate($sessionId, $customer_details);
         } catch (Exception $e) {
             Mage::log($e->getMessage(), null, 'shebin.log');
             // Mage::getSingleton('core/session')->addWarning("Zoffio WMS
             // API : ".$wms_email_id." : ".$e->getMessage());
         }
         Mage::log($result, null, 'shebin.log');
         return $this;
     }
     $proxy->endSession($sessionId);
     // closing session
     return $this;
     // Mage::log($observer->getData(),null,'shebin.log');
     // Mage::dispatchEvent('admin_session_user_login_success',
     // array('user'=>$user));
     // $user = $observer->getEvent()->getUser();
     // $user->doSomething();
 }
Example #6
0
<?php

//phpinfo();
$api_url_v2 = "www.choiceuae.ae/api/v2_soap/?wsdl=1";
$username = '******';
$password = '******';
$cli = new SoapClient($api_url_v2);
//retreive session id from login
$session_id = $cli->login($username, $password);
//call customer.list method
$result = $cli->customerCustomerList($session_id);
print_r($result);