Bonjour,
Merci de me donner votre avis sur ce probleme.
Depuis que j'ai changé d'hébergeur avec Mysql 5 j'ai l'erreur suivante:
A mon avis le script est que pour Php4
<?xml version="1.0" encoding="ISO-8859-1"?>
<catalogue lang="FR" date="2006-11-22 15:18" GMT="+1" version="2.0">
<br />
<b>Fatal error</b>: Call to undefined function tep_db_query() in <b>/home/www/905b1e6338a8abc6a3cf100bd27c4783/web/newzen/xml_guide.php</b> on line <b>66</b><br />
Le listing du programme:
<?php
/*
$Id: xml_guide.php,v 1.43 2004/08/15 12:00:hpdl Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Created by Toucouleur.fr:info@toucouleur.fr
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
*/
/*
si vous utilisez une version de php supérieure ou égale à 4.3.10
vous pouvez supprimer ce qui suit jusqu'a "fin html_entity_decode" ligne 38
*/
if (!function_exists('html_entity_decode'))
{
function html_entity_decode ($string, $opt = ENT_COMPAT)
{
$trans_tbl = get_html_translation_table (HTML_ENTITIES);
$trans_tbl = array_flip ($trans_tbl);
if ($opt & 1)
{ // Translating single quotes
// Add single quote to translation table; doesn't appear to be there by default
$trans_tbl["'"] = "'";
}
if (!($opt & 2))
{ // Not translating double quotes
// Remove double quote from translation table
unset($trans_tbl["""]);
}
return strtr ($string, $trans_tbl);
}
}
//fin html_entity_decode
/*
Fixe la limite de temps d'exécution du script (en seconde).
Par défaut elle est de 30 secondes.
La valeur 0, permet un temps d'exécution illimité.
Cela dépend du nombre de produit, de la puissance,
ainsi que de la charge de la machine au moment ou le script est lancé.
Ne changez sa valeur que si vous rencontrez des erreurs
en mettant une valeur supérieure à 30.
*/
//set_time_limit(0);
require('includes/application_top.php');
Header( 'Content-Type: text/xml' );
define ('DISPLAY_PRICE_WITH_TAX', true);
echo '<?xml version="1.0" encoding="ISO-8859-1"?>'.chr(10);
// Déclaration du catalogue. Il est recommandé d'indiquer correctement la langue et le fuseau horaire GMT.
echo '<catalogue lang="FR" date="'. date('Y-m-d H:i'). '" GMT="+1" version="2.0">'.chr(10);
// On vérifie la langue utilisée dans le catalogue
$language_code = (isset($HTTP_GET_VARS['language']) && tep_not_null($HTTP_GET_VARS['language'])) ? $HTTP_GET_VARS['language'] : DEFAULT_LANGUAGE;
// Requête pour identifier les catégories existantes dans le catalogue
$included_categories_query = tep_db_query("SELECT c.categories_id, c.parent_id, cd.categories_name FROM " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd WHERE c.categories_id = cd.categories_id AND cd.language_id = FLOOR($languages_id)");
$inc_cat = array();
// Identification du nom de la catégorie, et l'id de la catégorie parent
while ($included_categories = tep_db_fetch_array($included_categories_query)) {
$inc_cat[] = array (
'id' => $included_categories['categories_id'],
'parent' => $included_categories['parent_id'],
'name' => $included_categories['categories_name']);
}
$cat_info = array();
for ($i=0; $i<sizeof($inc_cat); $i++)
$cat_info[$inc_cat[$i]['id']] = array (
'parent'=> $inc_cat[$i]['parent'],
'name' => $inc_cat[$i]['name'],
'path' => $inc_cat[$i]['id'],
'link' => '' );
for ($i=0; $i<sizeof($inc_cat); $i++) {
$cat_id = $inc_cat[$i]['id'];
while ($cat_info[$cat_id]['parent'] != 0){
$cat_info[$inc_cat[$i]['id']]['path'] = $cat_info[$cat_id]['parent'] . '_' . $cat_info[$inc_cat[$i]['id']]['path'];
$cat_id = $cat_info[$cat_id]['parent'];
}
$link_array = split('_', $cat_info[$inc_cat[$i]['id']] ['path']);
for ($j=0; $j<sizeof($link_array); $j++) {
$cat_info[$inc_cat[$i]['id']]['link'] .= ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cat_info[$link_array[$j]]['path']) . '"><nobr>' . $cat_info[$link_array[$j]]['name'] . '</nobr></a> » ';
}
}
// Requête identifiant les produits disponibles dans le catalogue
/*******************************************************************
* Méthode de "requêtage"
* méthode publique
* @Param string $qry => requête
*******************************************************************/
public function query ($qry) {
$this -> sql = $qry;
if (false === $this -> qryRes = $this -> private_query ()) {
$this -> error (get_class ($this).' :: query ( )',
$this -> private_errno ().' : '.$this -> private_error (),
$this -> sql);
} else {
return $this -> qryRes;
}
}
$products_query = tep_db_query("SELECT p.*, pd.products_name, pd.products_description, pc.categories_id FROM " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " pc WHERE p.products_id = pd.products_id AND p.products_id = pc.products_id AND p.products_status = 1 AND pd.language_id = FLOOR($languages_id) ORDER BY pc.categories_id, pd.products_name");
$product_num = 0;
while($products = tep_db_fetch_array($products_query)) {
if (intval($products['manufacturers_id']) > 0) {
$manufacturers_query = tep_db_query("SELECT manufacturers_name FROM " . TABLE_MANUFACTURERS . " WHERE manufacturers_id = " . $products['manufacturers_id']);
$manufacturers_result = tep_db_fetch_array($manufacturers_query);
$products['manufacturers_name'] = $manufacturers_result['manufacturers_name'];
}
$special_query = tep_db_query("SELECT specials_new_products_price , expires_date , specials_date_added FROM " . TABLE_SPECIALS . " WHERE products_id = " . $products['products_id'] . " AND status = '1'");
$special_result = tep_db_fetch_array($special_query);
/*if ($special_result = tep_db_fetch_array($special_query))
$products['products_price'] = $special_result['specials_new_products_price'];*/
$product_num++;
//calcul des prix
$price = tep_add_tax($products['products_price'], tep_get_tax_rate($products['products_tax_class_id']));
if($special_result['specials_new_products_price'] == '' ) {
$discount_price = '' ;
$regular_price = $price;
$sale = 0;
} else {
$discount_price = $special_result['specials_new_products_price'];
$regular_price = $price;
$sale = 2; //Si les promotions sont des soldes, modifiez cette valeur par 1.
}
/*
si la valeur d'un champ est fixe, vous pouvez l'indiquer comme ceci:
<champ>valeur</champ>
s'il n'a pas de valeur laissez le champ vide.
Les unités de poids et taille peuvent être modifiées en dur lignes 164 et 165.
La valeur de <sales> peut-être modifiée en dur ligne 127.
*/
echo '<product place="'.$product_num.'">'."\n";
echo '<merchant_category><![CDATA['.$cat_info[$products['categories_id']]['name'] . ']]></merchant_category>'.chr(10);
echo '<offer_id><![CDATA['. $products['products_id'] .']]></offer_id>'.chr(10);
echo '<name><![CDATA['. $products['products_name'] .']]></name>'.chr(10);
echo '<description><![CDATA['. substr(strip_tags(str_replace(array('<BR>','<br>'), "</P>\n<P>",html_entity_decode($products['products_description']))),0,245) .'...]]></description>'.chr(10);
echo '<regular_price currency="EUR">'. $regular_price .'</regular_price>'.chr(10);
echo '<product_url><![CDATA['. HTTP_SERVER . DIR_WS_HTTP_CATALOG . FILENAME_PRODUCT_INFO . '?products_id=' . $products['products_id'] .']]></product_url>'.chr(10);
echo '<image_url><![CDATA['. HTTP_SERVER . DIR_WS_HTTP_CATALOG . DIR_WS_IMAGES . $products['products_image'] .']]></image_url>'.chr(10);
echo '<discount_price currency="EUR">'. $discount_price .'</discount_price>'.chr(10);
echo '<price_discounted_from><![CDATA['.substr($special_result['specials_date_added'],0,16).']]></price_discounted_from>'.chr(10);
echo '<price_discounted_until><![CDATA['.substr($special_result['expires_date'],0,16).']]></price_discounted_until>'.chr(10);
echo '<sales>'.$sale.'</sales>'.chr(10);//sale peut prendre les valeurs : 0->pas de promotions,1->solde,2->autre promotions
echo '<delivery currency="EUR">FR;-1;</delivery>'.chr(10);
echo '<manufacter></manufacter>'.chr(10);
echo '<brand><![CDATA['.$products['manufacturers_name'].']]></brand>'.chr(10);
echo '<model_number><![CDATA['. $products['products_model'] .']]></model_number>'.chr(10);
echo '<manufacturer_product_id><![CDATA[]]></manufacturer_product_id>'.chr(10);
echo '<ean13></ean13>'.chr(10);
echo '<guarantee unit="year"></guarantee>'.chr(10); //unit peut prendre les valeurs : year,month,week,day
echo '<used></used>'.chr(10);
echo '<used_condition><![CDATA[]]></used_condition>'.chr(10);//ne doit pas dépasser 25 caractères et doit être dans la langue du catalogue
echo '<update_date><![CDATA['.substr($products['products_last_modified'],0,16).']]></update_date>'.chr(10);
echo '<promo_text><![CDATA[]]></promo_text>'.chr(10);
echo '<offer_valid_from><![CDATA['.substr($products['products_date_added'],0,16).']]></offer_valid_from>'.chr(10);
echo '<offer_valid_until><![CDATA['.substr($products['products_date_available'],0,16).']]></offer_valid_until>'.chr(10);
echo '<size unit="cm"></size>'.chr(10);
echo '<weight unit="kg">'.$products['products_weight'].'</weight>'.chr(10);
echo '<color><![CDATA[]]></color>'.chr(10);
echo '</product>';
flush();
}
echo '</catalogue>';
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>