S03e08 - Country / State Selector QUESTIONS/SUPPORT
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
S03E08 - Country and State Selector
@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
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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
Tags:
- Kofod95
- Senior Contributor
- Posts: 748
- Joined: Sat Feb 06, 2021 7:38 pm
- Phoenix Version: 1.0.8.20
- Has thanked: 99 times
- Been thanked: 179 times
Re: S03E08 - Country and State Selector
@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
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
I'm not smart, but sometimes even a blind chicken can find a corn.
Here are a lot of corns: Phoenix user guide
Here are a lot of corns: Phoenix user guide
-
Omar_one
- Senior Contributor
- Posts: 677
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: S03e08 - Country / State Selector
@ecartz I am getting issue with this module (v1.0.8.14)
the State input set to False and Customer Data > State > Require State module (False )
but still the state still require (if the country have state )
Thank you in advance
Omar
the State input set to False and Customer Data > State > Require State module (False )
but still the state still require (if the country have state )
Thank you in advance
Omar
You do not have the required permissions to view the files attached to this post.
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: S03e08 - Country / State Selector
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'], ",
],-
Omar_one
- Senior Contributor
- Posts: 677
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: S03e08 - Country / State Selector
Yes . It's set to False.. (the first attached image show that)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'], ", ],
-
ecartz
- Core Team
- Posts: 3084
- Joined: Tue Nov 05, 2019 6:02 pm
- Phoenix Version:
- Has thanked: 4 times
- Been thanked: 208 times
Re: S03e08 - Country / State Selector
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.
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.
-
Omar_one
- Senior Contributor
- Posts: 677
- Joined: Fri Oct 25, 2019 5:06 pm
- Phoenix Version: v1.0.8.16
- Has thanked: 100 times
- Been thanked: 56 times
Re: S03e08 - Country / State Selector
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
-
raiwa
- Certified Developer
- Posts: 1640
- Joined: Sat Dec 21, 2019 8:08 am
- Phoenix Version: 1.1.0.6
- : Buy Me A Beverage
- Has thanked: 70 times
- Been thanked: 152 times
Re: S03e08 - Country / State Selector
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:
line 85 changed to:
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>';
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>
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
https://docs.google.com/spreadsheets/d/ ... sp=sharing
Need Help?viewtopic.php?f=10&t=27
-
radhavallabh
- Senior Contributor
- Posts: 466
- Joined: Tue Oct 27, 2020 4:09 am
- Phoenix Version: 1.1.0.6
- Has thanked: 29 times
- Been thanked: 3 times
Re: S03e08 - Country / State Selector
Hi dear;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:line 85 changed to:Code: Select all
$select_country = '<span id="atState" class="form-text">' . MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_SELECT_COUNTRY . '</span>';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>
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.. Please help fix the issue;
Thank you in advance;
Very Warm Regds./
radhavallabh
You do not have the required permissions to view the files attached to this post.