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)
-   -   Cant add address to the register.php page (https://forum.x-cart.com/showthread.php?t=60688)

Rob Barclay 08-27-2011 04:55 AM

Cant add address to the register.php page
 
Hi I am creating at trade site for a client and the register.php page will not display the address fields.

I am using 4.4.3 gold version I cannot force customers to enter Billing address on Register page. Changing settings in admin have no result on front-page. It looks to me that common_files/customer/main/register_address_info.tpl is old, 'cause it uses variables that do not exist in runtime.

Can anyone please confirm that register_address_info.tpl (and address_fields.tpl) are up-to-date with the version 4.4.3 gold? I really need new customers to register with Billing address.

http://shop.cliptec.co.uk/register.php

Matthew Austin 09-22-2011 07:56 AM

Re: Cant add address to the register.php page
 
I am having the same problem!:(

chamberinternet 09-22-2011 08:05 AM

Re: Cant add address to the register.php page
 
Quote:

Originally Posted by Rob Barclay
Can anyone please confirm that register_address_info.tpl (and address_fields.tpl) are up-to-date with the version 4.4.3 gold? I really need new customers to register with Billing address.

http://shop.cliptec.co.uk/register.php


Looks like you've resolved the issue on your site.
How did you get around it?

Rob Barclay 09-22-2011 08:25 AM

Re: Cant add address to the register.php page
 
Hi, because this is a trade site and I set the customer to not be able to purchase until their account was activated I created the address fields as Additional fields and as such the data is emailed to the client when they register so the client can approve/decline the application, but unfortunately this does not add the address to the customers address book.

So when the customers account is approved and they are ready to make a purchase when they checkout they would need to add their address again.

Because my client wont be activating these accounts without prior company checks its not a big issue, but if the client was to be registering and then expecting to checkout instantly then they would be confused at why they then have to add their address again.

I submitted a ticket to xcart and it was confirmed that this was not going to be possible with the standard structure. I looked at how I could achieve this and its not a simple procedure. If I needed the address to populate the Address book I would probably write a php script to clone the fields in the database to the required Address book tables so its already present when required.

Not a great solution but I dont see many other options.

qualiteam 09-29-2011 10:20 PM

Re: Cant add address to the register.php page
 
In the X-Cart v4.4 the address fields are really unavailable on the registration page, because the Address Book feature is used to store the users addresses. On the registration page it is necessary to enter the general information only (personal info + login and password). After registration the customer will see the "Address Book" tab, where he/she is able to manage his/her addresses.

epi 11-10-2011 02:27 AM

Re: Cant add address to the register.php page
 
I have the same problem, my new customers are synchronized with my CRM software and need address info to be validated. I just can't rely on customer's willingness to add their address info Аfter they registered.

I think it's really stupid that this is not a feature, especially because it always worked like this in previous versions. How can you just totally erase proper functionality?

Don't get me wrong, I think the address book is awesome, but why don't combine it with the registration page, it just doesn't make sense to me.

I'm now going to build it myself, if anyone has tips, let me know :)

Rob Barclay 11-10-2011 02:30 AM

Re: Cant add address to the register.php page
 
I would create a little sql/php and get it to populate the data into the other table with the updated information on a cron every 30 minutes or as required.

proboscidian 01-21-2012 06:30 PM

Re: Cant add address to the register.php page
 
Has anyone succeeded in modifying the register page to include the address book?

hues 07-21-2012 12:02 AM

Re: Cant add address to the register.php page
 
I was also looking for this. Need to modify register.php to include addresses. Has anyone done this ?
thanks

qualiteam 07-25-2012 01:22 AM

Re: Cant add address to the register.php page
 
This is possible, but a slight modification is required:

1. alter the "skin/common_files/customer/main/register.tpl" template and replace this code:
Code:

{include file="customer/main/register_address_info.tpl"}
with this:
Code:

{include file="customer/main/register_address_info.tpl" need_address_info='Y'}

2. add corresponding smarty assign statement in "include/register.php" script.

PHP Code:

$smarty->assign('address_fields'$address_fields); 


hues 07-25-2012 01:54 AM

Re: Cant add address to the register.php page
 
Thanks Alex.
Please help in modifying "include/register.php" Where to add the code
PHP Code:

$smarty->assign('address_fields'$address_fields); 



Around line 1690 on include/register.php we have

PHP Code:

$smarty->assign('address_fields'$address_fields);
        if (!empty(
$address_book)) {
            
$smarty->assign('address_book'$address_book);
        } 


Thanks again for the help.

qualiteam 07-25-2012 02:15 AM

Re: Cant add address to the register.php page
 
Try adding this code at the bottom where the other smarty variables are defined:
PHP Code:

if (empty($userinfo)) {
  
$smarty->assign('address_fields'$address_fields);



e.g. after this after this one:
PHP Code:

$smarty->assign('is_areas'$is_areas); 


hues 08-04-2012 07:28 PM

Re: Cant add address to the register.php page
 
Thank you Alex. This is exactly what was needed.

hues 08-10-2012 08:51 AM

Re: Cant add address to the register.php page
 
Alex I implemented this modification but it is not working properly. When a user registers, address fields are there on registration form but address does not appear in address book. User has to fill in address again so it does not make sense.

tagteam 08-29-2012 11:30 AM

Re: Cant add address to the register.php page
 
I have the same issue with one of my companies. Has a way been found to tie the registration to the address book so there is no need for double entry of address?

paul@dimoda.com.au 09-06-2012 03:37 PM

Re: Cant add address to the register.php page
 
This is really helpful. I would also like to add the "additional Feilds" from the user profiles to the register form. Is this possible as we are using it as an internal account application form to approve accounts.

mcanitano 09-26-2012 07:25 AM

Re: Cant add address to the register.php page
 
Getting the Customer Registered e-mail with Customer's Personal Information along with Address Information is a need for our company as well, since we incorporate the customers onto our system as they register.

I see we can change that with some of the coding provided here, but we would also like it for our customers to not have to enter in their address twice (registration, then address book)! So as they register and enter their personal/address info, that information gets transfered to the address book.

Chrisweb2 10-23-2012 05:24 PM

Re: Cant add address to the register.php page
 
After adding Alex's code add the below to include/address_book.php

Code:

} elseif ($current_area == 'C' && !empty($address_book)) { 
    $address_book = func_customer_save_address_book_indb($address_book, @$ship2diff, @$existing_address, @$new_address);     
}


Worked for me.

tagteam 10-30-2012 02:28 PM

Re: Cant add address to the register.php page
 
If you dont mind me asking, where did you put it on the page to make it work for you?

Did you just edit the block around line 76 or did you enter this as a whole new block.
Thanks

tagteam 10-30-2012 02:29 PM

Re: Cant add address to the register.php page
 
Looking at the code it seems to be what they already have

Code:

} elseif ($current_area != 'C' && !empty($address_book)) {
    77        // Update request from admin area
    78        if (!empty($delete_address)) {
    79            $address_book = func_delete_from_address_book($address_book, $delete_address);
    80        }


tagteam 10-30-2012 02:38 PM

Re: Cant add address to the register.php page
 
Ha Ha sorry, I was watching the Arsenal v Reading Capital One match and not paying attention. I see they are different, so still just wondering where to put that code.
Thanks

Chrisweb2 11-11-2012 01:34 PM

Re: Cant add address to the register.php page
 
My address_book.php file has the below on line 76

Code:

} elseif ($current_area != 'C') {

after the closing tag on line 87 I just added

Code:

elseif ($current_area == 'C' && !empty($address_book)) { 
        $address_book = func_customer_save_address_book_indb($address_book, @$ship2diff, @$existing_address, @$new_address);     
    }


Ben G 07-11-2014 01:48 AM

Re: Cant add address to the register.php page
 
Thanks to all for contributing this code.

After hours of trying work through this step on 4.6.3 with no luck, I disabled Email Account Activation. As soon as it was disabled, the code worked perfectly - thanks.

As a wholesale only site, I by default have all new registrations set to suspended (waiting for our admin approval before being active).

Does anyone know how to work this into the Email Account Activation module?

mcanitano 07-25-2014 05:36 AM

Re: Cant add address to the register.php page
 
1 Attachment(s)
We've added the code to all three required files:

include/register.php
include/address_book.php
skin/common_files/customer/main/register.tpl

It now registers the customer's address with the address book during registration, but while a customer is logged in and they go to view the "My Account" page, the address fields are missing, and it shows this section (see attached photo also):

Code:

Billing address
                 
  Save as a new address
  Update existing address
Ship to a different address 



We are using X-Cart v4.5.5

Ben G 07-26-2014 04:15 AM

Re: Cant add address to the register.php page
 
The missing address fields according my Webmaster mode is from customer/main/register_address_fields.tpl - see Alex's code below (from page 1 of this thread).

Quote:

Originally Posted by qualiteam
This is possible, but a slight modification is required:

1. alter the "skin/common_files/customer/main/register.tpl" template and replace this code:
Code:

{include file="customer/main/register_address_info.tpl"}
with this:
Code:

{include file="customer/main/register_address_info.tpl" need_address_info='Y'}

2. add corresponding smarty assign statement in "include/register.php" script.

PHP Code:

$smarty->assign('address_fields'$address_fields); 



I don't see this file in your list of modified files.

Sounds like you missed this one or you applied to just the common files.
If you are using a custom skin (e.g. Ideal Responsive) you need to make the change to
Quote:

ideal_responsive/customer/main/register_address_fields.tpl

Any other skin changes in the code mentioned also need to be made to your custom skin files (if they exist), not just common files.

I just registered a test customer on my site and can confirm the code does work properly in 4.6.3.

Hope it helps.

ADDISON 07-26-2014 04:44 AM

Re: Cant add address to the register.php page
 
Address Book in XC is like a pain in the ass. Over the years I recommended to write a module from scratch to allow add/remove/change in Address Book (field type, position). Also I recommended when creating a new field to select its destination: Contact, Shipping/Billing. Imagine you have two type of customers with different registration fields, how can you do it by default? You simply can't. There are at least 2 shopping carts which allow a true Address Book. If it cannot be implemented someone could create it as a module. Sad to see in year 2014 such of issues. Sorry guys!

designguru 07-28-2014 10:38 AM

Re: Cant add address to the register.php page
 
Did anyone finally get this working properly?

It's amazing that in 2014 such simple things are coming around like a huge problem and needs custom coding 8O

What I found out more and more: X-Cart 4.x is programmed more by technical ascpects without thinking too much about usability. That is the main case why leading design and theme pages do not list x-cart.

Just think about 5000 lines of css and still write css into tpl files which makes it a pain to edit ;)

Sorry, for the off-topic part, but it's frustrating some times.

mcanitano 08-20-2014 12:29 PM

Re: Cant add address to the register.php page
 
How do you hide the Billing/Shipping address fields when a customer has already registered, is logged in and updating their current profile on the 'My Account' tab?


Code:

www.example.com/register.php?mode=update

EDIT:

I was simply lazy and figured it out, in customer/main/register_address_info.tpl:


Change
Code:

{if $need_address_info}

to
Code:

{if $need_address_info and !$login}

ppi 04-25-2015 08:26 AM

Re: Cant add address to the register.php page
 
Okay, I feel like I'm a second from getting this right...

I followed the following instructions / suggestions

1) Added the following code to skin/common_files/customer/main/register.tpl
Quote:

