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)
-   -   Additional fields for address book (https://forum.x-cart.com/showthread.php?t=62429)

qualiteam 01-24-2012 06:07 AM

Additional fields for address book
 
5 Attachment(s)
In order to add this feature you can try the following modification (patches for X-Cart 4.4.4):

1. Apply the attached PATCH.sql
2. Apply the attached DIFF.patch

http://help.qtmsoft.com/index.php?title=X-Cart:Applying_Patches

See the attached snapshots.

Once the patches are applied new options will be available on profile options page in admin back end and customer front end.

New "Address book" fields will appear on checkout and address book pages.

See the attached snapshots (next posts).

Note: Only default build-in fields can be used for shipping calculations.

qualiteam 01-24-2012 06:12 AM

Re: Additional fields for address book
 
4 Attachment(s)
Admin back end snapshots.

qualiteam 01-24-2012 06:13 AM

Re: Additional fields for address book
 
4 Attachment(s)
Customer front end snapshots.

cflsystems 01-24-2012 06:51 AM

Re: Additional fields for address book
 
Thanks for that Alex. Maybe you can consider it being included in 4.4.5 by default. Also very very helpful will be to have position for all fields so they can be sorted any way

Nadeem 01-24-2012 06:46 PM

Re: Additional fields for address book
 
WOW Finally some one did it.
THANK YOU SO SO SO Much for sharing this.

carlisleglass 01-25-2012 04:03 AM

Re: Additional fields for address book
 
Did you miss
Code:

ALTER TABLE xcart_address_book ADD `addressid` INT(11) NOT NULL DEFAULT '0';
from the SQL patch?

qualiteam 01-25-2012 04:27 AM

Re: Additional fields for address book
 
There should be three SQL queries in the patch.
Including the one you mentioned.

carlisleglass 01-25-2012 04:49 AM

Re: Additional fields for address book
 
This is the contents of 'PATCH.sql.txt'
Code:

ALTER TABLE xcart_register_field_values ADD `addressid` INT(11) NOT NULL DEFAULT '0';
ALTER TABLE xcart_register_field_values DROP PRIMARY KEY;
ALTER TABLE xcart_register_field_values ADD PRIMARY KEY (`fieldid`, `userid`, `addressid`);


qualiteam 01-25-2012 05:29 AM

Re: Additional fields for address book
 
Quote:

Originally Posted by carlisleglass
This is the contents of 'PATCH.sql.txt'
Code:

ALTER TABLE xcart_register_field_values ADD `addressid` INT(11) NOT NULL DEFAULT '0';
ALTER TABLE xcart_register_field_values DROP PRIMARY KEY;
ALTER TABLE xcart_register_field_values ADD PRIMARY KEY (`fieldid`, `userid`, `addressid`);



Yes, these are the SQL queries that are required.

The addressid field is already in the address book table, it is called "id" there.

It seems I was wrong when I said your query is required.
I missed the table name in your query. Sorry.

So, all the required SQL can be found in my first post.

carlisleglass 01-25-2012 05:41 AM

Re: Additional fields for address book
 
For some reason my xcart installation didn't have an addressid on the address_book table, and I had to add it.

qualiteam 01-25-2012 06:04 AM

Re: Additional fields for address book
 
There should be only "id" field in the address book table, no "addressid" one (it is indeed means "addressid", but called "id").

The "addressid" field should be added to the "xcart_register_field_values" table.

Hope it helps.

carlisleglass 01-25-2012 06:30 AM

Re: Additional fields for address book
 
Quote:

Originally Posted by qualiteam
There should be only "id" field in the address book table, no "addressid" one (it is indeed means "addressid", but called "id").

The "addressid" field should be added to the "xcart_register_field_values" table.

Hope it helps.



For some reason my installation was causing php errors saying addressid was a missing field within address_book - unfortunately i don't have the error messages anymore, but adding addressid to the table stopped the error.

CartOnSteroids.com 01-25-2012 07:54 AM

Re: Additional fields for address book
 
Brilliant! This is really useful!

alinush 01-25-2012 11:00 AM

Re: Additional fields for address book
 
I'm getting this:

Code:


    SQL query  : SELECT COUNT(id) FROM xcart_address_book WHERE userid='0' AND addressid='S' LIMIT 1
    Error code  : 1054
    Description : Unknown column 'addressid' in 'where clause'
Request URI: /cart.php?mode=order_message&orderids=11970
Backtrace:
/home/user/public_html/xcart/include/func/func.db.php:291
/home/user/public_html/xcart/include/func/func.db.php:191
/home/user/public_html/xcart/include/func/func.db.php:542
/home/user/public_html/xcart/include/func/func.user.php:1210
/home/user/public_html/xcart/include/func/func.user.php:724
/home/user/public_html/xcart/include/checkout_init.php:304
/home/user/public_html/xcart/cart.php:119


alinush 01-25-2012 11:06 AM

Re: Additional fields for address book
 
Actually there's a set of errors on each completed order, from the same URL specified above

Code:

    SQL query  : SELECT COUNT(id) FROM xcart_address_book WHERE userid='0' AND addressid='0' LIMIT 1

    SQL query  : SELECT COUNT(id) FROM xcart_address_book WHERE userid=■ AND addressid=■ LIMIT 1

    SQL query  : SELECT COUNT(id) FROM xcart_address_book WHERE userid='0' AND addressid='B' LIMIT 1

    SQL query  : SELECT COUNT(id) FROM xcart_address_book WHERE userid='0' AND addressid='S' LIMIT 1


qualiteam 01-25-2012 10:07 PM

Re: Additional fields for address book
 
Oh, sorry. There seem to be an issue with the patch.

Please edit the include/func/func.user.php script and replace this code:
Code:

$_address_exists = func_query_first_cell("SELECT COUNT(id) FROM $sql_tbl[address_book] WHERE userid='$user' AND addressid='$address'") == 0 ? false : true;

with this:
Code:

$_address_exists = func_query_first_cell("SELECT COUNT(id) FROM $sql_tbl[address_book] WHERE userid='$user' AND id='$address'") == 0 ? false : true;

qualiteam 01-25-2012 10:09 PM

Re: Additional fields for address book
 
I've update the patch. So, it contains the fix provided above.

alinush 01-26-2012 12:06 AM

Re: Additional fields for address book
 
Thank you, this solved the problem.

For some reason though, the extra fields are invisible, even if the HTML code is there. Please see:

http://www.blueneon.ro/alinush/hidden.jpg

Also, how can we insert these fields between the other address book fields? For example, I need Address line 3 after Address line 2, but I can't insert it there:

http://www.blueneon.ro/alinush/fields.jpg

qualiteam 01-26-2012 02:56 AM

Re: Additional fields for address book
 
Repositioning is not supported, unfortunately.

Additional customization will be rquired e.g. in this template -> skin/%skin%/(main/modules)/address_fields.tpl

qualiteam 01-26-2012 02:57 AM

Re: Additional fields for address book
 
What browser do you use? Please clarify.

alinush 01-26-2012 12:25 PM

Re: Additional fields for address book
 
I use Firefox.

I also tried Chrome and IE - same thing, a blank space.

The screenshot shows the HTML code in Firebug - the additional field is there, but it's invisible for some reason.

I tried clearing the cache with no results.

seyfin 01-27-2012 08:24 AM

Re: Additional fields for address book
 
1 Attachment(s)
Quote:

Originally Posted by qualiteam
In order to add this feature you can try the following modification (patches for X-Cart 4.4.4):

1. Apply the attached PATCH.sql
2. Apply the attached DIFF.patch

http://help.qtmsoft.com/index.php?title=X-Cart:Applying_Patches

See the attached snapshots.

Once the patches are applied new options will be available on profile options page in admin back end and customer front end.

New "Address book" fields will appear on checkout and address book pages.

See the attached snapshots (next posts).

Note: Only default build-in fields can be used for shipping calculations.


Here is a patch adjusted for version 4.4.5:

* DIFF.patch.4_4_5.txt

qualiteam 01-30-2012 10:39 PM

Re: Additional fields for address book
 
Quote:

Originally Posted by alinush
For some reason though, the extra fields are invisible, even if the HTML code is there.


Make sure the modification is applied properly.
Also, please try clearing templates and browser cache.

http://help.qtmsoft.com/index.php?title=X-Cart:Advanced_Tools#Clear_Templates.2FX-Cart_Cache

alinush 01-30-2012 10:44 PM

Re: Additional fields for address book
 
I have tried everything, including clearing the cache. As you can see the HTML code is there, but for some reason it's not displayed. I can't find any way to fix it.

alinush 01-30-2012 10:46 PM

Re: Additional fields for address book
 
You can see this live at http://gentworks.blueneon.ro/ - if you go to checkout, you will see the blank space where this html code is:

Code:

<li class="fields-group last">
        <div class="field-container">
          <div class="data-name">
                  <label for="additional_address_values_address_B_9">Address (line 3)</label>
              &nbsp;</div>
                      <div class="data-value">
                    <input type="text" value="" size="32" id="additional_address_values_address_B_9" name="additional_values[address][b][9]">
                      </div>
        </div>
      </li>


qualiteam 02-03-2012 02:30 AM

Re: Additional fields for address book
 
Please try the follwing: edit the "skin/common_files/modules/One_Page_Checkout/profile/address_fields.tpl" template and add this code
Code:

{if $ex_additional_address_fields ne ''}
  <li class="clearing"></li>
{/if}

right after this code fragment
Code:

{include file="main/additional_address_fields.tpl" ex_additional_address_fields=$ex_additional_address_fields require_aid='Y' ex_list_view='Y'}

alinush 02-04-2012 05:56 AM

Re: Additional fields for address book
 
This did the trick! Thank you!

alinush 02-16-2012 10:02 AM

Re: Additional fields for address book
 
Any ideas on how I could insert extra address book fields between the default ones?

Nishant 03-19-2012 03:52 AM

Re: Additional fields for address book
 
What more required to make it work with X-cart 4.4.3 ??
Please help..

qualiteam 03-21-2012 03:05 AM

Re: Additional fields for address book
 
Quote:

Originally Posted by alinush
Any ideas on how I could insert extra address book fields between the default ones?


This feature is not supported unfortunately. A more complex modification will be required to add it.

qualiteam 03-21-2012 05:34 AM

Re: Additional fields for address book
 
Quote:

Originally Posted by Nishant
What more required to make it work with X-cart 4.4.3 ??
Please help..


The provided patches are for 4.4.4 and 4.4.5 only.

But you can try and apply the patch manually.

Make sure you work on the development copy not the live store. Since it has not been tested on versions before 4.4.4.

xtech 03-27-2012 03:39 AM

Re: Additional fields for address book
 
Hi Alex,
Thanks for your code for Address book but I want to get it for 4.4.2.Will it work?

xtech 03-29-2012 04:46 AM

Re: Additional fields for address book
 
Hi,
Will it possible to work on 4.4.2? Kindly reply...

Thanks..

qualiteam 03-29-2012 04:59 AM

Re: Additional fields for address book
 
I cannot say for sure since there were a lot of changes between X-Cart 4.4.2 and 4.4.4.
The DB structure has not been changed much, so most probably it will work (but more hand work is expected).

bullfrog 04-02-2012 11:19 AM

Re: Additional fields for address book
 
For the benefit of others trying this, I went thru the process and was able to add extra field capability to my 4.4.5 store. I had the invisible field problem listed in post above, but stopped before applying the fix in Post 26.

I use the Altered Cart one page checkout addon, and the extra fields were offset to the right of all other fields and also caused a wrapping problem with 'ship to a different address' setup.

Then this weekend, I got the email notice that 4.4.6 is coming 'soon'.

I'm going to wait and continue to use the fax field as a substitute for 'company'.

I'm hoping that the extra fields will be integrated then, or better still, do what should have been done long ago and make the company name a standard part of the address book.

It is my opinion that it was stupid to leave it out, and it is stupid to not put it in now. Sorry. I usually don't rant.

qualiteam 04-03-2012 12:25 AM

Re: Additional fields for address book
 
Thank you for the feedback.

In case this feature is not included, I'll update the instructions as soon as the next version is released.

ADDISON 06-14-2012 01:07 AM

Re: Additional fields for address book
 
Do we have one patch for 4.5.0?

By the way, this should be part of XC 4.5.x by default, right?

qualiteam 06-14-2012 01:15 AM

Re: Additional fields for address book
 
I'm working on the one for 4.5.x and upload it soon here.

qualiteam 06-20-2012 05:54 AM

Re: Additional fields for address book
 
OK, I've created and uploaded the v4.5.0 patch (see the first post).
The instructions and SQL patch are the same as for the previous versions.

cflsystems 06-20-2012 07:02 AM

Re: Additional fields for address book
 
Alex thanks for that but can you please include it in 4.5.1. Makes no sense to have to patch an upcoming version, just make it part of it


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

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