Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need Help


shyam_nyaconcepts

Recommended Posts

Hii all, I have a problem in developing a customer login module other than traditional login.

When customer login, the greeting message on index page missing the customer first name...

 

greeting message displays from the following

 

Welcome back <span class="greetUser">%s!</span>

 

but when my customer login, the message prints (welcome back!) only.

%s representing customer first name is not displaying even the entries in database is same as of traditional login module, also after login , my account information is also empty...means data is not going there...... what's the problem here.....please help me!

 

Thanks in advance...

Link to comment
Share on other sites

the first name in the welcome message is filed from the database, after logging in, to a session parameter. maybe you have omitted that step? check out a default login.php page and you'll see how several session parameters are created right after a customers data is being pulled.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Honestly, without seeing your files and debugging it in the live system, I'm pretty sure I cannot offer any more help, if you really created all sessions as you should.

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

have you tried looking at catalog\includes\languages\english.php?

 

look for the line where TEXT_GREETING_PERSONAL is found..and please post your code I may be able to see where you gone wrong..

 

also try to post your login.php and create_account.php code..so you'll be able to get more help from masters here..

 

Cheers.. :)

-=PINOY AKO=-

Link to comment
Share on other sites

Thanks Monika and cj losaria, the greeting message is there in english.php file, I am showing my code here, This file serves for both login and create account. Please look at this and let me know the actual error why problem is there....I am writing the execute function of my login box module coding....

//starts here

global $oscTemplate,$cart,$navigation,$messageStack,$breadcrumb;

require_once('includes/application_top.php');

//$messageStack = new messageStack;

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

define('FILENAME_CREATE_ACCOUNT', 'create_account.php');

$language='english';

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CREATE_ACCOUNT);

$data = '<div class="ui-widget infoBoxContainer">' .

' <div class="ui-widget-header infoBoxHeading">' . MODULE_BOXES_LOGINRADIUS_BOX_TITLE . '</div>' .

' <div class="ui-widget-content infoBoxContents">' . "Please Login with"."<br>" .'<iframe src="https://hub.loginradius.com/Control/JoomlaSlider.aspx?apikey=dfd8cbde-e4b8-4ba6-9b81-9199ddf6421e" width="165" height="49" frameborder="0" scrolling="no" ></iframe> </div></div>';

$process = false;

include('LoginRadiusSDK.php');

$obj = new LoginRadius();

$userprofile = $obj->construct("2c19e91a-bed3-4e53-af10-e5b18ebe123e");

if($obj->IsAuthenticated==TRUE)

