View Single Post
  #1  
Old 05-20-2004, 02:49 PM
  B00MER's Avatar 
B00MER B00MER is offline
 

X-Guru
  
Join Date: Sep 2002
Location: Keller, TX (Cart-Lab.com)
Posts: 3,165
 

Default Shipping/Billing Names upon Register

Modded with: X-Cart 3.5.7

Always make a backup before applying any mod! Here is a quick file list: include/register.php, include/func.php, skin1/main/register_billing_address.tpl, skin1/main/register_shipping_address.tpl

1) X-Cart Admin Patch/Upgrade Apply this SQL patch:

Code:
ALTER TABLE `xcart_customers` ADD `b_firstname` VARCHAR( 128 ) NOT NULL , ADD `b_lastname` VARCHAR( 128 ) NOT NULL , ADD `s_firstname` VARCHAR( 128 ) NOT NULL , ADD `s_lastname` VARCHAR( 128 ) NOT NULL ;

This will add 4 new fields to the customers table.

2) Edit include/func.php and find the following in the func_userinfo() function defination:

Code:
$userinfo["b_title"] = $userinfo["s_title"] = $userinfo["title"]; $userinfo["b_firstname"] = $userinfo["s_firstname"] = $userinfo["firstname"]; $userinfo["b_lastname"] = $userinfo["s_lastname"] = $userinfo["lastname"];

Replace with:

Code:
$userinfo["b_title"] = $userinfo["s_title"] ? $userinfo["s_title"] : $userinfo["title"]; $userinfo["b_firstname"] = $userinfo["s_firstname"] ? $userinfo["s_firstname"] : $userinfo["firstname"]; $userinfo["b_lastname"] = $userinfo["s_lastname"] ? $userinfo["s_lastname"] : $userinfo["lastname"];

3) Edit skin1/main/register_billing_address.tpl find:

Code:
{if $action eq "cart"} <INPUT type=hidden name="action" value="cart"> <INPUT type=hidden name="paymentid" value="{$paymentid}">

Replace with:
Code:
{if $action eq "cart"} <INPUT type=hidden name="action" value="cart"> <INPUT type=hidden name="paymentid" value="{$paymentid}"> {/if}

Find the {/if} after the </tr> of the lastname area, and remove or comment it out {*/if*} You may also want to comment out the title field of the billing form as well.

4) Edit skin1/main/register_shipping_address.tpl:

And remove or comment out the {if $action eq "cart"} around the title, firstname and lastname fields so they show on all register forms. You may also want to remove or comment out the shipping title field.

5) Edit include/register.php and modify the update query:
Code:
db_query("UPDATE $sql_tbl[customers] SET password='$crypted', password_hint='$password_hint', password_hint_answer='$password_hint_answer', title='$title', firstname='$firstname', lastname='$lastname', company='$company', b_firstname='$b_firstname', b_lastname='$b_lastname', b_address='$b_address', b_city='$b_city', b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_firstname='$s_firstname', s_lastname='$s_lastname', s_address='$s_address', s_city='$s_city', s_state='$s_state', s_country='$s_country', s_zipcode='$s_zipcode', phone='$phone', email='$email', fax='$fax', url='$url', card_name='$card_name', card_type='$card_type', card_number='".text_crypt($card_number)."', card_expire='$card_expire', card_cvv2='$card_cvv2', pending_membership='$pending_membership', ssn='$ssn', change_password='$change_password' WHERE login='$login' and usertype='$login_type'");

To the above.

6) Also update the insert statement of new customers:

Code:
db_query("insert into $sql_tbl[customers] (login,usertype,membership,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_firstname,b_lastname,b_address,b_city,b_state,b_country,b_zipcode,s_firstname,s_lastname,s_address,s_city,s_state,s_country,s_zipcode,phone,email,fax,url,card_name,card_type,card_number,card_expire,card_cvv2,first_login,status,referer,pending_membership,ssn) values ('$uname','$usertype','".@$membership."','$crypted','".@$password_hint."','".@$password_hint_answer."','$title','$firstname','$lastname','$company','$b_firstname','$b_lastname','$b_address','$b_city','$b_state','$b_country','$b_zipcode','$s_firstname','$s_lastname','$s_address','$s_city','$s_state','$s_country','$s_zipcode','$phone','$email','$fax','$url','".@$card_name."','".@$card_type."','".text_crypt(@$card_number)."','".@$card_expire."','".@$card_cvv2."','".time()."','Y','".@$RefererCookie."','".@$pending_membership."','".@$ssn."')");

Note the b_firstname,b_lastname and s_firstname,s_lastname fields and variables.

This Should Do the trick, Ive done some moderate testing on this mod on a local copy so let me know if you find any snags.
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote