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)

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.


All times are GMT -8. The time now is 02:50 PM.

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