Fix: Help for ws service is more clear.
This commit is contained in:
parent
658c95a3e6
commit
c82425c488
@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
/* Copyright (C) 2003-2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
||||||
* Copyright (C) 2004-2007 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2004-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007 Jean Heimburger <jean@tiaris.info>
|
* Copyright (C) 2007 Jean Heimburger <jean@tiaris.info>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -21,53 +21,53 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/oscommmerce_ws/includes/configure.php
|
* \file htdocs/oscommmerce_ws/includes/configure.php
|
||||||
\ingroup oscommerce_ws
|
* \ingroup oscommerce_ws
|
||||||
\brief Configuration client Webservice
|
* \brief Configuration client Webservice
|
||||||
\version $Revision$
|
* \version $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//base url des webservices
|
// URL To reach web services
|
||||||
|
define(OSCWS_DIR,'http://myoscserver/ws_server/');
|
||||||
|
|
||||||
|
// URL To reach OSCommerce
|
||||||
|
define(OSC_URL, 'http://myoscserver/'); // url du site OSC
|
||||||
|
|
||||||
|
|
||||||
define(OSCWS_DIR,'http://www.tiaris.info/catalog/ws_OSC/');
|
|
||||||
|
|
||||||
define(OSC_URL, 'http://www.tiaris.info/catalog/'); // url du site OSC
|
|
||||||
|
|
||||||
//affichages dans la page d'accueil
|
//affichages dans la page d'accueil
|
||||||
define(OSC_MAXNBCOM, 5);
|
define(OSC_MAXNBCOM, 5);
|
||||||
define(OSC_ORDWAIT,'4'); // code du statut de commande en attente
|
define(OSC_ORDWAIT,'4'); // code du statut de commande en attente
|
||||||
define(OSC_ORDPROCESS,'1'); // code du statut de commande en traitement
|
define(OSC_ORDPROCESS,'1'); // code du statut de commande en traitement
|
||||||
//
|
|
||||||
|
|
||||||
define(OSC_ENTREPOT, 1); //l'entrepot lié au stock du site web
|
define(OSC_ENTREPOT, 1); //l'entrepot lie au stock du site web
|
||||||
define(TX_CURRENCY, 1); // le taux de conversion monnaie site osc - monnaie dolibarr (1 euro = 119.33 XPF)
|
define(TX_CURRENCY, 1); // le taux de conversion monnaie site osc - monnaie dolibarr (1 euro = 119.33 XPF)
|
||||||
define(NB_DECIMALS, 2);
|
define(NB_DECIMALS, 2);
|
||||||
define(NB_DECIMALSITE, 2); // nb de décimales sur le site
|
define(NB_DECIMALSITE, 2); // nb de decimales sur le site
|
||||||
define(FK_PORT, 2); // l'id du service frais de port défini.
|
define(FK_PORT, 2); // l'id du service frais de port defini.
|
||||||
|
|
||||||
// fonctions
|
// fonctions
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief assure la conversion en monnaie de dolibarr
|
* \brief assure la conversion en monnaie de dolibarr
|
||||||
* \param oscid Id du produit dans OsC
|
* \param oscid Id du produit dans OsC
|
||||||
* \param prodid champ référence
|
* \param prodid champ r<EFBFBD>f<EFBFBD>rence
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function convert_price($price)
|
function convert_price($price)
|
||||||
{
|
{
|
||||||
return round($price * TX_CURRENCY, NB_DECIMALS);
|
return round($price * TX_CURRENCY, NB_DECIMALS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief assure la conversion en monnaie de dolibarr
|
* \brief assure la conversion en monnaie de dolibarr
|
||||||
* \param oscid Id du produit dans OsC
|
* \param oscid Id du produit dans OsC
|
||||||
* \param prodid champ référence
|
* \param prodid champ r<EFBFBD>f<EFBFBD>rence
|
||||||
* \return int <0 si ko, >0 si ok
|
* \return int <0 si ko, >0 si ok
|
||||||
*/
|
*/
|
||||||
function convert_backprice($price)
|
function convert_backprice($price)
|
||||||
{
|
{
|
||||||
return round($price / TX_CURRENCY, NB_DECIMALSITE);
|
return round($price / TX_CURRENCY, NB_DECIMALSITE);
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -3,7 +3,7 @@ OSCommerce interface and Dolibarr
|
|||||||
|
|
||||||
TODO ON THE OSCOMMERCE WEBSITE INSTALLATION :
|
TODO ON THE OSCOMMERCE WEBSITE INSTALLATION :
|
||||||
|
|
||||||
Copy the contents of the ws_server directory on the OSCommerce web server.
|
Copy the directory ws_server and its content on the OSCommerce web server.
|
||||||
This includes the lib directory which contains the nusoap library, the
|
This includes the lib directory which contains the nusoap library, the
|
||||||
includes directory which contains the configure.php file and the ws_* files.
|
includes directory which contains the configure.php file and the ws_* files.
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
<?php
|
||||||
|
header("Location: ws_index.html");
|
||||||
|
?>
|
||||||
@ -23,19 +23,6 @@ set_magic_quotes_runtime(0);
|
|||||||
|
|
||||||
require_once("./includes/configure.php");
|
require_once("./includes/configure.php");
|
||||||
|
|
||||||
define(OSC_IMG_URL, 'http://www.tiaris.info/catalog/images/'); // url du site OSC
|
|
||||||
|
|
||||||
// OSC
|
|
||||||
|
|
||||||
define('OSCADMIN', '/home/tiaris.info/catalog/admin/');
|
|
||||||
define('OSCIMAGES', '/home/tiaris.info/catalog/images/');
|
|
||||||
|
|
||||||
require(OSCADMIN.'includes/configure.php');
|
|
||||||
require(OSCADMIN.DIR_WS_CLASSES . 'object_info.php');
|
|
||||||
require(OSCADMIN.DIR_WS_INCLUDES . 'database_tables.php');
|
|
||||||
require(OSCADMIN.DIR_WS_FUNCTIONS . 'database.php');
|
|
||||||
require(OSCADMIN.DIR_WS_FUNCTIONS . 'general.php');
|
|
||||||
|
|
||||||
|
|
||||||
// Soap Server.
|
// Soap Server.
|
||||||
require_once('./lib/nusoap.php');
|
require_once('./lib/nusoap.php');
|
||||||
@ -43,9 +30,9 @@ require_once('./lib/nusoap.php');
|
|||||||
// Create the soap Object
|
// Create the soap Object
|
||||||
$s = new soap_server;
|
$s = new soap_server;
|
||||||
/* $ns='oscommerce';
|
/* $ns='oscommerce';
|
||||||
$s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns);
|
$s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns);
|
||||||
$s->wsdl->schemaTargetNamespace=$ns;
|
$s->wsdl->schemaTargetNamespace=$ns;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Register a method available for clients
|
// Register a method available for clients
|
||||||
$s->register('get_article');
|
$s->register('get_article');
|
||||||
@ -56,11 +43,11 @@ $s->register('get_categorylist');
|
|||||||
|
|
||||||
function create_article($prod)
|
function create_article($prod)
|
||||||
{
|
{
|
||||||
// make a connection to the database... now
|
// make a connection to the database... now
|
||||||
tep_db_connect() or die('Unable to connect to database server!');
|
tep_db_connect() or die('Unable to connect to database server!');
|
||||||
|
|
||||||
// vérifier les paramètres
|
// v<>rifier les param<61>tres
|
||||||
$sql_data_array = array('products_quantity' => $prod['quant'],
|
$sql_data_array = array('products_quantity' => $prod['quant'],
|
||||||
'products_model' => $prod['ref'],
|
'products_model' => $prod['ref'],
|
||||||
'products_image' => $prod['image'],
|
'products_image' => $prod['image'],
|
||||||
'products_price' => $prod['prix'],
|
'products_price' => $prod['prix'],
|
||||||
@ -93,7 +80,7 @@ $sql_data_array = array('products_quantity' => $prod['quant'],
|
|||||||
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
|
tep_db_perform(TABLE_PRODUCTS_DESCRIPTION, $sql_data_array);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $products_id;
|
return $products_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -133,11 +120,11 @@ function get_article($id='',$ref='')
|
|||||||
|
|
||||||
function get_listearticles() {
|
function get_listearticles() {
|
||||||
|
|
||||||
//on se connecte
|
//on se connecte
|
||||||
if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connexion impossible");
|
if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connexion impossible");
|
||||||
if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error());
|
if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error());
|
||||||
|
|
||||||
//on recherche
|
//on recherche
|
||||||
$sql = "SELECT p.products_id as OSC_id, p.products_model as model, p.products_quantity as quantity, p.products_status as status, concat('".OSC_IMG_URL."',p.products_image) as image, d.products_name as name, m.manufacturers_name as manufacturer, m.manufacturers_id";
|
$sql = "SELECT p.products_id as OSC_id, p.products_model as model, p.products_quantity as quantity, p.products_status as status, concat('".OSC_IMG_URL."',p.products_image) as image, d.products_name as name, m.manufacturers_name as manufacturer, m.manufacturers_id";
|
||||||
$sql .= " FROM products as p";
|
$sql .= " FROM products as p";
|
||||||
$sql .= " JOIN products_description as d ON p.products_id = d.products_id "; $sql .= " LEFT JOIN manufacturers as m ON p.manufacturers_id=m.manufacturers_id";
|
$sql .= " JOIN products_description as d ON p.products_id = d.products_id "; $sql .= " LEFT JOIN manufacturers as m ON p.manufacturers_id=m.manufacturers_id";
|
||||||
@ -159,7 +146,7 @@ function get_listearticles() {
|
|||||||
|
|
||||||
mysql_close($connexion);
|
mysql_close($connexion);
|
||||||
/* Sends the results to the client */
|
/* Sends the results to the client */
|
||||||
return $liste_articles;
|
return $liste_articles;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveImage($name,$content)
|
function saveImage($name,$content)
|
||||||
@ -167,7 +154,7 @@ function saveImage($name,$content)
|
|||||||
$fich = fopen(OSCIMAGES.$name, 'wb');
|
$fich = fopen(OSCIMAGES.$name, 'wb');
|
||||||
fwrite($fich,base64_decode($content));
|
fwrite($fich,base64_decode($content));
|
||||||
fclose($fich);
|
fclose($fich);
|
||||||
return $name.' enregistré';
|
return $name.' enregistr<EFBFBD>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -199,7 +186,7 @@ function get_categorylist($catid)
|
|||||||
}
|
}
|
||||||
mysql_close($connexion);
|
mysql_close($connexion);
|
||||||
/* Sends the results to the client */
|
/* Sends the results to the client */
|
||||||
return $liste_cat;
|
return $liste_cat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -15,6 +15,11 @@ your server OSCommerce.<br>
|
|||||||
<br>
|
<br>
|
||||||
Those pages will be called by Dolibarr using its own SOAP web service client.<br>
|
Those pages will be called by Dolibarr using its own SOAP web service client.<br>
|
||||||
<br>
|
<br>
|
||||||
However, don't forget to edit the configure.php file in the ws_server/includes directory.<br>
|
However, don't forget to edit the <br>
|
||||||
|
* configure.php file in the OSCommerce server side (in ws_server/includes directory) to define
|
||||||
|
how to connect to the OSCommerce database.<br>
|
||||||
|
* configure.php file in the Dolibarr server side (in oscommerce_ws/includes directory) to define
|
||||||
|
how to connect to the OSCommerce server side web services.<br>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Loading…
Reference in New Issue
Block a user