NeedZoom Posted January 29, 2014 Share Posted January 29, 2014 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 More sharing options...
vekia Posted January 29, 2014 Share Posted January 29, 2014 so, where you've got problem? can you shed some more light please? you cant open controller? problems with button? or what? Link to comment Share on other sites More sharing options...
NeedZoom Posted January 29, 2014 Author Share Posted January 29, 2014 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élèchargement, 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égories : </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égories : </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 More sharing options...
vekia Posted January 29, 2014 Share Posted January 29, 2014 what ps version you use? this example is based on 1.4 it's not fully compatibile with 1.5 releases. Link to comment Share on other sites More sharing options...
NeedZoom Posted January 29, 2014 Author Share Posted January 29, 2014 (edited) For the link, I inspired this code to retrieve the variables .. He work nice in my case. Now how find the file ( pdf or exe ) tha the customer donwlod it ,after choosing 1)driver or notice 2)what categories 3)what subcategories Edited January 29, 2014 by NeedZoom (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now