{

$process = true;

$ID=$userprofile->ID;

$Provider=$userprofile->Provider;

$Prefix=$userprofile->Prefix;

$FirstName=$userprofile->FirstName;

$LastName=$userprofile->LastName;

$Suffix=$userprofile->Suffix;

$FullName=$userprofile->FullName;

$NickName=$userprofile->NickName;

$ProfileName=$userprofile->ProfileName;

$BirthDate=$userprofile->BirthDate;

$Gender=$userprofile->Gender;

$EmailType=$userprofile->Email[0]->Type;

$EmailValue=$userprofile->Email[0]->Value;

$Country=$userprofile->Country;

$ImageUrl=$userprofile->ImageUrl;

$Favicon=$userprofile->Favicon;

$ProfileUrl=$userprofile->ProfileUrl;

$HomeTown=$userprofile->HomeTown;

$State=$userprofile->State;

$City=$userprofile->City;

$Industry=$userprofile->Industry;

$About=$userprofile->About;

$TimeZone=$userprofile->TimeZone;

$LocalLanguage=$userprofile->LocalLanguage;

$Verified=$userprofile->Verified;

$UpdatedTime=$userprofile->UpdatedTime;

 

 

//random password gemerator

function generatePassword ($length = 8)

{

$password = "";

$possible = "2346789bcdfghjkmnpqrtvwxyzBCDFGHJKLMNPQRTVWXYZ";

$maxlength = strlen($possible);

if ($length > $maxlength) {

$length = $maxlength;

}

 

$i = 0;

 

while ($i < $length) {

 

$char = substr($possible, mt_rand(0, $maxlength-1), 1);

if (!strstr($password, $char)) {

$password .= $char;

$i++;

}

}

 

return $password;

 

}

 

 

$password=generatePassword ($length = 8);

$PhoneNumbers=$userprofile->PhoneNumbers;

$IMAccounts=$userprofile->IMAccounts;

$Addresses=$userprofile->Addresses;

$MainAddress=$userprofile->MainAddress;

$Created=$userprofile->Created;

 

 

$process = true;

 

$gender = tep_db_prepare_input('m');

$firstname = tep_db_prepare_input($FirstName);

$lastname = tep_db_prepare_input($LastName);

$dob = tep_db_prepare_input('04/05/1998');

$email_address = tep_db_prepare_input($EmailValue);

$company = tep_db_prepare_input('Nyaconcepts');

$street_address = tep_db_prepare_input('12 JLN Marg');

$suburb = tep_db_prepare_input('12');

$postcode = tep_db_prepare_input('302030');

$city = tep_db_prepare_input('jaipur');

$state = tep_db_prepare_input('Rajasthan');

$zone_id = tep_db_prepare_input('20');

 

 

$country = tep_db_prepare_input('india');

$telephone = tep_db_prepare_input('9986512345');

$fax = tep_db_prepare_input('1235445');

 

$newsletter = tep_db_prepare_input('0');

$password = tep_db_prepare_input($password);

$confirmation = tep_db_prepare_input($password);

 

$error = false;

$gender=$Gender;

 

//checking for condition

$check_email_query = tep_db_query("select count(*) as total from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

$check_email = tep_db_fetch_array($check_email_query);

if ($check_email['total'] > 0) {

//code of login

 

// redirect the customer to a friendly cookie-must-be-enabled page if cookies are disabled (or the session has not started)

define('FILENAME_COOKIE_USAGE', 'cookie_usage.php');

define('FILENAME_LOGIN', 'login.php');

define('FILENAME_ACCOUNT', 'account.php');

define('FILENAME_ACCOUNT_EDIT', 'account_edit.php');

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT);

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT_EDIT);

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_LOGIN);

// Check if email exists

$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");

 

$check_customer = tep_db_fetch_array($check_customer_query);

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

 

$check_country_query = tep_db_query("select entry_country_id, entry_zone_id from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$check_customer['customers_id'] . "' and address_book_id = '" . (int)$check_customer['customers_default_address_id'] . "'");

$check_country = tep_db_fetch_array($check_country_query);

 

$customer_id = $check_customer['customers_id'];

$customer_default_address_id = $check_customer['customers_default_address_id'];

$customer_first_name = $check_customer['customers_firstname'];

$customer_country_id = $check_country['entry_country_id'];

$customer_zone_id = $check_country['entry_zone_id'];

tep_session_register('customer_id');

tep_session_register('customer_default_address_id');

tep_session_register('customer_first_name');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

 

tep_db_query("update " . TABLE_CUSTOMERS_INFO . " set customers_info_date_of_last_logon = now(), customers_info_number_of_logons = customers_info_number_of_logons+1 where customers_info_id = '" . (int)$customer_id . "'");

 

// reset session token

$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());

 

// restore cart contents

$cart->restore_contents();

 

 

 

if (sizeof($navigation->snapshot) > 0) {

$origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);

$navigation->clear_snapshot();

tep_redirect($origin_href);

} else {

define('FILENAME_DEFAULT', 'index.php');

tep_redirect(tep_href_link(FILENAME_DEFAULT));

}

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_LOGIN, '', 'SSL'));

?>

<h1><?php echo HEADING_TITLE; ?></h1>

 

<?php

if ($messageStack->size('login') > 0) {

echo $messageStack->output('login');

}

 

}

 

else

{

$sql_data_array = array('customers_firstname' => $firstname,

'customers_lastname' => $lastname,

'customers_email_address' => $email_address,

'customers_telephone' => $telephone,

'customers_fax' => $fax,

'customers_newsletter' => $newsletter,

'customers_password' => tep_encrypt_password($password));

 

$sql_data_array['customers_gender'] = $gender;

$sql_data_array['customers_dob'] = tep_date_raw($dob);

 

tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

 

$customer_id = tep_db_insert_id();

 

$sql_data_array = array('customers_id' => $customer_id,

'entry_firstname' => $firstname,

'entry_lastname' => $lastname,

'entry_street_address' => $street_address,

'entry_postcode' => $postcode,

'entry_city' => $city,

'entry_country_id' => $country);

 

$sql_data_array['entry_gender'] = $gender;

$sql_data_array['entry_company'] = $company;

$sql_data_array['entry_suburb'] = $suburb;

 

if ($zone_id > 0) {

$sql_data_array['entry_zone_id'] = $zone_id;

$sql_data_array['entry_state'] = '';

} else {

$sql_data_array['entry_zone_id'] = '0';

$sql_data_array['entry_state'] = $state;

}

 

 

tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array);

 

