Jump to content

Page Fonctionnelle En Local, Et Marche Pas Hebergé


Recommended Posts

Bonjour,

 

J'ai fait une page perso pour mon site :

http://www.vrooam-lubrifiants.fr/concours

 

Celle-ci est parfaitement fonctionnelle en local !! Mais en ligne (OVH), c'est comme ci la page PHP n'était pas traitée, il ne trouve aucune variable, et renvoie un paquet d'erreur.. Bref, vu qu'en local ca marche, je suis à l'arret.. Quelqu'un peut me donner un coup de main ?

 

concours.tpl dans theme/

<div align="center">
<h1>VROOAM your Week</h1>
<h2>A gagner cette semaine</h2>
<br><br>
<p><img src="{$base_dir}{$url_image}" alt="VROOAM your week" width="200"></p>
<h3>{$nom_produit}</h3>
<h4>Valeur marchande {($prix_produit*1.2)|string_format:"%.2f"} €</h4>
</div>
{if $logged}
<h1 class="page-heading"></h1>
<div align="center">
<h4>Jeu gratuit sans obligation d'achat</h4>
<p>Un simple click sur le bouton "Je participe" vous inscrit au tirage au sort de la semaine en cours<br>
Tirage au sort le lundi {$lundi} à 17h00	<br>
Une seule participation par personne par semaine</p>
<a href="{$base_dir}concoursInscription"><img src="././img/cms/bouton_participe.jpg" alt="Je Participe"></a>
</div>
{/if}
{if $logged!=1}
<h1 class="page-heading"></h1>
<div align="center">
<p>Pour pouvoir accéder à cette page, vous devez être connecté à notre site grâce à votre compte. C'est votre compte client qui nous permettra de vous faire les propositions de partenariat, 
envoyer les produits VROOAM gagnés lors du concours "VROOAM your week", n'oubliez donc pas d'enregistrer vos informations véritable (Mail, adresse postal, etc..)</p>
<p>Le jeu concours VROOAM Week c'est un produit VROOAM a gagner toutes les semaines.</p>
</div>
<h1 class="page-heading"></h1>
{include file="./authentication.tpl"}
{/if}

<script type="text/javascript">
  {literal}
    // Your JavaScript goes here
  {/literal}
</script>

ConcoursController.php dans theme/Controller/front

<?php

  class ConcoursController extends FrontController{
  
  /** string Internal controller name */
    public $php_self = 'concours';
    
    public function init()
    {
        parent::init();
     
    }
    
    public function initContent(){
      parent::initContent();
      $this->setTemplate(_PS_THEME_DIR_.'concours.tpl');
      
    global $smarty;
    //lien indentification
    $smarty->assign('path_connect', _PS_THEME_DIR_.'authentication.tpl');
    //Determination de la semaine en cours
    $weekNumber = (int)date("W"); 
    $monthNumber = date("j");
    $yearNumber = date("Y");
    $this->context->smarty->assign('week',$weekNumber);
    if ($weekNumber >= 52 && $monthNumber ==1) $yearNumber--;
    $this->context->smarty->assign('year',$yearNumber);
    $lundi=strtotime("next Monday");
    $lundi=date('d/m/Y', $lundi);
    $this->context->smarty->assign('lundi',$lundi);
    //determination du produit a gagner
    $id_product=Db::getInstance()->ExecuteS("select id_product from "._DB_PREFIX_."concours_setup where week = ".($weekNumber)." AND year = ".($yearNumber));
    $this->context->smarty->assign('id_product',$id_product);
    $id_image=Db::getInstance()->ExecuteS("select id_image from "._DB_PREFIX_."image where id_product = ".($id_product[0]['id_product'])." AND position = 1");
    $id_image = $id_image[0]['id_image'];
    $id_image_fixed = $id_image;
    $this->context->smarty->assign('id_image',$id_image);
    //photo du produit
    $url_image="img/p";
    for ($i=0;$i<=4;$i++){
    	$array_image[$i]=$id_image%10;
    	$id_image=$id_image-$array_image[$i];
    	if($id_image>9) $id_image/=10;
	}
	$start=0;
	 for ($i=4;$i>=0;$i--){
		if($array_image[$i]!=0) $start=1;
		if($start) $url_image.="/".$array_image[$i];
	}
	$url_image.="/".$id_image_fixed.".jpg";
	$this->context->smarty->assign('url_image',$url_image);
	//Nom du produit
	$nom_produit=Db::getInstance()->ExecuteS("select name from "._DB_PREFIX_."product_lang where id_product = ".($id_product[0]['id_product']));
	$nom_produit = $nom_produit[0]['name'];
	$this->context->smarty->assign('nom_produit',$nom_produit);
	//Prix produit
	$prix_produit=Db::getInstance()->ExecuteS("select price from "._DB_PREFIX_."product where id_product = ".($id_product[0]['id_product']));
	$prix_produit = $prix_produit[0]['price'];
	$this->context->smarty->assign('prix_produit',$prix_produit);
	}
 
  /*  The following code portion is optional.
  /*  Remove the double-slashes to activate the portion
  /*  if you want to use external stylesheet and JavaScript for the page.
  /*  Create the CSS and JS files in the css and js directories of the theme accordingly
   */
   
    public function setMedia(){
      parent::setMedia();
      //$this->addCSS(_THEME_CSS_DIR_.'eclate.css');
      //$this->addJS(_THEME_JS_DIR_.'custom-page.js');
    }
    
}

concours.php dans racine 

<?php
 
  include(dirname(__FILE__).'/config/config.inc.php');
  Tools::displayFileAsDeprecated();
 
  include(dirname(__FILE__).'/header.php');
 
  $smarty->display(_PS_THEME_DIR_.'concours.tpl');
 
  include(dirname(__FILE__).'/footer.php');
  
?>
Edited by RaWMotorsports (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...