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

Change the city as dropdown in Vendor registration form

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 08-16-2019, 01:40 AM
 
_patricia _patricia is offline
 

Member
  
Join Date: Mar 2019
Posts: 17
 

Default Change the city as dropdown in Vendor registration form

Hi,

Is it possible to make the City as Dropdown in the vendor registration form?
Does anyone do this? or any suggestion/advice

Thank you!
__________________
Multi-vendor 5.3.6.0
Reply With Quote
  #2  
Old 08-16-2019, 10:49 PM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Change the city as dropdown in Vendor registration form

What do you have currently? A horizontal list to choose from, or an empty text input area?
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #3  
Old 08-21-2019, 10:50 PM
 
_patricia _patricia is offline
 

Member
  
Join Date: Mar 2019
Posts: 17
 

Default Re: Change the city as dropdown in Vendor registration form

currently, I have a text input area and also I want to apply the dropdown city in the address book page. (please see screenshot for further reference.)

Do you have any suggestion?

Thanks a lot!!!
Attached Thumbnails
Click image for larger version

Name:	cit.PNG
Views:	187
Size:	20.6 KB
ID:	5360  
__________________
Multi-vendor 5.3.6.0
Reply With Quote
  #4  
Old 08-22-2019, 01:42 AM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default Re: Change the city as dropdown in Vendor registration form

Quote:
Originally Posted by _patricia
Is it possible to make the City as Dropdown in the vendor registration form?
Does anyone do this? or any suggestion/advice
Our answer relates to retail customers, not vendors, but may still be of some use for you

It's possible, for retail customers, but you would need to do a lot of data entry work after having already pre-validated all of your potential City entries...

Meaning...

To make a usable dropdown table for City, you would need to enter all of the correct values yourself and ensure they are specified correctly within Countries, States, Zone etc too.

We do this for County, Region or State (we're in the UK so we use County first in the label, then Region and then State as opposed to the XC default State label) but not City which we thought was a level too far. Especially, when you have many different Countries for which (even at our chosen County level) you need to pre-validate all of your data first, as mentioned.

If you do go to City level, then you may encounter argumentative customers with "ahhhh but it's a Town not a City so I entered it above..." or vice versa, which is worth thinking about
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote
  #5  
Old 08-22-2019, 02:05 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Change the city as dropdown in Vendor registration form

Presumably _patricia 's vendors are all from Kuwait, so there aren't so many cities to choose from.


One solution would be to write down a javascript to replace the input field with options, meaning that you will have to write a list of cities within your script. Another is to use 'XLite\View\FormModel\Type\Select2Type', which means that you have to register cities in the database as entities, and presumably Triple A Racing has this method in mind.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
  #6  
Old 08-22-2019, 06:59 PM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default Re: Change the city as dropdown in Vendor registration form

Yes @Ed B. We also saw Kuwait shown in the Country area on the image that @ _patricia posted, but it's not clear (yet) until @_patricia replies, as to, if that was by chance or was deliberate. Everything else, pretty much as per your post but we prefer the non-javascript method ourselves, for our own setup. FWIW We also added replacement 'default' values (pic) to the 'default' customer address block so that there's a more logical progression to entering each of the address parts. Previously, customers could (and some did ) initially enter the wrong country, thereby being served a wrong County, Region or State which they ignored and simply typed more details into the address line area...
Attached Thumbnails
Click image for larger version

Name:	XCart Default Address Fields.png
Views:	189
Size:	126.5 KB
ID:	5362  
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote
  #7  
Old 08-22-2019, 11:44 PM
 
_patricia _patricia is offline
 

Member
  
Join Date: Mar 2019
Posts: 17
 

Default Re: Change the city as dropdown in Vendor registration form

Hi, Thank you for your replies. I really appreciate it.

Yes, the store is for Kuwait only so that's the reason why I want to change the city field from input to dropdown to avoid wrong spelling. For the meantime, I try to change the input field of the cities to dropdown and seems working fine on the vendor registration form. But when I tried to apply this to my other forms like in the adding address in the address book page but my jquery codes won't apply to the modal of adding the address.
__________________
Multi-vendor 5.3.6.0
Reply With Quote
  #8  
Old 08-23-2019, 04:44 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default Re: Change the city as dropdown in Vendor registration form

The use of js should be avoided whenever possible. XC has way too much of it as it is already.

Find the class responsible for displaying the address form. This will tell you which template(s) is used to display the different fields. You will need to modify the one showing the city field and eventually make it call another form field class to draw a dropdown. Within that same class you can hardcode the cities as default options array to be shown in the dropdown. If you want to make it more complicated and use the database you will have to create few more classes to be able to add cities from admin and relate them to the country in question.
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #9  
Old 08-23-2019, 05:06 AM
 
Ed B. Ed B. is offline
 

X-Adept
  
Join Date: Apr 2016
Posts: 446
 

Default Re: Change the city as dropdown in Vendor registration form

I guess we can move to the thread https://forum.x-cart.com/showthread.php?t=77124 and continue the discussion there, if _patricia hasn't solved this, and moderators can close this one.
__________________
X-cart 5.2.12, php 5.6
Ed from Grenoble, France
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 05:45 AM.

   

 
X-Cart forums © 2001-2020