Web Services

Has anyone done any web services integration with CS-Cart? I’m looking at a possible shop backend stock control integration for stock, orders, product data and customer data. Just wondered what knowledge was out there on this?

thanks, Wilbo

We have done some of this… it is really a matter of being able to put together and parse XML requests. Then you have to insert the calls into the right spots for what you are trying to do.

We use it to transmit orders, received order status, receive updates and update inventory. Cron jobs call the necessary controller urls.

some kind of native SOAP/REST service framework coudl be a really +1 for CS-cart!

i just asked the cs-cart team for a new feature using services… i’ll keep you updated!


I would love to have some help using XML calls to import orders and customers into the system. Please let me know who I can contact.

[quote name=‘caroque’]I would love to have some help using XML calls to import orders and customers into the system. Please let me know who I can contact.[/QUOTE]

What do you mean import orders and customers into the “system”? Do you mean you want to have a webservice that calls down orders and customers from CS-Cart to some other Database you have separate of CS-Cart, or do you mean you want to import from some other Database into the CS-Cart system?

Which ever it is, do you mean to say you want this kind of thing done on a daily basis or a one time thing?

Is there a way to use an xml feed in cs-cart. My wholesaler supplied with with a feed and also straight xml doucments for each product. How would i implement that in cs cart.

I understand what you are asking and it will be interesting to see the comments in reply on this question …

If there is no built in function for this in 2.0.10 and nobody has any ready made import script, I would be glad to give you a hand with that though it would be interesting to see if there is already a working solution out there on that.

Fortunately though, loading data from XML from PHP scripts is ridiculously easy these days so it should not be difficult to create a conversion scripts for you if it turns out that is what you would need to do.

Spiral: I have sent you a pm…

Yes, my supplier has sent me a a data feed .xml. It has soap1 and soap 1.2, I am not sure what all this means. I would like to get this feed incorporated into cs-cart. I am just not sure how to do this.

Hey Spiral,

Are you planning to develop a SOAP service sh1nn3r ?

Anyone… Spiral?

I am looking to get into web services with my current modifications I am working towards. Have anything down yet ?

[quote name=‘unique2’]Anyone… Spiral?

I am looking to get into web services with my current modifications I am working towards. Have anything down yet ?[/QUOTE]

We are in development with two Web service clients.One of our distributors has stood up Web services where we can get current inventory for all part numbers, and where we can send customer orders via a Web service instead of Email. We want to update our inventory levels every 15 minutes with a PHP web client application ran from cron, and get the customer order to our distributor via a client web service call. We’ll probably use a hook from somewhere in the CS-Cart order process, we just don’t know where that will be yet.

There’s a number of different ways to consume a Web service from PHP, we chose the NuSOAP PHP library and created a PHP application using that library. Don’t worry about differences between SOAP 1.1 and SOAP 1.2, the NuSOAP library takes care of that for you. There’s lot’s of examples on Google with PHP/NuSOAP, we started with this one and moved on from there: [url]http://www.geekology.co.za/blog/2009/10/using-php-and-nusoap-to-connect-to-web-services/[/url]

One we get the inventory levels from the Web service, we parse through the XML feed and update the CS-Cart tables via a SQL query, for example:

update cscart_products set amount = 100 where product_code = ‘PROD_CODE’;

Seems to work ok so far for inventory, we’ll probably test for a few more weeks and then get working on the order side. This distributor also has a Web service for drop ship which we hope to take advantage of as well.

For us this will be a much better way than updating our inventory levels via the import function. In addition, on the product page we can tell the customer “25 in stock” and be confident in those levels to so we don’t get backorders. We are also working on telling the customer “2 in stock - Order Soon for Availability!” or something like that if inventory levels are below a certain number. We want to avoid backorders at all costs, I hate backorders.

One downside is that this does tie us into one distributor for all of our products, but we are ok with that right now. Even if their prices are a little higher than other distributors, thier support of Web services will save us a ton of time.


I’ve been thinking about a similar thing as mentioned by the original poster. That is implement web services for backend data retrieval.

I’ve been thinking about retrieving the following data:

  • product listing
  • stock status
  • orders
  • user comments

    The following things could be inserted/modified:
  • products
  • orders status
  • approve/reject user comments

    What else do you think would be useful? Also what about securing the process?

    I would be glad to hear your opinions on this!

We are doing this now.

I have looked into NuSOAP as well and I think that is the way we are going.

