Auomaticaly add user

talkpoppycock

Avatar: talkpoppycock

2011-04-25 20:59

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 be grateful for ay help.

Thanks.

» Quick.Cart v4.x

talkpoppycock

Makaron

Avatar: Makaron

2011-04-26 16:02

So You want to add these users into Quick.Cart users database or You want to make some orders using this data?

I helped? Like it: www.facebook.com/makwebpl

talkpoppycock

Avatar: talkpoppycock

2011-04-29 18:08

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.

boboo

Avatar: boboo

2011-04-29 19:38

If you can easily get the user datas from login session, so put them into the input fields (in order_form.tpl) as values.

http://it-service.kimla.de QC- & QCMS-plugins

talkpoppycock

Avatar: talkpoppycock

2011-04-30 11:46

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

boboo

Avatar: boboo

2011-04-30 12:56

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.

http://it-service.kimla.de QC- & QCMS-plugins

talkpoppycock

Avatar: talkpoppycock

2011-05-07 20:27

Hi boboo,

Many thanks for your help. It works like a charm and looks very professional.

Back to top
about us | contact