{include file="customer/main/register_address_info.tpl" need_address_info='Y'}

2) Added the following code to include/register.php
Quote:

if (empty($userinfo)) {
$smarty->assign('address_fields', $address_fields);
}
Beneath this code
Quote:

$smarty->assign('is_areas', $is_areas);

At this point the fields show, but they don't post to the address book, so I added this code as suggested below the code above in include/register.php
Quote:

} elseif ($current_area == 'C' && !empty($address_book)) {
$address_book = func_customer_save_address_book_indb($address_book , @$ship2diff, @$existing_address, @$new_address);
}

Upon adding that the registration page would not load at all, so I removed it, and continued onto the suggestion of adding that last bit of code to include/address_book.php

The page loads, the fields show, but I'm still at the point that the data entered into the address fields does not show up in the address book.

I've gone through this thread from top to bottom and back again, and I'm stumped as to what I missed :( Help?

Gina
x-cart v4.6.5

Carzilla 06-05-2015 04:17 AM

Re: Cant add address to the register.php page
 
Hello Gina,

I've had the same problem as you had, I added all the code everyone suggested, but alas the addres book didn't get updated.

I've solved it now - albeit not perfect - but it works good enough for me.

In include/address_book.php, add:

Code:

elseif (!empty($address_book)) {
            func_admin_save_address_book($address_book, $newuser_info['id'], $address_book_additional_values);
           
    }


After the "elseif ($current_area != 'C')" block.

Now it saves the data! The only problem is that the user still has this one 'empty' address book entry... but that's a problem for another day.

Too bad X-Cart itself doesn't really solve this problem. With all due respect, this is core functionality in 2015.

Zizilu 07-28-2015 04:48 PM

Re: Cant add address to the register.php page
 
Having same issue.. I want the customer to enter all info needed once (when registering) and not have to enter it again to address book or when checking out. I have login/registration needed to checkout. Would someone please post all procedures needed to solve this issue please :)

