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. |
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}: I think I have a fix as soon as I figure this out .. unless it has already been posted before :) |
check register.tpl
you could re use an un needed field |
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:
# WITH Code:
# REPLACE Code:
# WITH Code:
# REPLACE Code:
if ($uerror || $eerror || $fillerror || $error) { WITH Code:
if ($uerror || $eerror || $fillerror || $error) { PHP FILE: include/func.php REPLACE Code:
Insert into orders WITH Code:
Insert into orders 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> SHIPPING ADDRESS 2: Code:
<tr valign=middle> 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} |
moved to custom templates
|
Rodney, thanks for the legwork! :)
Hopefully the Xcart people notice this and add it to their next version. |
great work :)
Really nice of you to fully document it. Done it many times, but keep forgetting to totally write it down :lol: |
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 :) |
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:
Then the following changes to the code: admin/giftcerts.php change: Quote:
to Quote:
change in: Quote:
to: Quote:
in customer/giftcert.php: change: Quote:
to: Quote:
in include/func.php: change: Quote:
to: Quote:
In skin1/modules/Gift_Certificates/giftcert.tpl: shortly after the statement group around line 231 about the address line add the following: Quote:
In skin1/modules/Gift_Certificates/giftcert_static.tpl: shortly after the statement group around line 90 about the address line add the following: Quote:
In skin1/main/history_order.tpl: around line 90 change: Quote:
to: Quote:
I hope I did not oversee something. |
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 |
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. |
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. |
Quote:
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` ; Great documentation btw ;) |
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. |
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:
# |
nice work! this is a quick and easy mod
you'll also need to modify customer/main/customer_details.tpl and the e-mails |
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. |
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} |
That did it! Many thanks.
-Bradley |
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 |
You might consider updating to the latest 4.0 release. It now includes two address lines.
|
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?? |
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 |
Quote:
|
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.