View Single Post
  #85  
Old 11-02-2012, 08:02 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Additional fields for address book

How to hard code company name (or any other field) following current XC logic. This adds company name after first/last names - switch places if you need it to be different position. Be careful changing php/tpl files and database - backup, backup, backup. This is tested to work on 4.5.x but I take no responsibility for your action. Also note - this will not change payment methods and will not include company field when sending info to PP or other payment gateways as well as X-Payments. If you need this new field to be included there as well you have to modify the approptiate php file for that payment method

1. run this sql
ALTER TABLE `xcart_orders` ADD `b_company` VARCHAR( 128 ) NOT NULL DEFAULT '' AFTER `b_lastname`;
ALTER TABLE `xcart_orders` ADD `s_company` VARCHAR( 128 ) NOT NULL DEFAULT '' AFTER `s_lastname`;
ALTER TABLE `xcart_address_book` ADD `company` VARCHAR( 128 ) NOT NULL DEFAULT '' AFTER `lastname`;

2. open init.php and find

'lastname' => array(
'avail' => array('A' => 'N', 'P' => 'N', 'B' => 'N', 'C' => 'Y', 'H' => 'Y'),
'required' => array('A' => 'N', 'P' => 'N', 'B' => 'N', 'C' => 'Y', 'H' => 'Y')
),

and after add

// addded by CFL Systems (also 'company' field added to xcart_address_book table)
'company' => array(
'avail' => array('A' => 'N', 'P' => 'N', 'B' => 'N', 'C' => 'Y', 'H' => 'Y'),
'required' => array('A' => 'N', 'P' => 'N', 'B' => 'N', 'C' => 'N', 'H' => 'N')
),
// addded by CFL Systems (also 'company' field added to xcart_address_book table)


3. open include/func/func.order.php and find


$_fields = array (
'title',
'firstname',
'lastname',
'address',
'city',
'county',
'state',
'country',
'zipcode',
'zip4',
'phone',
'fax',
);

and change to

$_fields = array (
'title',
'firstname',
'lastname',
'company', // added by CFL Systems for company name
'address',
'city',
'county',
'state',
'country',
'zipcode',
'zip4',
'phone',
'fax',
);


4. open modules/Advanced_Order_Management/func.php and find

$_fields = array (
'title',
'firstname',
'lastname',
'email',
'url',
'company',
'tax_number',
'tax_exempt',
'membershipid'
);

and change to

$_fields = array (
'title',
'firstname',
'lastname',
'company', // added by CFL Systems for company name
'email',
'url',
'company',
'tax_number',
'tax_exempt',
'membershipid'
);

then find

$_fields = array (
'title',
'firstname',
'lastname',
'address',
'city',
'county',
'state',
'country',
'zipcode',
'zip4',
'phone',
'fax',
);

and change to

$_fields = array (
'title',
'firstname',
'lastname',
'company', // added by CFL Systems for company name
'address',
'city',
'county',
'state',
'country',
'zipcode',
'zip4',
'phone',
'fax',
);

5. open modules/Advanced_Order_Management/func.edit.php and find

'b_lastname' => $userinfo['b_lastname'],

and after add

'b_company' => $userinfo['b_company'], // added by CFL Systems for company name

then find

's_lastname' => $userinfo['s_lastname'],

and after add

's_company' => $userinfo['s_company'], // added by CFL Systems for company name

CONTINUE...
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote