Page 1 of 3
S03E08 - Country and State Selector
Posted: Fri Nov 26, 2021 9:01 pm
by Kofod95
@ecartz
1.0.8.8 on Xampp (Windows)
When installing the header-tag-module, it throws:
Notice: Trying to access array offset on value of type null in
C:\Xampp\htdocs\1.0.8.8\includes\system\versioned\1.0.8.6\country.php on line 37
untill any country or countries are selected. Once selected, it's impossible to remove all countries again (to enable all), unless the module is removed and installed again (same as
S01E07, same fix works the same as there. Removes the notice, but still does not allow removal of all selected countries).
It does not set the selected default country as selected in the dropdown on either of the pages it should, and it does not limit the dropdown to show allowed countries. No changes to the "state"-input-field either, when choosing a country that should trigger something there.
//Daniel
Re: S03E08 - Country and State Selector
Posted: Tue Dec 14, 2021 9:49 am
by Kofod95
@ecartz
1.0.8.8 on Xampp (Windows)
It does not limit the countries to the selected ones, it does not set the default country selected as default and it does not affect the "State"-input at all.
I have tried changing the sort-order, various other settings in the module and removing/installing other modules, but I can not get it working from admin.
Also, it is not possible to de-select all countries chosen, unless the module is removed and then re-installed. Removing all ticks in all check-boxes is ignored, when saving. Removing all but one tick, makes it save that one tick only.
//Daniel
S03e08 - Country / State Selector QUESTIONS/SUPPORT
Posted: Mon Jan 03, 2022 8:50 pm
by admin
Questions / Comments / Concerns
Re: S03e08 - Country / State Selector
Posted: Mon Jun 13, 2022 5:30 pm
by Omar_one
@ecartz I am getting issue with this module (v1.0.8.14)
the State input set to False
1.JPG
and Customer Data > State > Require State module (False )
but still the state still require (if the country have state )
2.JPG
Thank you in advance
Omar
Re: S03e08 - Country / State Selector
Posted: Mon Jun 13, 2022 7:32 pm
by ecartz
Have you checked the configuration of this module? In particular, this entry:
Code: Select all
'MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_REQUIRE_TEXT_FIELD' => [
'title' => 'Require Input',
'value' => 'True',
'desc' => 'If this is True, customer will be required to insert a State.',
'set_func' => "Config::select_one(['True', 'False'], ",
],
Re: S03e08 - Country / State Selector
Posted: Tue Jun 14, 2022 5:05 am
by Omar_one
ecartz wrote: ↑Mon Jun 13, 2022 7:32 pm
Have you checked the configuration of this module? In particular, this entry:
Code: Select all
'MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_REQUIRE_TEXT_FIELD' => [
'title' => 'Require Input',
'value' => 'True',
'desc' => 'If this is True, customer will be required to insert a State.',
'set_func' => "Config::select_one(['True', 'False'], ",
],
Yes . It's set to False.. (the first attached image show that)
Re: S03e08 - Country / State Selector
Posted: Tue Jun 14, 2022 6:22 am
by ecartz
Are there zones for the country?
The logic is that if there are no zones for a country, the special zone of 0 is used with a manual entry of the state name (which can be blank if not required). If there are any zones, then one needs to be selected.
The "required" check on the customer data module only occurs if there are no zones for a country. It requires entry of a name for the "state" when there are no zones. If it is off, then a zone does not need to be selected and a state does not need to be entered. But that only happens if there are no zones. If there is a list of zones, then one will always be "required". I.e. it will show
https://github.com/CE-PhoenixCart/Phoen ... te.php#L18
I suppose it would be possible for one of the certified developers to make an alternative version of this module that would automatically select a default zone for each country (e.g. 0 => No state selected). That might make the zone truly not required. Or an alternative version of the customer data module that would process the submission differently. But as is, the behavior is to require a zone selection for any country with zones defined.
There are no current plans to make this module or the core customer data module support optional selecting from zones when one or more is defined. As best I can tell, the current core behavior hasn't significantly changed since 1.0.5.0, before I ported it to the customer data modules. The only change was the addition of a configuration option for required, which has somewhat less effect than one might expect. This module's behavior hasn't changed since 1.0.8.0.
Note that the current behavior would seem to date back to before the community edition split off. The display changed. The architecture changed. But the processing logic is still the same.
Re: S03e08 - Country / State Selector
Posted: Tue Jun 14, 2022 5:14 pm
by Omar_one
ok, Thank you @ecartz for your reply and explanation,, I will empty the zones table and this will sort the my issue,, I don't think there will be any side effects for that
Re: S03e08 - Country / State Selector
Posted: Sun Jul 03, 2022 10:27 am
by raiwa
It seems MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_SELECT_COUNTRY is unused/not displayed.
To show it below the state drop down I applied the following modifications:
In: includes\modules\header_tags\ht_country_state_selector.php
line 72 changed to:
Code: Select all
$select_country = '<span id="atState" class="form-text">' . MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_SELECT_COUNTRY . '</span>';
line 85 changed to:
Code: Select all
<script>$(document).ready(function () { $('#inputState').next('span').hide(); $('#inputState').after('{$select_country}'); {$remove_these_countries} {$set_default_country} {$set_dropdown_readonly} var selected_state = $('#inputState').val().length; var selected_country = $('#inputCountry').val(); if ( (selected_country > 0) && (selected_state == 0) ) { change_state(selected_country); } $('#inputCountry').on('change', function() { var selected_country = $('#inputCountry').val(); change_state(selected_country); }); }); function change_state(country) { $.ajax({ url: 'ext/scripts/stateSelector.php', data: {'country' : country}, success: function(data) { if(data) { $('#inputState').hide(); $('#inputState').after( data ).remove(); } else { $('#inputState').replaceWith('{$require_input}'); {$require_input_js} } } });}</script>
Re: S03e08 - Country / State Selector
Posted: Sun Jul 03, 2022 11:09 am
by radhavallabh
raiwa wrote: ↑Sun Jul 03, 2022 10:27 am
It seems MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_SELECT_COUNTRY is unused/not displayed.
To show it below the state drop down I applied the following modifications:
In: includes\modules\header_tags\ht_country_state_selector.php
line 72 changed to:
Code: Select all
$select_country = '<span id="atState" class="form-text">' . MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_SELECT_COUNTRY . '</span>';
line 85 changed to:
Code: Select all
<script>$(document).ready(function () { $('#inputState').next('span').hide(); $('#inputState').after('{$select_country}'); {$remove_these_countries} {$set_default_country} {$set_dropdown_readonly} var selected_state = $('#inputState').val().length; var selected_country = $('#inputCountry').val(); if ( (selected_country > 0) && (selected_state == 0) ) { change_state(selected_country); } $('#inputCountry').on('change', function() { var selected_country = $('#inputCountry').val(); change_state(selected_country); }); }); function change_state(country) { $.ajax({ url: 'ext/scripts/stateSelector.php', data: {'country' : country}, success: function(data) { if(data) { $('#inputState').hide(); $('#inputState').after( data ).remove(); } else { $('#inputState').replaceWith('{$require_input}'); {$require_input_js} } } });}</script>
Hi dear;
I updated the code you provided but the Select your Country text keeps appending to the state drop down every time I change selection of the country...
Attaching screenshot..
Screenshot 2022-07-03 at 16-38-56 Radha Krishna Spiritual Store.png
Please help fix the issue;
Thank you in advance;
Very Warm Regds./
radhavallabh