So eventually we will be exporting order, customer information for each order. We will also be doing what Chris is doing where we update the quantity in inventory every 5-15 mins according to our SaaS Accounting/Inventory Solution.

Everything feed back and forth between the two systems to make inventory as “Real Time” as possible.

I’ll post back when we have something working.

I’m also currently in the process of developing a webservice to add/change products/prices/pictures/categories etc for cscart primarily so we can update cscart web sites (our own and some sites that use us for dropshipping) from our Dynamics GP / RMS databases throughout the day. Also included will be reading/writing to the order tables. And lastly will be another payment processor page that I am developing to work with Nodus, because Nodus is the only payment processor that works with Dynamics GP.

I had done some integration before using VB.Net 3.5 that directly accesssed all the tables needed, but this time I really want to use the hooks, controllers, and existing api’s as much as possible so we can continue to upgrade.

update: I am now to the point where I have a webservice using nusoap that I can post data & images to. I’m now trying to create the Curl to post to the products controller with mode=add…

I see I can log in with curl to admin.php and then hopefully hit the products.asp page again…my basic code is looking like this: (kept simple for proof of concept). I’m also returning the server output in my web service so I can see the results. Has anyone else done this? It really sucks to reverse-engineer everything I thought cscart was built so it could use add-ins, but it seems like the code hooks and pre and post controllers are made to call out to my code rather than let me call in to a controller for example.


$ch = curl_init(‘http://webserv01.gva-twn.com/cscart/admin.php’);


curl_setopt ($ch, CURLOPT_POST, 1);

curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);

curl_setopt($ch, CURLOPT_HEADER ,1);

$parameters = ‘username=root&password=cronos889&return_url=admin.php&dispatch[auth.login]=Sign in’;

//$parameters = array(‘username’ => ‘admin’, ‘password’ => ‘password’, ‘return_url’ => ‘admin.php’, ‘dispatch[auth.login]’ => ‘Sign in’);

curl_setopt ($ch, CURLOPT_POSTFIELDS, $parameters);

curl_setopt ($ch, CURLOPT_COOKIEJAR, ‘cookie.txt’);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);


//post the data to new products.php

curl_setopt($ch, CURLOPT_URL, ‘http://webserv01.gva-twn.com/cscart/admin.php?dispatch=products.add’);

$parameters = array(“file_product_main_image_icon[0]” => “@$filename”, “product_data” => $product_data);

curl_setopt ($ch, CURLOPT_POSTFIELDS, $parameters);

curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);

$returndata1 = curl_exec ($ch);

return “$returndata$returndata1”;

using the above I am getting a 302 redirect from the admin.php for some reason.

I have successfully established a working framework for my integration web service. I will continue updates on another thread I started:


Well, one cool thing about Magento Commerce is that it has web services built-in.

You just create a web service user and connect to it remotely.

Let’s me download and update orders easily.

Don’t even need to use NuSOAP. Just use the built-in SOAP functions in PHP 5.

Too bad an it’s broken in PHP 5.3, but works under PHP 5.2 The latest Magento commerce fix the issue and should work with PHP 5.3

Sample of my Magento Commerce web services code:


$proxy = new SoapClient(‘http://www.domain.com/api/soap/?wsdl=1’);

$sessionId = $proxy->login(‘username’, ‘password’);

if (is_soap_fault($proxy)) {

trigger_error(“SOAP Fault: (faultcode: {$result->faultcode}, faultstring: {$result->faultstring})”, E_USER_ERROR);


$orders = $proxy->call($sessionId, ‘sales_order.list’, array(array(‘status’=>array(‘like’=>‘processing’))));

$count = 0;

foreach ($orders as $order_info)


$order_id = $order_info[‘increment_id’];

blah blah blah




That is unfortunate for me, because I am basically committed to cscart. And now I have invested significant research to learn PHP, JQuery, Smarty, and some of the cscart api itself, though it is terribly confusing for a newbie like me. My only advantage is over 20 years of programming experience makes it easy to learn new languages for me.

Hi all,

I have one large distributor that provides me full access to their database. My situation is very similar to that of Chris W. I have 27,000 items from one distributor. My inventory updates every 15 minutes. I am also looking for some help to write a drop-down menu to search by manufacture. I have 350 manufactures.

My distributor has given me all the information needed however I am in need of a developer/programmer to write the web services for me. I too was looking at NU-SOAP but is beyond my programming ability.

Does anyone here do this type of work? If not, does anyone know of a freelancer who does? I would like to get started immediately.