Bonjour,
Etant novice sur oscommerce, je viens vers vous pour un message d'erreur qui apparement se produit assez souvent.
Avant toute choses, j'ai fais le tour de la FAQ et vérifié dans le forum si il n'y avait pas de réponses, avant de venir exposer mon problème.
Je m'explique : Je veut mettre en place une fausse popup uniquement sur ma page d'accueil, celle-ci (http://www.edisaxe.com), j'ai donc modifié le fichier french.php situé sur mon serveur dans /includes/languages/ comme ceci :
[code][/code]
<html>
<head>
<script language="JavaScript">
var status="true"; // "status" turns the popups function "on" or "off"
var poponce="true"; // "poponce" makes popup load only ONCE if "true" or every time if "false"
var cheminImage = ""; // dans le cas d'une image mettez par exemple monimage.jpg
var lienpopup = "<A href="http://www.edisaxe.com/includes/languages/popup_concours.swf";//">http://www.edisaxe.com/includes/languages/popup_concours.swf";// si non swf vous pouvez mettre un lien
monImage = new Image;
monImage.src = cheminImage;
var taillebg = monImage.width
var position_x = (screen.width-monImage.width)/7
var position_y = (screen.height-monImage.height-75)/7
function ouvrir_menu()
{
document.getElementById("menu_context").style.top = 220;
document.getElementById("menu_context").style.left = 700;
document.getElementById("menu_context").style.visibility = "visible";
}function fermer_menu()
{
document.getElementById("menu_context").style.visibility = "hidden";
}
function get_cookie(Name) {
//this function is used only if variable "poponce" above is set to "true"
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == -1)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function loadpopup(){
if (status=="true") { // if popups turned on
if (get_cookie('alreadypopped')==''){ // and cookie not set
window.onload = ouvrir_menu;
if (poponce=="true") { // if popup once only required
document.cookie="alreadypopped=yes" // then set a cookie
}
}
// cookie is already set; so do nothing
}
}
loadpopup()
//-->
</script>
</head>
<?php
/*
$Id: english.php,v 1.114 2003/07/09 18:13:39 dgw_ Exp $
osCommerce, Open Source E-Commerce Solutions
http://www.oscommerce.com
Copyright (c) 2003 osCommerce
Released under the GNU General Public License
Translated by Gunt - Contact : webmaster@webdesigner.com.fr
*/
require(DIR_WS_LANGUAGES . 'add_ccgvdc_french.php'); // ICW CREDIT CLASS Gift Voucher Addittion
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
define('LIEN_FOOTER_NEWS','Lettre d\'information');
define('LIEN_FOOTER_CONTACT','Contact');
define('REF_EXIST_PAS','Cette référence n\'existe pas.');
define('VIEW_ALL', 'Tous voir');
define('NEWS', 'News');
//--------------------------------------------------------
//*****************************************
// SITE REVENDEUR ***
//*****************************************
define('TEXT_GREETING_GUEST_REVENDEUR', '<table cellpadding="0" cellspacing="1"><tr><td class="fd-vert_text">Login:</td><td class="fd-vert_text">Mot de passe:</td></tr><tr><td class="fd-vert_text">%s</td><td>%s</td><td>%s</td></tr></table>');
define('TEXT_CODE_AVANTAGE_REMISE','Remise code avantage:');
define('TEXT_CODE_AVANTAGE_REMISE_PRIX_SPECIAL','Total (avec remise):');
//*****************************************
?><body>
<div style="text-align: center">
<script language="JavaScript">
document.write('<div id=menu_context style="z-index:600;position:absolute;width:'+taillebg+'px; border:0px solid #1d1b73; cursor:default; visibility:hidden;padding:3">');
document.write('<tr><td align="left"><OBJECT id=\"\" codeBase=\"[url="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\"]http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\[/url]" height=\"217\" width=\"270\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\"><PARAM NAME=\"Quality\" VALUE=\"high\"><PARAM NAME=\"BGColor\" VALUE=\"#000000\"><PARAM NAME=\"\" VALUE=\"noborder\"><PARAM NAME=\"Menu\" VALUE=\"false\"><PARAM NAME=\"DeviceFont\" VALUE=\"false\"><PARAM NAME=\"Movie\" VALUE=\"<A href='http://127.0.0.1/web/catalog/includes/languages/popup_concours.swf\">http://127.0.0.1/web/catalog/includes/languages/popup_concours.swf\"><PARAM NAME=\"Base\" VALUE=\"\"><PARAM NAME=\"WMode\" VALUE=\"transparent\"><PARAM NAME=\"SWLiveConnect\" VALUE=\"false\"><PARAM NAME=\"Play\" VALUE=\"true\"><PARAM NAME=\"Loop\" VALUE=\"true\"><PARAM NAME=\"EmbedMovie\" VALUE=\"false\"><EMBED TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"<A href="http://www.macromedia.com/go/getflashplayer\">http://www.macromedia.com/go/getflashplayer\" Src=\"popup_concours.swf\" height=\"217\" width=\"270\" Name=\"\" Quality=\"autohigh\" BGColor=\"\" Scale=\"\" Menu=\"false\" DeviceFont=\"false\" WMode=\"\" SWLiveConnect=\"false\" Play=\"true\" Loop=\"true\" EmbedMovie=\"false\"></EMBED></OBJECT></td></tr></table>');
</script></div>
</body>
</html>Quand je transfert mon fichier sur le serveur, et que j'arrive sur ma page d'accueil, un message me dit : "Warning Cannot modify header information - headers already sent by (output started at data0webedisaxe.comhtdocswwwincludeslanguagesfrench.php4) in data0webedisaxe.comhtdocswwwincludescalcul_cadeau.php on line 4.txt"
j'en deduis que les informations header sont envoyées avant et que c'est la raison pour laquelle il m'affiche ce message d'erreur, mais je ne vois pas comment remédier a ce problème, si quelqu'un pouvait m'expliquer, je le remercierai grandement...
Si cela peut aider je joint le fichier calcul_cadeau.php cité plus haut :
<?php
$nb_prod_cde=0;[/color]
[color="#000000"]setcookie("nom_cookie", $gv_redeem_code, time()+72000);[/color]
[color="#000000"]$cart->get_products();
$products = $cart->get_products();[/color]
[color="#000000"]for ($i=0, $n=sizeof($products); $i<$n; $i++) {[/color]
[color="#000000"]
$adr = explode("?",$_SERVER['HTTP_REFERER']);
$adr = $adr[0];
$adr = explode("/",$adr);
$adr = $adr[3];
if (($_GET['cmdencours']<>'true'))
{
if (($adr=='shopping_cart.php'))
{
if ( (tep_get_products_categorie($products[$i]['id']) == '21') || (tep_get_products_categorie($products[$i]['id']) =='145')){
$cadeaux_a_ajouter='';
$cart->remove($products[$i]['id']);
}
}
}
if (tep_get_products_categorie($products[$i]['id'])=='144'){
// ajout des cadeaux pour abonnements :
// if (tep_get_products_categorie($products[$i]['id'])=='133' || tep_get_products_categorie($products[$i]['id'])=='131'|| tep_get_products_categorie($products[$i]['id'])=='127' || tep_get_products_categorie($products[$i]['id'])=='129' ||tep_get_products_categorie($products[$i]['id'])=='135') {
if (ereg('ABOT', $products[$i]['ref'])) {
$cadeaux_a_ajouter.= 1828;
}
}
if (tep_get_products_categorie($products[$i]['id']) <>'21') {
$nb_prod_cde = $nb_prod_cde + $products[$i]['quantity']; }
}
$total_cde = $cart->show_total();
//echo $nb_prod_cde;
//--------------------------------------------------------
// MODIF BRICE (gest_cadeaux) --
//--------------------------------------------------------
if ( !empty($gv_redeem_code)) {
//Au cas ou le gars a saisi un code et qu'il existe dans la base il faut lui expliquer pourquoi son code ne donne pas de cadeau:
//-soit parce que le montant min n'est pas atteint
//-soit parce que le montant max est dépassé
//-soit le nombre d'article min n'est pas atteint
//-soit le nombre d'article max est dépassé
//-soit parce que la date d'utilisation est dépassé
$query_code_avantage_raw = "select cadeau_id_1,cadeau_id_2,cadeau_id_3,cadeau_id_4,cadeau_id_5,cadeau_id_6,cadeau_i
d_7,palier_1_min,palier_1_flag,palier_2_min,palier_2_flag,palier_3_min,palier_3_f
lag,palier_4_min,palier_4_flag,palier_5_min,palier_5_flag,palier_6_min,palier_6_f
lag,palier_7_min,palier_7_flag,code_actif from brice_codes_avantages ";
$query_code_avantage_raw .= "where code='".$gv_redeem_code."' and date_expire >= now() and date_depart <= now()";
$code_avantage_result = tep_db_query($query_code_avantage_raw);
if ( tep_db_num_rows($code_avantage_result) == 0 ) $cadeau_string = "<br><center><font color=\"red\" size=\"1\">Le code saisi est invalide</font>";
else {
$code_avantage_raw = tep_db_fetch_array($code_avantage_result);
$code_actif = $code_avantage_raw['code_actif'];
$palier_min[1] = $code_avantage_raw['palier_1_min'];
$palier_flag[1] = $code_avantage_raw['palier_1_flag'];
$palier_min[2] = $code_avantage_raw['palier_2_min'];
$palier_flag[2] = $code_avantage_raw['palier_2_flag'];
$palier_min[3] = $code_avantage_raw['palier_3_min'];
$palier_flag[3] = $code_avantage_raw['palier_3_flag'];
$palier_min[4] = $code_avantage_raw['palier_4_min'];
$palier_flag[4] = $code_avantage_raw['palier_4_flag'];
$palier_min[5] = $code_avantage_raw['palier_5_min'];
$palier_flag[5] = $code_avantage_raw['palier_5_flag'];
$palier_min[6] = $code_avantage_raw['palier_6_min'];
$palier_flag[6] = $code_avantage_raw['palier_6_flag'];
$palier_min[7] = $code_avantage_raw['palier_7_min'];
$palier_flag[7] = $code_avantage_raw['palier_7_flag'];
$cadeau_id[1] = $code_avantage_raw['cadeau_id_1'];
$cadeau_id[2] = $code_avantage_raw['cadeau_id_2'];
$cadeau_id[3] = $code_avantage_raw['cadeau_id_3'];
$cadeau_id[4] = $code_avantage_raw['cadeau_id_4'];
$cadeau_id[5] = $code_avantage_raw['cadeau_id_5'];
$cadeau_id[6] = $code_avantage_raw['cadeau_id_6'];
$cadeau_id[7] = $code_avantage_raw['cadeau_id_7'];
$code_date_depart = $cadeau_raw['date_depart'];
$code_date_expire = $cadeau_raw['date_expire'];
if ($code_actif == 'N') {
$msg_erreur = "Le cadeau associé au code saisi n'est plus actif";
} //fin du if
// le flag determine si c'est en nombre d'article ou en montant qu'on doit prendre le nombre entré dans palier_1_min et palier_1_max
if ( $palier_1_flag == 1 ) {
if ( $palier_1_min > $nb_prod_cde ) {
$msg_erreur = MSG_ERROR_1_CADEAU;
$bool = 1;
}
}// fin du if
else {
if ( $palier_1_min > $total_cde ) {
$msg_erreur = MSG_ERROR_2_CADEAU;
$bool = 1
;
}
}// fin du else
$cadeau_string2 ="<center><br/><a href='#' class='jqmClose' style='text-decoration:none;'><input type=button value=\'continuer votre shopping\' id=continuebt /></a> <input type=button value=\'terminer ma commande\' onclick=\"window.location='".tep_href_link('shopping_cart.php')."'\" id=finshop /></center></form>";
// $cadeau_string2 ="<center><br><button class=bt onclick=fermerPopupNova()><img src=".DIR_WS_INCLUDES."particuliers/continuez.gif border=0 /></button> <button onclick=fermerPopupNova(); class=bt value=valider type=submit><img src=".DIR_WS_INCLUDES."particuliers/terminez.gif border=0 /></button></center><br></form>";
$cadeau_string ="<font color=\"red\" size=\"1\">$msg_erreur</font>";
if ($bool != 1) {
//ICI on commence l'affichage des cadeaux palier par palier
$cadeau_string = "<table cellpadding=\"0\" cellspacing=\"0\" border=\"0\" class=\"coupon_r\">";
for($i=1;$i<8;$i++){
$query_palier_cadeau_raw = "select pd.products_id, pd.products_name, pd.products_description from products p, products_description pd ";
$query_palier_cadeau_raw .= "where pd.products_id=p.products_id ";
$query_palier_cadeau_raw .= "and pd.products_id=" . $cadeau_id[$i] . " ";
$query_palier_cadeau_raw .= "and p.products_status=1 ";
$query_palier_cadeau_raw .= "and pd.language_id=".(int)$languages_id;
$query_palier = tep_db_query($query_palier_cadeau_raw);
$palier = tep_db_fetch_array($query_palier);
/// Code pour choix de 2 cadeaux ///
if ( ($palier['products_name'] == 'call_function') && (($palier_min[$i] <= ($nb_prod_cde)) || ($palier_min[$i] <= $total_cde) ) ){
$cadeau_string .= choix2cado('1276','800');
$cadeau_string2 ="";
for ($i=0, $n=sizeof($products); $i<$n; $i++) {
if ( $palier['products_name'] == 'call_function' && isset($cadeaux_a_ajouter) ){
if (( tep_get_products_categorie($products[$i]['id']) == '21')||( tep_get_products_categorie($products[$i]['id']) == '145')){
$cart->remove($products[$i]['id']);
}
}
}
}
/// Fin Code pour choix de 2 cadeaux ///
// réabonnement
elseif (($palier['products_name'] == 'rab08') ) {
$cadeau_string .= "<td width=\"80%\" align =\"center\" class=";
$cadeau_string .= "texte-bleu";
$cadeau_string .= " >";
$cadeau_string .= 'Vous avez désormais accès aux offres de réabonnement<br> Vous pouvez y accéder en cliquant sur le lien ci dessous<br><br><br><br>';
$cadeau_string .= "<a href=". tep_href_link(FILENAME_ACCUEIL,'cPath=144','SSL') .">--> ACCEDER AUX OFFRES DE REABONNEMENT <--</a></td>";
$cadeau_string .= " </td>";
$cadeaux_a_ajouter='';
$cadeau_string2='<br><br>';
}
// Fin réabonnement
elseif (($palier['products_name'] == 'call_function') && (($palier_min[$i] > ($nb_prod_cde)) || ($palier_min[$i] > $total_cde) ) ) { $cadeau_string .= 'Vous n\'avez pas rempli les conditions minimum pour obtenir votre cadeau !!';
if ( (tep_get_products_categorie($products[$i]['id']) == '21') || (tep_get_products_categorie($products[$i]['id']) =='145')){
$cadeaux_a_ajouter='';
$cart->remove($products[$i]['id']);
}
}
elseif ( !empty($palier['products_name']) && $palier['products_name'] <> 'call_function' ) {
$cadeau_string .= " <tr> <td width=\"4%\" height=\"15\">";
//echo 'p'.$palier_min[$i];
//echo 'total'.$total_cde.'<br>';
//echo 'nb'.$nb_prod_cde;//
//echo 'pa'.$palier_min[$i].'<br>';
if ( ($palier_min[$i] <= ($nb_prod_cde)) || ($palier_min[$i] <= $total_cde) ) {
if ($palier_min[$i] > ($nb_prod_cde)) {
if ((($palier_min[$i] <= $total_cde) && ($i >= 2)) ) {
if ($palier_min[$i] <> $i) {$cadeaux_a_ajouter.=$palier['products_id'].'-';} else { if (( $palier_min[$i] <= $nb_prod_cde )) { $cadeaux_a_ajouter.=$palier['products_id'].'-';}} } else {
if ((($palier_min[$i] <= $total_cde) && ($i == 1) && ($palier_min[$i]<> 2)) || (( $palier_min[$i] <= $nb_prod_cde ) && ($i == 1) )) {
$cadeaux_a_ajouter.=$palier['products_id'];}
}
} else {
$cadeaux_a_ajouter.=$palier['products_id'].'-'; }
$cadeau_string .= "<img src=\"".DIR_WS_IMAGES."coche.gif\" width=\"7\" height=\"7\">";
}
else
$cadeau_string .= "<img src=\"".DIR_WS_IMAGES."no-gris.gif\" width=\"7\" height=\"7\">";
$cadeau_string .= " </td><td width=\"90%\" class=";
if ( ($palier_min[$i] <= $nb_prod_cde) || ($palier_min[$i] <= $total_cde) )
$cadeau_string .= "texte-bleu";
else
$cadeau_string .= "textep";
$cadeau_string .= ">".TEXT_PALIER_CADEAU . $palier_min[$i];
($palier_flag[$i]==1)?$cadeau_string .= " articles.":$cadeau_string .= " €.";
$TEXT_PALIER_CADEAU2 = strtr($palier['products_name'],"'", " ");
$cadeau_string .= " " . $TEXT_PALIER_CADEAU2." - </td><td width=\"6%\"><a href=". tep_href_link(FILENAME_PRODUCT_INFO,'products_id='.$palier['products_id'],'SSL') ."><img src=\"".DIR_WS_IMAGES."/photo-bleu.gif\" width=\"13\" height=\"10\" border=\"0\"></a></td></tr>";
}
}
$cadeau_string .=tep_draw_form("express_cadeaux",tep_href_link("shopping_cart.php"),"get");
$cadeau_string .= tep_draw_hidden_field('osCsid',$_GET['osCsid'],' class="navinput" ');
$cadeau_string .= tep_draw_hidden_field('gv_redeem_code',$gv_redeem_code,' class="navinput" ');
$cadeau_string .= tep_draw_hidden_field('cadeaux_a_ajouter',$cadeaux_a_ajouter,' class="navinput" ');
$cadeau_string .= '</table>';
//$cadeau_string .= tep_draw_hidden_submit('cadeaux',$_GET['cPath'],' class="navinput" ')
}// fin du if bool !=0
}
}
?>
Je ne vois pas comment remédier a ce problème, si quelqu'un pouvait me donner un coup de pouce .....
Merci d'avance