bss42 Posted May 5, 2012 Share Posted May 5, 2012 Hello, First sorry for my poor english ( i'm french) Here is my request : I wan't to add the contact customer list in my order form ( contact from the customer account ) so that when my customer order a product he had to choose a contact ( from a value list ) how can i retrieve the contact list in the viewcart.tpl ? i try to add a php file with include and assign the variable but this do not work : My php files : <?php $bdd = new PDO('mysql:host=localhost;dbname=portal', 'xxx', 'xxx'); $query = $bdd->prepare("SELECT * FROM tblcontacts where userid =".(int)$_SESSION['uid']); $query->execute(); $contacts = array(); $contacts[0]['firstname'] = " Choisissez votre client"; $i = 1; while($data = $query->fetch()){ $contacts[$i]['id'] = $data['id']; $contacts[$i]['firstname'] = $data['firstname']; $contacts[$i]['lastname'] = $data['lastname']; $contacts[$i]['companyname'] = $data['companyname']; $contacts[$i]['email'] = $data['email']; $i++; } $smartyvalues["contacts"] = $contacts; ?> and in my viewcart.tpl {foreach from=$contacts item=contact} <option value="{$contact.id}"{if $contact.id eq $contacid} selected="selected"{/if}>{$contact.companyname}-{$contact.firstname} {$contact.lastname}</option> {/foreach} But my list is empty just as the php files is not read, is there a way to pass variables from one template to another ( eg : contacts array from clientareacontacts.tpl to viewcart.tpl ) Thanks 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.