Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Adding customer title options

 
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 03-26-2021, 02:02 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Adding customer title options

Hi all,

At present, customer title only has options for Mr, Ms and Mrs. That isn't a very inclusive list and what I want to do is either add to those options (probably the easier way to go) or make title a free text box, so that customers can enter their own text (probably more difficult, but with greatest flexibility for the customer).

I've searched through the settings and even dug around in the database and cannot find where Mr, Ms and Mrs are stored.

Any advice on how to achieve either of these options gratefully received as always.
__________________
Four sites using X-Cart 5.4.x.x. Oh the joy
Reply With Quote
  #2  
Old 03-26-2021, 10:18 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Adding customer title options

Where do customers choose the titles ? I can't find it in billing address and shipping address steps of check out process, or in the address book either.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #3  
Old 03-26-2021, 05:07 PM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,197
 

Default Re: Adding customer title options

I believe these are language variables and probably hardcoded which ones to select and include in the dropdown list. You will need to find the template outputting the values and the php class responsible for it and modify it if you want to extend this.
However I find it odd that anyone will want to include this. It is very uncommon to allow something like this. No one cares to fill it out and if you modify this to allow customers to enter free text you may just end with some gibberish as value for the most part.



@Ed - it is part of the address fields setup in admin and it is off by default. I am even surprised XC5 has this included by default yet it is missing street second line and company. It makes absolutely no sense but hey it is XC after all....
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #4  
Old 03-27-2021, 09:38 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Adding customer title options

Thank you Steve.


It is hardcoded, but can be overriden easily.



The relevant lines in the class classes/XLite/View/FormField/Select/Title.php are
Code:
protected function getDefaultOptions() { return array( 'Mr.' => static::t('Mr.'), 'Ms.' => static::t('Ms.'), 'Mrs.' => static::t('Mrs.'), );
So just write a class that extends Title.php and override the method getDefaultOptions(), add labels and translations if necessary, and you will be fine.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #5  
Old 03-29-2021, 04:01 AM
 
bionuts bionuts is offline
 

Senior Member
  
Join Date: Oct 2008
Posts: 109
 

Default Re: Adding customer title options

Hi,

Thanks for your replies.

It is one of those things that divides opinion: personally, I prefer to include a title and not a full name when filling out shopping cart information; others will prefer to do the opposite.

If a customer does fill out the form without entering their full name (and many of our customers do), then having a title at least allows for emails, etc, to be more politely addressed: eg Dear Mr Smith, rather than Dear Smith.

I think our best route will be to extend the list of options, but make the field not required. That way, those that want to fill it out can and those that don't want to won't be forced to.

Thanks for your help.
__________________
Four sites using X-Cart 5.4.x.x. Oh the joy
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > General questions (X-Cart 5)



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 04:05 AM.

   

 
X-Cart forums © 2001-2020