X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Change the city as dropdown in Vendor registration form (https://forum.x-cart.com/showthread.php?t=77113)

_patricia 08-16-2019 01:40 AM

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!

Ed B. 08-16-2019 10:49 PM

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?

_patricia 08-21-2019 10:50 PM

Re: Change the city as dropdown in Vendor registration form
 
1 Attachment(s)
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!!!

Triple A Racing 08-22-2019 01:42 AM

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..." 8O or vice versa, which is worth thinking about

Ed B. 08-22-2019 02:05 AM

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.

Triple A Racing 08-22-2019 06:59 PM

Re: Change the city as dropdown in Vendor registration form
 
1 Attachment(s)
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 8O ) 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...

_patricia 08-22-2019 11:44 PM

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.

cflsystems 08-23-2019 04:44 AM

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.

Ed B. 08-23-2019 05:06 AM

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.


All times are GMT -8. The time now is 05:00 PM.

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