cflsystems 07-28-2015 05:25 PM

Re: Cant add address to the register.php page
 
I guess you are looking for something like this - https://www.cflsystems.com/register.php

This requires changes in numerous files both php and tpl types. It is not a simple 1. 2. 3. list....

Zizilu 07-28-2015 05:40 PM

Re: Cant add address to the register.php page
 
Quote:

Originally Posted by cflsystems
I guess you are looking for something like this - https://www.cflsystems.com/register.php

This requires changes in numerous files both php and tpl types. It is not a simple 1. 2. 3. list....


Exactly! And once customers enter this info during registration they wouldn't have to enter it again on checkout right?
Can you list the steps to achieving that please :)

cflsystems 07-28-2015 09:41 PM

Re: Cant add address to the register.php page
 
Yes this is one time info enter and it goes directly in the address book as billing/shipping.
Like I said it is not a simple change here or there. I can integrate it for you but can't list all steps required and codes changes.

Zizilu 07-29-2015 01:09 PM

Re: Cant add address to the register.php page
 
Ok how can we do that please?

cflsystems 07-30-2015 06:33 PM

Re: Cant add address to the register.php page
 
You can open a ticket here https://www.cflsystems.com/support/ with details and I can give you an estimate for the integration.

ElegantXMods.com 07-06-2016 03:53 AM

