Jump to content

Center of download in website


NeedZoom

Recommended Posts

I try to develop this idea: Build a center of download in my  website. 
 
- The customer choose the product from a list 
- By clicking on the Booton 
- A download link will be displayed
 
I created a page dow.tpl, DowController php and dow.php
 
*) In the dow.tpl :
the liste with <select>
the booton with  
<input type="button" id="SubmitValider" name="SubmitValider"  value="Valider">

the action :

<form action="notice.php" method="post">

</form>

*) In the dow.php :

I connect the DowController and dow.tpl

 

*) In the DowController:

public function initContent()
  {
//code  when i clik the booton
IF  ($_POST['SubmitValider']==1){
        echo "hello";
      }
//but not working
}

I do not know if my reasoning is correct or not ...Thank you in advance for guiding me to solve this idea

 

 
Link to comment
Share on other sites

thanks Vekia, I found this link which helps me a little:

http://www.presta-dev.com/content/26-creation-d-un-formulaire-pour-validation-de-produits-troisieme-partie

I found this link which helps me a little to get the select variables.

But i dont any idea to sreach the file (PDF or exe) to downolad ? 

 

the dow.tpl:

{capture name=path}{l s='Recherche'}{/capture}
{include file="$tpl_dir./breadcrumb.tpl"}
<h1>{l s='Recherche'}</h1>
 <script type= "text/javascript" src = "listesouscategory.js"></script>
<!-- on créé le formulaire php , passage de paramètres par la méthode post-->
<form action="dow.php" method="post">
<p>   Bienvenue dans votre centre de t&eacutel&egravechargement, vous y trouverez ...  </p>
<!-- on déclare un champs select, pour affichier la liste de choix -->
<label>Choisir Driver/Notice : </label>
<select name="prix" >
<option value=""> ----- Choisir ----- </option>
<option value="1" {if $smarty.post.prix == "1"}selected = "selected"{/if}>Driver</option>
<option value="2"> Notice </option>
</select>
<label>Choisir Cat&eacutegories : </label>
<select onchange="print_sous('sous', this.selectedIndex);" {if $smarty.post.category}selected = "selected"{/if} id="category" name ="category"></select>
<!--
<select onchange="print_sous('sous', this.selectedIndex);" id="category" name ="category"></select>
<label>Choisir Sous Cat&eacutegories : </label>
<select name ="sous" id ="sous"{if $smarty.post.sous}selected = "selected"{/if} ></select>
<script language="javascript">print_category("category");</script>

<!-- un bouton pour valider  -->
<p><input type="submit" id="SubmitValider" name="SubmitValider" class="button_large" value="Valider"></p>
<p> </p>
</form>
{if $message}<p class="confirmation">{$message}</p>{/if}
{if $prix}<p class="confirmation">{$prix}</p>{/if}
{if $category}<p class="confirmation">{$category}</p>{/if}
{if $sous}<p class="confirmation">{$sous}</p>{/if}

the DowController :

<?php
class DowControllerCore extends FrontController
{
    public $php_self = 'dow';
	public function postProcess()
    {
		//On vérifie le bouton submit du formulaire
        if(Tools::isSubmit('SubmitValider'))
		{
		
		//On récupère les valeurs du formulaire
		$prix=Tools::getValue('prix');
		$category=Tools::getValue('category');
		$sous=Tools::getValue('sous');
		$message='Votre demande a bien été envoyée';
		}
	  	
	
	  if(isset($prix))self::$smarty->assign('prix',$prix);
	  if(isset($category))self::$smarty->assign('category',$category);
	  if(isset($sous))self::$smarty->assign('sous',$sous);
	  if(isset($message))self::$smarty->assign('message',$message);
	}


?>
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...