Patch patrick

This commit is contained in:
Laurent Destailleur 2007-10-01 22:18:46 +00:00
parent 9e3ba924ba
commit 3e59b585e3
2 changed files with 41 additions and 22 deletions

View File

@ -46,6 +46,7 @@ class Osc_product
var $osc_stock; var $osc_stock;
var $osc_four; var $osc_four;
var $osc_image; var $osc_image;
var $osc_catid;
var $error; var $error;
@ -110,6 +111,7 @@ class Osc_product
$this->osc_four = $obj[manufacturers_id]; $this->osc_four = $obj[manufacturers_id];
$this->osc_price = $obj[products_price]; $this->osc_price = $obj[products_price];
$this->osc_image = $obj[image]; $this->osc_image = $obj[image];
$this->osc_catid = $obj[categories_id];
} }
else { else {
$this->error = 'Erreur '.$client->getError(); $this->error = 'Erreur '.$client->getError();
@ -140,7 +142,7 @@ class Osc_product
$product->type = 0; $product->type = 0;
$product->seuil_stock_alerte = 0; /* on force */ $product->seuil_stock_alerte = 0; /* on force */
/* on force */ /* on force */
$product->catid = 0; /* à voir avec la gestion des catégories */ /* à voir avec la gestion des catégories */
$product->status = 1; /* en vente */ $product->status = 1; /* en vente */
return $product; return $product;
@ -202,6 +204,20 @@ class Osc_product
else return ''; else return '';
} }
function get_catid($osccatid)
{
require_once(DOL_DOCUMENT_ROOT."/oscommerce_ws/produits/osc_categories.class.php");
$mycat=new Osc_categorie($this->db);
if ($mycat->fetch_osccat($osccatid) > 0)
{
$x = $mycat->dolicatid;
print'<p>'.$x.'</p>';
return $x ;
}
else return 0;
}
function get_osc_productid($productidp) function get_osc_productid($productidp)
{ {
$sql = "SELECT rowid"; $sql = "SELECT rowid";

View File

@ -97,16 +97,19 @@ $sql_data_array = array('products_quantity' => $prod['quant'],
return $products_id; return $products_id;
} }
function get_article($id='',$ref='') {
function get_article($id='',$ref='')
{
//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, p.products_model, p.products_quantity, p.products_status, concat('".OSC_IMG_URL."',p.products_image) as image, p.products_price, d.products_name, d.products_description, m.manufacturers_name, m.manufacturers_id"; $sql = "SELECT p.products_id, p.products_model, p.products_quantity, p.products_status, concat('".OSC_IMG_URL."',p.products_image) as image, p.products_price, d.products_name, d.products_description, m.manufacturers_name, m.manufacturers_id, pc.categories_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 .= " JOIN products_to_categories pc ON p.products_id = pc.products_id ";
$sql .= " LEFT JOIN manufacturers as m ON p.manufacturers_id=m.manufacturers_id";
$sql .= " WHERE d.language_id =" . OSC_LANGUAGE_ID; $sql .= " WHERE d.language_id =" . OSC_LANGUAGE_ID;
if ($id) $sql.= " AND p.products_id = ".$id; if ($id) $sql.= " AND p.products_id = ".$id;
if ($ref) $sql.= " AND p.products_model = '".addslashes($ref)."'"; if ($ref) $sql.= " AND p.products_model = '".addslashes($ref)."'";