News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Is possible make state input not shown if country has no state ?

Started by florihana, February 19, 2018, 12:36:49 PM

Previous topic - Next topic

florihana

Virtuemart: 3.0.8
JOOMLA: 3.6

Hi experts,

I'm not sure if anyone had ask this question before or not, but I wonder if it is possible to make state input hide if the country has no state?

So far if the country has no state, then the user only see the state input has this value: -----selection-----

But this will make user confused

see picture below

I had tried out some method with jquery but not working at all

the render state/ country functions are located here:
components/com_virtuemart/helpers/shopfunctionsf.php


BUT it also related to getCountries function (administrator/component/com_virtuemart/model/country.php

I just wondering if there's anyone had ask this kind of question and try to find solution as well?

thank you


Studio 42

Does you really need the state ? You can unpublish the state field

florihana

Yes, in certain country it has to choose state for shipment address

Studio 42

A solution is to hide/show state on change countries checking the ID with jquery else you need to hack the Virtuemart core files.
You need to trigger same function on dom ready.

florihana

This is if countries has not a lot then you could do an dom event binding, but there's lot countries has states so I think the most best solution is doing with core virtuemart function

But it's seems complicated cause it related to lots class

Studio 42

You can then check the returned content with javascript and count the options with javascript, you dont need to modify the PHP.