Re: Cant add address to the register.php page
 
Hi
as for:
Quote:

Originally Posted by Zizilu
Having same issue.. I want the customer to enter all info needed once (when registering) and not have to enter it again to address book or when checking out. I have login/registration needed to checkout. Would someone please post all procedures needed to solve this issue please :)


just +1 to what cflsystems say
Quote:

Originally Posted by cflsystems
I guess you are looking for something like this - https://www.cflsystems.com/register.php

This requires changes in numerous files both php and tpl types. It is not a simple 1. 2. 3. list....


meaning if all of the files adjustments done and you are still not getting address book filled then the registration process needs debug.. Maybe you register page's HTML does not have fields like:
HTML Code:


<input type="text" id="b_firstname" name="address_book[b][firstname]" size="32" maxlength="128" value="" autofocus />

and it should be added in order to fix that.. Or another method is to manually create the address book array like:
PHP Code:

$address_book['B'] = array ( 
        
'firstname' => $_POST['firstname'],
        
'lastname' => $_POST['lastname'],
        
'address' => $_POST['no']. ', '$_POST['address-line1'] .', '.$_POST['address-line2'], 
        
'city' => $_POST['city'], 
        
'country' => $_POST['country'], 
        
'zipcode' => $_POST['zip'], 
        
'phone' => $_POST['phone'],
        
'fax' => '',
    ); 

it depends on your store and HTML.
Hope it helps:-)


All times are GMT -8. The time now is 07:35 AM.

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