X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   2 Address Lines (https://forum.x-cart.com/showthread.php?t=4168)

bbf 08-28-2003 11:06 AM

2 Address Lines
 
We need a second "Address" line in the "Bill To" and "Ship To" info.

I don't understand why this isn't currently in X-cart when the vast majority of etailers provide this second line. Some people have complex addresses and a second line is required.

rodneyw 08-28-2003 12:21 PM

yea, I agree. Thought this would be an easy fix so I got started and now ... well I have questions.

My questions revolve around the order it self. Where does the mail templates get the inf to populate the order_invoice?
I.E.
Code:

{$lng.lbl_billing_address}:
----------------
  {$lng.lbl_address}:    {$order.b_address}
  {$lng.lbl_address}:    {$order.b_address2}
  {$lng.lbl_city}:      {$order.b_city}
  {$lng.lbl_state}:      {$order.b_statename}
  {$lng.lbl_country}:    {$order.b_countryname}
  {$lng.lbl_zip_code}:  {$order.b_zipcode}


I think I have a fix as soon as I figure this out .. unless it has already been posted before :)

shan 08-28-2003 05:17 PM

check register.tpl

you could re use an un needed field

rodneyw 08-29-2003 04:19 AM

whew .. what a mess. I hope I have all this right. Use at your own risk and if you try it make sure you BACK EVERYTHING UP!!

My ONLY concern is that I missed a tpl file somewhere that needs to display the new address lines. Here is what I have done if anyone wants to give it a try. If you see ANYTHING wrong please let me know.

