Custom city list

  • Posts: 68
  • Thank you received: 2
  • Hikashop Business
3 months 1 day ago #303864

-- HikaShop version -- : 4.0.1
-- Joomla version -- : 3.9.3
-- PHP version -- : 7....
-- Browser(s) name and version -- : all
-- Error-message(debug-mod must be tuned on) -- : none

We are trying to implement an automation for a shipping method. The problem we encountered is that the address_city field is not a Zone type. Now, we know that you have not and maybe will not implement this in the future, and we understand we.
However, we need to use a selection method for this field, because the shipper will not accept the values in his app, unless thay are as its own.

Ok. Now, we have the complete list in the database. Also, we can set the City field like Single Dropdown, or Multiple dropdown. For such field types, we can manually set the values, of course, but we would not do that for all the thousand of values in Romania.
If there is a possibility of interfacing such a field with the values we have, please let us know.

Of course, there is another issue, that for international expedition, we would need to use a normal Text Field. This means trouble...

Thank you,
Paul

Please Log in or Create an account to join the conversation.

  • Posts: 65624
  • Thank you received: 9577
  • MODERATOR
3 months 22 hours ago #303889

Hi,

1. If you want to import all the cities without entering them one by one in the interface, then what you can do is :
- first create the custom field for the city dropdown with a few cities
- go in your phpmyadmin, export the table hikashop_field as a CSV file
- open the CSV file in notepad++ or another text editor and extract the cities listing from it
- use the search & replaces features of your text editor to format your cities listing in the same manner and put back the whole list in the CSV file
- import back the CSV file via phpmyadmin
- that's it, you should now have a dropdown with all the cities.

2. What you can do is have two fields, the address_city field as a text input, and your dropdown custom field for the list of cities.
In the dropdown custom field setting, use the "display limited to" setting to romania.
In the address_city custom field, you will have to use that same setting, but you won't be able to select all the other countries via the interface. Again, you'll have to do that with an export/import similarily to what is described in point 1.

An alternative to all that is to develop your own custom field type with the development of a custom hikashop plugin implementing the field API: www.hikashop.com/support/documentation/6...entation.html#fields
That will allow you to have a solution way easier to maintain in the future and much cleaner. But it requires a developer to work on that and it's not that simple.

Please Log in or Create an account to join the conversation.

  • Posts: 68
  • Thank you received: 2
  • Hikashop Business
2 months 3 weeks ago #304064

Thank you. I will try and keep you informed.

Paul

L.E. However, a question arises:

The field created this way, will not be a Joomla core field. Furthermore, it will not have the same id, column name, like the one already used etc. Would not make this difficult the integration with the payment methods (paypal, credit card)? Just asking...

Last edit: 2 months 3 weeks ago by NADEJDE.

Please Log in or Create an account to join the conversation.

  • Posts: 65624
  • Thank you received: 9577
  • MODERATOR
2 months 3 weeks ago #304109

Hi,

HikaShop does not use Joomla core fields at all.
Now, regarding payment gateways integrations, it is correct that some payment plugins car send the address information to the payment gateway. So in that case, if you use other custom fields than the default ones, these payment plugins won't see them.
For example, the PayPal payment plugin has some options to send the address of the customer to PayPal. If you activate that option then it will use address_city to send the city name to PayPal, and if that field is not filled (because another one is used), then you'll end up with that field not sent which might even result in an error when redirected for the payment to PayPal.
Now most payment plugins do not use the address information, so for them it won't change anything.
Also, if you develop your own custom plugin to create your own type of custom field, you'll be able to change the type of the default address_city custom field to your own type and thus you'll be able to do what you want without any change for the payment plugins.

Please Log in or Create an account to join the conversation.

Time to create page: 0.059 seconds
Powered by Kunena Forum