Hi, I am adding Quick Cart to an existing members system. I can easily get the user name and email from a mysql database by using the login session info with php. Can anyone tell me how I can get this into the order form automatically?
I would like the user data, (first name, last name and email) to appear in the the user infomation fields on the order page. The user data would then be saved with the order. There is no need to add it to the database unless Quick Cart needs to do this.
The way I have implimented QuickCart, the user has to be logged into my user system to get to QuickCart.
That is exatly what I want to do, however the only way I can do this is with php something like this
<?php define ("DB_HOST", "localhost"); // set database host define ("DB_USER", "user_name"); // set database user define ("DB_PASS","password"); // set database password define ("DB_NAME","mydb"); // set database name
$con = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection."); mysql_select_db("DB_NAME", $con); $result = mysql_query("SELECT * FROM members WHERE id='$_SESSION[user_id]'"); $row = mysql_fetch_assoc($result) or die("No rows returned by query"); $aUser[sFirstName] = ($row ['first_name']); $aUser[sLastName] = ($row ['last_name']); $aUser[sEmail] = ($row ['email']); ?>
The problem is that I am unable to use php in order_form.tpl
look at the p_orders.php in /actions_client/ there are lines with: $oTpl->unsetVariables(); $sOrder=$oTpl->tbHtml('orders_form.tpl','ORDER_FORM'); if you put your code a bit over this lines, the needed variables will be taken over to the template. i just tried to write there: $aUser['sFirstName']='kalosz'; and hohoho, after click 'go to order page' kalosz was in the Firstname field.