```````````````````````````````````````

Using phpMyAdmin you will need to modify your CUSTOMER table in the database.
Insert new field AFTER b_address with the name b_address2
Insert new field AFTER s_address with the name s_address2

Using phpMyAdmin you will need to modify your ORDERS table in the database.
Insert new field AFTER b_address with the name b_address2
Insert new field AFTER s_address with the name s_address2



PHP FILE: include/register.php

REPLACE
Code:

#
# Update/Insert user info
#

if ($mode=="update") {
        $intershipper_recalc = "Y";

        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_address='$b_address', b_city='$b_city', b_state='$b_state',

b_country='$b_country', b_zipcode='$b_zipcode', 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' where login='$login' and usertype='$login_type'");


WITH
Code:

#
# Update/Insert user info
#

if ($mode=="update") {
        $intershipper_recalc = "Y";

        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_address='$b_address',b_address2='$b_address2', b_city='$b_city',

b_state='$b_state', b_country='$b_country', b_zipcode='$b_zipcode', s_address='$s_address', s_address2='$s_address2', 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' where

login='$login' and usertype='$login_type'");




REPLACE
Code:

#
# Add new person to customers table
#
        $intershipper_recalc = "Y";

        db_query("insert into $sql_tbl[customers]

(login,usertype,membership,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_address,b_city,b_state,b_country,b_zipcode,s_addres

s,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_address','$b_city','

$b_state','$b_country','$b_zipcode','$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')");



WITH
Code:

#
# Add new person to customers table
#
        $intershipper_recalc = "Y";

        db_query("insert into $sql_tbl[customers]

(login,usertype,membership,password,password_hint,password_hint_answer,title,firstname,lastname,company,b_address,b_address2,b_city,b_state,b_country,b_zipco

de,s_address,s_address2,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,refer

er,pending_membership,ssn) values

('$uname','$usertype','$membership','$crypted','$password_hint','$password_hint_answer','$title','$firstname','$lastname','$company','$b_address','$b_address

2','$b_city','$b_state','$b_country','$b_zipcode','$s_address','$s_address2','$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')");




REPLACE
Code:

if ($uerror || $eerror || $fillerror || $error) {
        $userinfo[firstname]=stripslashes($firstname);
        $userinfo[lastname]=stripslashes($lastname);
        $userinfo[company]=stripslashes($company);
        $userinfo[ssn]=stripslashes($ssn);
        $userinfo[b_address]=stripslashes($b_address);
        $userinfo[b_city]=stripslashes($b_city);
        $userinfo[b_state]=stripslashes($b_state);
        $userinfo[b_zipcode]=stripslashes($b_zipcode);
        $userinfo[s_address]=stripslashes($s_address);
        $userinfo[s_city]=stripslashes($s_city);
        $userinfo[s_state]=stripslashes($s_state);
        $userinfo[s_zipcode]=stripslashes($s_zipcode);
        $userinfo[phone]=stripslashes($phone);
        $userinfo[fax]=stripslashes($fax);
        $userinfo[uname]=stripslashes($uname);
        $userinfo[login]=stripslashes($uname);
        $userinfo[passwd1]=stripslashes($passwd1);
        $userinfo[passwd2]=stripslashes($passwd2);
        $userinfo[password_hint]=stripslashes($password_hint);
        $userinfo[password_hint_answer]=stripslashes($password_hint_answer);



WITH
Code:

if ($uerror || $eerror || $fillerror || $error) {
        $userinfo[firstname]=stripslashes($firstname);
        $userinfo[lastname]=stripslashes($lastname);
        $userinfo[company]=stripslashes($company);
        $userinfo[ssn]=stripslashes($ssn);
        $userinfo[b_address]=stripslashes($b_address);
        $userinfo[b_address2]=stripslashes($b_address2);
        $userinfo[b_city]=stripslashes($b_city);
        $userinfo[b_state]=stripslashes($b_state);
        $userinfo[b_zipcode]=stripslashes($b_zipcode);
        $userinfo[s_address]=stripslashes($s_address);
        $userinfo[s_address2]=stripslashes($s_address2);
        $userinfo[s_city]=stripslashes($s_city);
        $userinfo[s_state]=stripslashes($s_state);
        $userinfo[s_zipcode]=stripslashes($s_zipcode);
        $userinfo[phone]=stripslashes($phone);
        $userinfo[fax]=stripslashes($fax);
        $userinfo[uname]=stripslashes($uname);
        $userinfo[login]=stripslashes($uname);
        $userinfo[passwd1]=stripslashes($passwd1);
        $userinfo[passwd2]=stripslashes($passwd2);
        $userinfo[password_hint]=stripslashes($password_hint);
        $userinfo[password_hint_answer]=stripslashes($password_hint_answer);




PHP FILE: include/func.php

REPLACE
Code:

Insert into orders
#
        db_query("insert into $sql_tbl[orders] (login, total, giftcert_discount, giftcert_ids, subtotal, shipping_cost, shippingid, tax, tax_gst, tax_pst,

total_vat, taxes_applyed, discount, coupon, coupon_discount, date, status, payment_method, flag, details, title, firstname, lastname, company, b_address,

b_city, b_state, b_country, b_zipcode, s_address, s_city, s_state, s_country, s_zipcode, phone, fax, email, url, reg_numbers) values

('".addslashes($userinfo["login"])."', '$current_order[total_cost]', '$giftcert_discount', '$giftcert_str',

'$current_order[sub_total]','$current_order[shipping_cost]', '$cart[shippingid]', '$current_order[tax_cost]', '$current_order[tax_gst]',

'$current_order[tax_pst]', '$current_order[total_vat]', '$taxes_applyed', '$current_order[discount]', '".addslashes($current_order[coupon])."',

'$current_order[coupon_discount]', '".time()."', '$order_status', '".addslashes($payment_method)."', 'N', '".addslashes(text_crypt($order_details))."',

'".addslashes($userinfo["title"])."', '".addslashes($userinfo["firstname"])."', '".addslashes($userinfo["lastname"])."',

'".addslashes($userinfo["company"])."', '".addslashes($userinfo["b_address"])."', '".addslashes($userinfo["b_city"])."',

'".addslashes($userinfo["b_state"])."', '".addslashes($userinfo["b_country"])."', '".addslashes($userinfo["b_zipcode"])."',

'".addslashes($userinfo["s_address"])."', '".addslashes($userinfo["s_city"])."', '".addslashes($userinfo["s_state"])."',

'".addslashes($userinfo["s_country"])."', '".addslashes($userinfo["s_zipcode"])."', '".addslashes($userinfo["phone"])."', '".addslashes($userinfo["fax"])."',

'$userinfo[email]', '".addslashes($userinfo["url"])."', '$reg_numbers')");


WITH
Code:

Insert into orders
#
        db_query("insert into $sql_tbl[orders] (login, total, giftcert_discount, giftcert_ids, subtotal, shipping_cost, shippingid, tax, tax_gst, tax_pst,

total_vat, taxes_applyed, discount, coupon, coupon_discount, date, status, payment_method, flag, details, title, firstname, lastname, company, b_address,

b_address2, b_city, b_state, b_country, b_zipcode, s_address, s_address2, s_city, s_state, s_country, s_zipcode, phone, fax, email, url, reg_numbers) values

('".addslashes($userinfo["login"])."', '$current_order[total_cost]', '$giftcert_discount', '$giftcert_str',

'$current_order[sub_total]','$current_order[shipping_cost]', '$cart[shippingid]', '$current_order[tax_cost]', '$current_order[tax_gst]',

'$current_order[tax_pst]', '$current_order[total_vat]', '$taxes_applyed', '$current_order[discount]', '".addslashes($current_order[coupon])."',

'$current_order[coupon_discount]', '".time()."', '$order_status', '".addslashes($payment_method)."', 'N', '".addslashes(text_crypt($order_details))."',

'".addslashes($userinfo["title"])."', '".addslashes($userinfo["firstname"])."', '".addslashes($userinfo["lastname"])."',

'".addslashes($userinfo["company"])."', '".addslashes($userinfo["b_address"])."', '".addslashes($userinfo["b_address2"])."',

'".addslashes($userinfo["b_city"])."', '".addslashes($userinfo["b_state"])."', '".addslashes($userinfo["b_country"])."',

'".addslashes($userinfo["b_zipcode"])."', '".addslashes($userinfo["s_address"])."', '".addslashes($userinfo["s_address2"])."',

'".addslashes($userinfo["s_city"])."', '".addslashes($userinfo["s_state"])."', '".addslashes($userinfo["s_country"])."',

'".addslashes($userinfo["s_zipcode"])."', '".addslashes($userinfo["phone"])."', '".addslashes($userinfo["fax"])."', '$userinfo[email]',

'".addslashes($userinfo["url"])."', '$reg_numbers')");





TEMPLATE FILE: skin1/main/register.tpl

Add these lines after the first shipping address blocvk of code for BOTH Billing and Shipping

BILLING ADDRESS 2:
Code:

<tr valign=middle>
<td align=right>{$lng.lbl_address} 2</td>
<td></td>
<td nowrap>
<input type=text name=b_address2 size=32 maxlength=64 value="{$userinfo.b_address2}">
</td>
</tr>


SHIPPING ADDRESS 2:
Code:

<tr valign=middle>
<td align=right>{$lng.lbl_address} 2</td>
<td></td>
<td nowrap>
<input type=text name=s_address2 size=32 maxlength=64 value="{$userinfo.s_address2}">
</td>
</tr>


TEMPLATE FILES:
The following tpl file will need to be modified to include and display the new address lines
skin/mail/
-->order_invoice.tpl USE:: {$order.s_address2} {$order.b_address2}
-->order_notification_admin.tpl USE:: {$order.s_address2} {$order.b_address2}
-->order_notification.tpl USE:: {$order.s_address2} {$order.b_address2}

skin/provider/
-->order_printable.tpl USE:: {$customer.s_address2} {$customer.b_address2}

skin/main/
-->order_invoice.tpl USE:: {$order.s_address2} {$order.b_address2}
-->order_label_print.tpl USE:: {$customer.s_address2} {$customer.b_address2}
-->history_order.tpl USE:: {$customer.s_address2} {$customer.b_address2}

shan 08-29-2003 06:04 AM

moved to custom templates

bbf 08-29-2003 07:54 AM

Rodney, thanks for the legwork! :)

Hopefully the Xcart people notice this and add it to their next version.

funkydunk 08-29-2003 08:53 AM

great work :)

Really nice of you to fully document it.

Done it many times, but keep forgetting to totally write it down :lol:

rodneyw 08-29-2003 09:02 AM

thank you!!

I'm usually not that organized but I will have to do this to several sites now and didn't want to have to remember each time ... my memory is not what it use to be :)

ron33 09-18-2003 09:02 PM

There has to be happen a similar thing with gift certificate recipient addresses too.
- If you use this module and prefer to have 2 address lines there as well.

All the following refers to version x-cart-3.4.7gold.

Quote:

Table xcart_giftcerts has to be amended by a field recipient_address2 after recipient_address.


Then the following changes to the code:

admin/giftcerts.php

change:
Quote:

#
# Send via Postal Mail
#
$fill_error = ($fill_error || empty($recipient_firstname) || empty($recipient_lastname) || empty($recipient_address) ||

empty($recipient_city) || empty($recipient_zipcode) || empty($recipient_state) || empty($recipient_country));

$giftcert = array ("purchaser" => stripslashes($purchaser),
"recipient" => stripslashes($recipient),
"message" => stripslashes($message),
"amount" => $amount,
"send_via" => $send_via,
"recipient_firstname" => stripslashes($recipient_firstname),
"recipient_lastname" => stripslashes($recipient_lastname),
"recipient_address" => stripslashes($recipient_address),
"recipient_city" => stripslashes($recipient_city),
"recipient_zipcode" => $recipient_zipcode,
"recipient_state" => $recipient_state,
"recipient_country" => $recipient_country,
"recipient_phone" => $recipient_phone);
}


to
Quote:

#
# Send via Postal Mail
#
$fill_error = ($fill_error || empty($recipient_firstname) || empty($recipient_lastname) || empty($recipient_address) ||

empty($recipient_city) || empty($recipient_zipcode) || empty($recipient_state) || empty($recipient_country));

$giftcert = array ("purchaser" => stripslashes($purchaser),
"recipient" => stripslashes($recipient),
"message" => stripslashes($message),
"amount" => $amount,
"send_via" => $send_via,
"recipient_firstname" => stripslashes($recipient_firstname),
"recipient_lastname" => stripslashes($recipient_lastname),
"recipient_address" => stripslashes($recipient_address),
"recipient_address2" => stripslashes($recipient_address2),
"recipient_city" => stripslashes($recipient_city),
"recipient_zipcode" => $recipient_zipcode,
"recipient_state" => $recipient_state,
"recipient_country" => $recipient_country,
"recipient_phone" => $recipient_phone);
}


change in:
Quote:

#
# If gcindex is empty - add
# overwise - update
#
.
.
db_query("insert into $sql_tbl[giftcerts] (gcid, orderid, purchaser, recipient, send_via, recipient_email, recipient_firstname, recipient_lastname,

recipient_address, recipient_city, recipient_state, recipient_country, recipient_zipcode, recipient_phone, message, amount, debit, status, add_date) values

('$gcid',

'0','".addslashes($giftcert[purchaser])."','".addslashes($giftcert[recipient])."','$giftcert[send_via]','$giftcert[recipient_email]','".addslashes($giftcert

[recipient_firstname])."','".addslashes($giftcert[recipient_lastname])."','".addslashes($giftcert[recipient_address])."','".addslashes($giftcert[recipient_c

ity])."','$giftcert[recipient_state]','$giftcert[recipient_country]','$giftcert[recipient_zipcode]','$giftcert[recipient_phone]','".addslashes($giftcert[mes

sage])."','$giftcert[amount]','$giftcert[amount]','P','".time()."')");


to:
Quote:

db_query("insert into $sql_tbl[giftcerts] (gcid, orderid, purchaser, recipient, send_via, recipient_email, recipient_firstname, recipient_lastname,

recipient_address, recipient_address2, recipient_city, recipient_state, recipient_country, recipient_zipcode, recipient_phone, message, amount, debit,

status, add_date) values ('$gcid',

'0','".addslashes($giftcert[purchaser])."','".addslashes($giftcert[recipient])."','$giftcert[send_via]','$giftcert[recipient_email]','".addslashes($giftcert

[recipient_firstname])."','".addslashes($giftcert[recipient_lastname])."','".addslashes($giftcert[recipient_address])."','".addslashes($giftcert[recipient_a

ddress2])."','".addslashes($giftcert[recipient_city])."','$giftcert[recipient_state]','$giftcert[recipient_country]','$giftcert[recipient_zipcode]','$giftce

rt[recipient_phone]','".addslashes($giftcert[message])."','$giftcert[amount]','$giftcert[amount]','P','".time()."')");





in customer/giftcert.php:

change:
Quote:

#
# Send via Postal Mail
#
$fill_error = ($fill_error || empty($recipient_firstname) || empty($recipient_lastname) || empty($recipient_address) || empty($recipient_city) ||

empty($recipient_zipcode) || empty($recipient_state) || empty($recipient_country));

$giftcert = array ("purchaser" => stripslashes($purchaser),
"recipient" => stripslashes($recipient),
"message" => stripslashes($message),
"amount" => $amount,
"send_via" => $send_via,
"recipient_firstname" => stripslashes($recipient_firstname),
"recipient_lastname" => stripslashes($recipient_lastname),
"recipient_address" => stripslashes($recipient_address),
"recipient_city" => stripslashes($recipient_city),
"recipient_zipcode" => $recipient_zipcode,
"recipient_state" => $recipient_state,
"recipient_country" => $recipient_country,
"recipient_phone" => $recipient_phone);
}


to:
Quote:

#
# Send via Postal Mail
#
$fill_error = ($fill_error || empty($recipient_firstname) || empty($recipient_lastname) || empty($recipient_address) || empty($recipient_city) ||

empty($recipient_zipcode) || empty($recipient_state) || empty($recipient_country));

$giftcert = array ("purchaser" => stripslashes($purchaser),
"recipient" => stripslashes($recipient),
"message" => stripslashes($message),
"amount" => $amount,
"send_via" => $send_via,
"recipient_firstname" => stripslashes($recipient_firstname),
"recipient_lastname" => stripslashes($recipient_lastname),
"recipient_address" => stripslashes($recipient_address),
"recipient_address2" => stripslashes($recipient_address2),
"recipient_city" => stripslashes($recipient_city),
"recipient_zipcode" => $recipient_zipcode,
"recipient_state" => $recipient_state,
"recipient_country" => $recipient_country,
"recipient_phone" => $recipient_phone);
}



in include/func.php:

change:
Quote:

#
# status == Pending!
#
db_query("insert into $sql_tbl[giftcerts] (gcid, orderid, purchaser, recipient, send_via, recipient_email,

recipient_firstname, recipient_lastname, recipient_address, recipient_city, recipient_state, recipient_country, recipient_zipcode, recipient_phone, message,

amount, debit, status, add_date) values ('$gcid',

'$orderid','".addslashes($giftcert[purchaser])."','".addslashes($giftcert[recipient])."','$giftcert[send_via]','$giftcert[recipient_email]','".addslashes($g

iftcert[recipient_firstname])."','".addslashes($giftcert[recipient_lastname])."','".addslashes($giftcert[recipient_address])."','".addslashes($giftcert[reci

pient_city])."','$giftcert[recipient_state]','$giftcert[recipient_country]','$giftcert[recipient_zipcode]','$giftcert[recipient_phone]','".addslashes($giftc

ert[message])."','$giftcert[amount]','$giftcert[amount]','P','".time()."')");


to:
Quote:

#
# status == Pending!
#
db_query("insert into $sql_tbl[giftcerts] (gcid, orderid, purchaser, recipient, send_via, recipient_email,

recipient_firstname, recipient_lastname, recipient_address, recipient_address2, recipient_city, recipient_state, recipient_country, recipient_zipcode,

recipient_phone, message, amount, debit, status, add_date) values ('$gcid',

'$orderid','".addslashes($giftcert[purchaser])."','".addslashes($giftcert[recipient])."','$giftcert[send_via]','$giftcert[recipient_email]','".addslashes($g

iftcert[recipient_firstname])."','".addslashes($giftcert[recipient_lastname])."','".addslashes($giftcert[recipient_address])."','".addslashes($giftcert[reci

pient_address2])."','".addslashes($giftcert[recipient_city])."','$giftcert[recipient_state]','$giftcert[recipient_country]','$giftcert[recipient_zipcode]','

$giftcert[recipient_phone]','".addslashes($giftcert[message])."','$giftcert[amount]','$giftcert[amount]','P','".time()."')");


In skin1/modules/Gift_Certificates/giftcert.tpl:
shortly after the statement group around line 231 about the address line add the following:
Quote:

<tr>
<td nowrap align=right>{$lng.lbl_address}</td>
<td> </font></td>
<td align=left><input type=text name=recipient_address size=40 value="{$giftcert.recipient_address2}"></td>
</tr>


In skin1/modules/Gift_Certificates/giftcert_static.tpl:
shortly after the statement group around line 90 about the address line add the following:
Quote:

<tr>
<td nowrap align=right>{$lng.lbl_address}:</td>
<td></td>
<td align=left>
{$giftcert.recipient_address2|escape:"htmlall"}
</td>
</tr>


In skin1/main/history_order.tpl:
around line 90 change:
Quote:

<tr>
<td valign="top" class="LabelStyle">{$lng.lbl_mail_address}</td>
<td valign="top">
{$giftcerts[giftcert].recipient_firstname} {$giftcerts[giftcert].recipient_lastname}

{$giftcerts[giftcert].recipient_address}, {$giftcerts[giftcert].recipient_city},

{$giftcerts[giftcert].recipient_state} {$giftcerts[giftcert].recipient_country}, {$giftcerts[giftcert].recipient_zipcode}
</td>
</tr>


to:
Quote:

<tr>
<td valign="top" class="LabelStyle">{$lng.lbl_mail_address}</td>
<td valign="top">
{$giftcerts[giftcert].recipient_firstname} {$giftcerts[giftcert].recipient_lastname}

{$giftcerts[giftcert].recipient_address}, {$giftcerts[giftcert].recipient_address2},

{$giftcerts[giftcert].recipient_city},

{$giftcerts[giftcert].recipient_state} {$giftcerts[giftcert].recipient_country}, {$giftcerts[giftcert].recipient_zipcode}
</td>
</tr>


I hope I did not oversee something.

BoomBoomBap 11-28-2003 09:08 PM

After a bit of work I got this functioning properly in 3.4.10. It should be noted that the additions need to be made to several more .tpl files. Namely those files that call out the shipping address in email notifications.

Essentially, the mod is thus;

Add the two columns into the database and then add b_address2 and s_address2 throughout the site.

Not a quick task but a good extended search tool will help you find s_address and b_address throughout your code. From there you just copy and add the '2' for address line 2.

Thanks much for your work on this and for your detailed explanation rodenyw!
:D

leon 12-04-2003 08:19 PM

If you are using Windows the best search tool is SEARCH, but instead of making a search for a file, you make a search for a string inside a directory, that way it searches internally inside each file and tells you where the string is.

Well, at least with Windows 2000.

xcell67 03-31-2004 04:10 PM

Hi,

I LOVE this mod, BUT I've just noticed that it has a minor flaw.

In include/register.php, there is some coding that looks like this:

if (empty($s_address)) $s_address = $b_address;

This will automatically fill in address line 1 for the shipping section with the information from address line from the billing section if the customer leaves the shipping section empty.

This code is done for most of the shiping section like city, zip code, state, etc.

But here comes the problem, if you want to do this automatically filling for your newly created s_address2 from this mod, itll look like this:

if (empty($s_address2)) $s_address2 = $b_address2;

The problem is say the customer filled in:

Billing section
Address: 2904 Happy Oaks Rd.
Address 2: Apt# 290

Shipping section
Address: 5810 Sappy Blvd.
Address 2: (he leaves it blank)

Although he left address 2 blank, the xcart will automatically fill it in causing it to become:

Shipping section
Address: 5810 Sappy Blvd.
Address 2: Apt# 290

The same thing will happen if he were to leave the address line 2 blank for the billing section but filled in the address line 2 for the shipping section.

Can someone please tell me the php code to tell xcart to only fill in s_address 2 with b_address 2 IF b_address matches s_address

I tried this:

if (empty($s_address2) & $b_address = $s_address) $s_address2 = $b_address2;

but no success. If someone can get the code, the cart will only fill it in if the first address lines match, otherwise it will correctly leave it empty.


Thanks.

B00MER 04-26-2004 01:57 AM

Quote:

Originally Posted by rodneyw
Using phpMyAdmin you will need to modify your CUSTOMER table in the database.
Insert new field AFTER b_address with the name b_address2
Insert new field AFTER s_address with the name s_address2

Using phpMyAdmin you will need to modify your ORDERS table in the database.
Insert new field AFTER b_address with the name b_address2
Insert new field AFTER s_address with the name s_address2


Instead of doing this steps, in case you don't have phpmyadmin, you can use this SQL query in patch/upgrades in your X-Cart admin to achieve the same:

Code:

ALTER TABLE `xcart_customers` ADD `b_address2` VARCHAR( 64 ) NOT NULL AFTER `b_address` ;
ALTER TABLE `xcart_customers` ADD `s_address2` VARCHAR( 64 ) NOT NULL AFTER `s_address` ;


Great documentation btw ;)

1CNS 05-10-2004 10:50 PM

I took the lazy route to solve this problem by using s_title and b_title (which I commented out in their usual locations) as new text entry variables for 2nd shipping and billing address lines. It works, but I've yet to crack the problem cited by xcell67 above. X-Cart is filling in s_title with the value in b_title when s_title is missing, and my newbie attempts to write logic to to prevent this have failed. ](*,)

Question: When I go back to modify address info as entered from my site after submitting it, X-Cart has filled in the missing shipping variables with what it finds in the billing variables. In what part of the code is this substitution taking place? Anyone know how to modify that code to pull off the type of conditional substitution described by xcell67?

And X-Cart developers, if you're reading, I love your product but this is a highly needed feature.

1CNS 05-16-2004 10:39 AM

To answer my own question above (originally asked by xcell67), here's the necessary logic to have two-line address entry that correctly deals with differences in the shipping and billing address (1 vs. 2 line address).

In includes/register.php, find the section below and modify it as shown in the comments with the designation VJ. I first modified register_billing_address.tpl and register_shipping_address.tpl to use company as the second billing address line and fax as the second shipping address line, but if you used different variables, adjust the code below accordingly.

With this code, a customer can enter two address lines in the billing address and one address line in the shipping address, and not have the second billing address line automatically added to the shipping address (as would happen if you used s_title and b_title, as I had originally). A missing shipping address will still be copied correctly in full.

Code:

#
# Fields filled without errors. User registered successfully
#

                $crypted = text_crypt($passwd1);
                $s_address = trim($s_address);
                $s_city = trim($s_city);
                $s_zipcode = trim($s_zipcode);
# VJ integrate address 2 variables (billing address 2=company ; shipping address 2=fax)
                    if (empty($s_address) && empty($fax) && empty($s_city) && empty($s_zipcode)) {
# VJ old            if (empty($s_address) && empty($s_city) && empty($s_zipcode)) {
                $fax = $company;
# VJ end
                $s_state = $b_state;
                $s_country = $b_country;

            }
# VJ added next line
            if (empty($s_address) && empty($fax)) $fax = $company;
            if (empty($s_address)) $s_address = $b_address;
            if (empty($s_city)) $s_city = $b_city;
            if (empty($s_zipcode)) $s_zipcode = $b_zipcode;


thundernugs 05-18-2004 06:00 PM

nice work! this is a quick and easy mod

you'll also need to modify customer/main/customer_details.tpl

and the e-mails

wallachee 08-17-2004 06:22 PM

I've had this mod running for a while, but I have one issue with the mod....

In my order invoice, I use the line...

{$order.s_address2}


The problem is that if someone doesn't have a second address line, the line is left blank. For Example:

John Does
111 John Lane

John, MN 11111


Is there an if else statement I can write into the template to make it so the line appears only if it isn't blank? For example a statement that does this...


{ if address line two contains data }
display data
{else}
don't display line
{if}

Thanks for any help.

1CNS 08-17-2004 07:32 PM

Yeah, I should have been more complete in my post. In customer_details.tpl, use something like this. I used the variable company for the 2nd address line, but if you did something else, change this code accordingly:

Code:

{$userinfo.b_firstname}{$userinfo.b_lastname}

{$userinfo.b_address}

{if $userinfo.company ne ""}
  {$userinfo.company}
 

{/if}
{$userinfo.b_city}, {$userinfo.b_state} {$userinfo.b_zipcode}


wallachee 08-17-2004 07:55 PM

That did it! Many thanks.

-Bradley

ajshades 09-22-2004 07:37 PM

ok, I must be doing something (luckly i backed up the two .php files) because when i copied and pasted the new additions into the two files listed earlier in this post my store would no long show up...

I am guessing that there is not an easier way to do any of this but why hasn't x-cart made this simpler to do?! It's seams to be a very vital part to be edited by each diffrent store...

I have alot of modifcations to do to the registration page could someone repost a complete and accurate listing of what it shown above?

if all else fails i would be willing to offer payment (not a ton but some $$ worth your time) for someone that can help or do this and a few other mods for me...

-adam mccombs

1CNS 09-22-2004 09:00 PM

You might consider updating to the latest 4.0 release. It now includes two address lines.

ajshades 09-22-2004 09:09 PM

2 adress lines is not the big issue here...

there are quite a number of other field I need to add for my client and this is quite a lengthy process to just add ONE field to the registration

you would think that xcart could simplify something this complex (i know it's asking alot but i think this is a very important part of customization of diffrent stores)

in 4.0 release is this problem fixed? is the registration fields changable by a simple gui/text interface like the rest of x-cart??

minorgod 09-23-2004 08:18 AM

If you know how to code and are just looking for a list of files to modify without specific instructions, here's what I modded to add a second billing and shipping address line to a 3.5.x cart:

ALTER TABLE `xcart_customers` ADD `b_address2` VARCHAR( 64 ) AFTER `b_address` ;
ALTER TABLE `xcart_customers` ADD `s_address2` VARCHAR( 64 ) AFTER `s_address` ;
ALTER TABLE `xcart_orders` ADD `b_address2` VARCHAR( 64 ) AFTER `b_address` ;
ALTER TABLE `xcart_orders` ADD `s_address2` VARCHAR( 64 ) AFTER `s_address` ;

INSERT INTO `xcart_languages` ( `code` , `descr` , `name` , `value` , `topic` ) VALUES ('US', 'Address', 'lbl_address2', 'Address 2', 'Labels');


----------------------------------------

PHP files altered:
\admin\pay_membership_fees.php
\admin\pay_subscriptions.php
\include\func.php
\include\register.php

Template files altered
----------------------------------------
\skin1\admin\main\register.tpl
\skin1\admin\main\user_delete_confirmation.tpl
\skin1\customer\main\customer_details_fax.tpl
\skin1\help\contactus.tpl
\skin1\images\help\contactus.tpl
\skin1\mail\help_contactus.tpl
\skin1\mail\order_invoice.tpl
\skin1\mail\profile_data.tpl
\skin1\mail\html\help_contactus.tpl
\skin1\mail\html\order_invoice.tpl
\skin1\mail\html\profile_data.tpl
\skin1\main\orders_export.tpl
\skin1\main\order_info.tpl
\skin1\main\register_billing_address.tpl
\skin1\main\register_shipping_address.tpl
Skipped: \skin1\modules\QuickBooks\orders_export_qb.tpl
\skin1\provider\main\register.tpl

junaid 11-11-2004 12:33 AM

Quote:

Originally Posted by shan
check register.tpl

you could re use an un needed field

Great idea, thanks so much saved my time.

eaglemobiles 01-17-2006 07:28 PM

I followed all the instructions but when i try to place order on my store and click on submit button on last payment page i got the following error. I will be grateful if any one can help.

Thanks



Your order is being placed. Please wait...

INVALID SQL: 1136 : Column count doesn't match value count at row 1
SQL QUERY FAILURE: INSERT INTO xcart_orders ( vat_no,please_select,contact_number, organization_name,gender,occupation,time_occupatio n,provide_daytime,current_network,msisdn, middle_initial,date_of_birth,previous_name,marital _status,phone_landline,b_flat_number,b_house_numbe r,b_flat_house_number,residential_status,b_ltca,s_ mobile_number,s_flat_number,s_house_number,s_flat_ house_number,s_ltca,p_mobile_number,p_flat_number, p_house_number,p_flat_house_number,p_residential_s tatus,p_ltca,employment_status,account_holder,acco unt_number,sort_code,bank_address1,bank_address2,b ank_address3,a_city,a_country,a_zipcode,services,h ome,work, login, membership, total, giftcert_discount, giftcert_ids, subtotal, shipping_cost, shippingid, tax, taxes_applied, discount, coupon, coupon_discount, date, status, payment_method, flag, details, title, firstname, lastname, company, b_title, b_firstname, b_lastname, b_address, b_city, b_county, b_state, b_country, b_zipcode, s_title, s_firstname, s_lastname, s_address, s_city, s_county, s_state, s_country, s_zipcode, p_address, p_city, p_county, p_state, p_country, p_zipcode, phone, fax, email, url, clickid, extra) VALUES ( 'ssssssssssss', '', '', 'ssssssss', 'Male', 'ssssssssss', '284018400', 'ssssssssss-ssssssssssss', 'Orange', '000000', 'CLo985485', 'no', '-14462', 'no', 'Divorced', '00-00', '12', '12', '12', '', '276066000', '', '12', '12', '12', '0', '', '', 'hous no', 'rrrrrrrrrr', 'Owner', '568015200', 'Self employed', 'Akbar Khan', '0000', '000-00-00', '000', '00', '0000', '0000', '', '000000', 'Yes', 'Y', 'N', 'tester', '', '16.99', '0', '', '15.00','1.99', '127', '0.00', 'N;', '0.00', '', '0.00', '1137561268', 'Q', 'Credit Card (manual processing)', 'N', 'Sgefkedeiegdkdhdsemhpdgdeeoeidfhligkrgjekdiepeeei ekeleldpilsgnerprfrmrdopnkpssprjrmrqrgsonsqosmsgsq mrqjskrispomrrrfrpslnhossjrlserfnrrjpkqipplmphqrpe pspoqqlnmelflglhliljlklllmlnlolplqlrlssdsesfsgshsi ppmenmningnsrpnoopndoqrosfrgririrdqqmqnennsispomos noliqopfqgqiqiqdrqnoosopqmqjpqqrqspdpe', 'Mr.', 'Gulbanu', 'Khan', '', 'Mr.', 'Gulbanu', 'Khan', '12 12', '12', '12', '', '', 'BB2 2NW', 'Mr.', 'Gulbanu', 'Khan', '12 112', '12', '112', '', '', 'BB2 2NW', 'rrrrrrrrrrrr sssssssss', 'ssssssssssss', 'sssssssss', '', '', 'sssssssssssssss', '', '', 'akbaruk@msn.com', '', '', 'a:2:{s:17:\"additional_fields\";b:0;s:8:\"tax_inf o\";a:5:{s:26:\"display_taxed_order_totals\";s:1:\ "N\";s:31:\"display_cart_products_tax_rates\";b:0; s:14:\"taxed_subtotal\";s:5:\"15.00\";s:25:\"taxed _discounted_subtotal\";s:5:\"15.00\";s:14:\"taxed_ shipping\";s:4:\"1.99\";}}')
INVALID SQL: 1062 : Duplicate entry '0-ip' for key 1
SQL QUERY FAILURE: INSERT INTO xcart_order_extras (orderid, khash, value) VALUES ('0', 'ip', '84.92.213.237')
INVALID SQL: 1062 : Duplicate entry '0-add_to_cart_time' for key 1
SQL QUERY FAILURE: INSERT INTO xcart_order_extras (orderid, khash, value) VALUES ('0', 'add_to_cart_time', '619')


If the page is not updated in a 5 seconds, please follow this link: continue >>


All times are GMT -8. The time now is 02:05 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.