Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

2 Address Lines

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 12-04-2003, 08:19 PM
  leon's Avatar 
leon leon is offline
 

X-Wizard
  
Join Date: Mar 2003
Location: Costa Rica
Posts: 1,213
 

Default

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.
__________________
It doesn\'t matter what is done... it is how it is done.
=============================
XCart Version: 3.5.3 -> Dmcigars.com
XCart Version: 4.1.3....
Reply With Quote
  #12  
Old 03-31-2004, 04:10 PM
 
xcell67 xcell67 is offline
 

Senior Member
  
Join Date: Dec 2003
Posts: 149
 

Default

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.
Reply With Quote
  #13  
Old 04-26-2004, 01:57 AM
  B00MER's Avatar 
B00MER B00MER is offline
 

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

Default

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
__________________
Cart-Lab - 100+ Social Bookmarks for X-Cart.
Reply With Quote
  #14  
Old 05-10-2004, 10:50 PM
  1CNS's Avatar 
1CNS 1CNS is offline
 

Advanced Member
  
Join Date: Mar 2004
Location: Los Angeles, CA, USA
Posts: 45
 

Default

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.
__________________
www.funkymart.com
x-cart 4.2.1 [linux]
Reply With Quote
  #15  
Old 05-16-2004, 10:39 AM
  1CNS's Avatar 
1CNS 1CNS is offline
 

Advanced Member
  
Join Date: Mar 2004
Location: Los Angeles, CA, USA
Posts: 45
 

Default

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;
__________________
www.funkymart.com
x-cart 4.2.1 [linux]
Reply With Quote
  #16  
Old 05-18-2004, 06:00 PM
  thundernugs's Avatar 
thundernugs thundernugs is offline
 

Senior Member
  
Join Date: May 2003
Location: Bend, OR
Posts: 117
 

Default

nice work! this is a quick and easy mod

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

and the e-mails
__________________
X-Cart Gold 4.0.17 & 4.0.18
Linux Server
Hands-On Hosting
http://www.CoreCases.com - Ipod Cases
http://www.InnovativeOutlet.com - Pet Plants and other cool stuff you need
Reply With Quote
  #17  
Old 08-17-2004, 06:22 PM
 
wallachee wallachee is offline
 

Senior Member
  
Join Date: Feb 2003
Posts: 102
 

Default

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.
Reply With Quote
  #18  
Old 08-17-2004, 07:32 PM
  1CNS's Avatar 
1CNS 1CNS is offline
 

Advanced Member
  
Join Date: Mar 2004
Location: Los Angeles, CA, USA
Posts: 45
 

Default

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}
__________________
www.funkymart.com
x-cart 4.2.1 [linux]
Reply With Quote
  #19  
Old 08-17-2004, 07:55 PM
 
wallachee wallachee is offline
 

Senior Member
  
Join Date: Feb 2003
Posts: 102
 

Default

That did it! Many thanks.

-Bradley
Reply With Quote
  #20  
Old 09-22-2004, 07:37 PM
 
ajshades ajshades is offline
 

Advanced Member
  
Join Date: Jul 2004
Posts: 33
 

Default

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
__________________
x-cart version 3.5.10
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 10:46 PM.

   

 
X-Cart forums © 2001-2020