$address_id = tep_db_insert_id();

 

tep_db_query("update " . TABLE_CUSTOMERS . " set customers_default_address_id = '" . (int)$address_id . "' where customers_id = '" . (int)$customer_id . "'");

 

tep_db_query("insert into " . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . (int)$customer_id . "', '0', now())");

 

if (SESSION_RECREATE == 'True') {

tep_session_recreate();

}

 

$customer_first_name = $firstname;

$customer_default_address_id = $address_id;

$customer_country_id = $country;

$customer_zone_id = $zone_id;

tep_session_register('customer_id');

tep_session_register('customer_first_name');

tep_session_register('customer_default_address_id');

tep_session_register('customer_country_id');

tep_session_register('customer_zone_id');

 

// reset session token

$sessiontoken = md5(tep_rand() . tep_rand() . tep_rand() . tep_rand());

 

// restore cart contents

$cart->restore_contents();

 

// build the message content

$name = $firstname . ' ' . $lastname;

 

if ($gender == 'm') {

$email_text = sprintf(EMAIL_GREET_MR, $lastname);

} else {

$email_text = sprintf(EMAIL_GREET_MS, $lastname);

}

 

$email_text .= EMAIL_WELCOME . EMAIL_TEXT . EMAIL_CONTACT . EMAIL_WARNING;

tep_mail($name, $email_address, EMAIL_SUBJECT, $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);

define('FILENAME_CREATE_ACCOUNT_SUCCESS', 'create_account_success.php');

 

tep_redirect(tep_href_link(FILENAME_CREATE_ACCOUNT_SUCCESS, '', 'SSL'));

}

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL'));

?> <h1><?php echo HEADING_TITLE; ?></h1>

 

<?php

if ($messageStack->size('create_account') > 0) {

echo $messageStack->output('create_account');

}

?>

 

<p><?php echo sprintf(TEXT_ORIGIN_LOGIN, tep_href_link(FILENAME_LOGIN, tep_get_all_get_params(), 'SSL')); ?></p>

 

<?php }

 

 

$oscTemplate->addBlock($data, $this->group);

 

} // function executes ends

Please find out the error...

Link to comment
Share on other sites

why don't you just do a print_r($_SESSION); to see if your session gets filled correctly? if yes, then the call you make to it in your language file is incorrect ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Thanks for reply, I printed $_SESSION.. the variables like customer_id,customer_firstname,..etc are empty, means value is not showing. Can this work perfectly as an alternative.....

$_SESSION['customer_id']=$customer_id; Now using this, I am finding username in welcome message .. but tell me this is the right way to do or not..

 

Thanks

Link to comment
Share on other sites

well, that may work, but it worries me. many session paramters are created just the same way as the customers first name and id etc etc in osC. if this did not work, how would the cart, checkout etc work?

 

I was pretty sure that your session variables would be empty on a print_r ...

 

I think you need to find out what goes wrong when storing the session. is yours set to mysql in confgure.php?

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Thanks Monika for constantly guiding me.... all is working good in demo like order , cart content entry in tables but only one problem is there... when I add content to cart , that time cart content()showed correctly, but after logout and on again login, shopping cart is empty displayed. order made by me is shown but cart is empty....

Thanks ..

Link to comment
Share on other sites

well, different session handling may work diifferently. unfortunately, we have expired the long-distance help I can offer ... I know from several projects where I completely reworked osC to handle sessions differently (in some cases via cookies), that it takes tons of testing, debugging and rewriting whenever one of the areas does not work (often almost evrything DOES work just one area not, I know, that sucks) ...

:-)

Monika

 

addicted to writing code ... can't get enough of databases either, LOL!

 

my toolbox: Textpad - Compare and Merge - phpMyAdmin - WS_FTP - Photoshop - How to search the forum

 

Interactive Media Award July 2007 ~ category E-Commerce

my advice on the forum is for free, PMs where you send me work are considered consultation which I charge for ...

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...