S03e08 - Country / State Selector QUESTIONS/SUPPORT

Open to all! Ask other shopowners for help.
User avatar
mhsuffolk
Contributor
Posts: 199
Joined: Sat Oct 26, 2019 9:13 am
Phoenix Version: v1.1.0.6
Has thanked: 12 times
Been thanked: 11 times

Re: S03e08 - Country / State Selector QUESTIONS/SUPPORT

Post by mhsuffolk »

Thank you, I will try again later.

Tags:


Join The Code Co-op to get access to your library in the Code Co-op Forum
User avatar
mhsuffolk
Contributor
Posts: 199
Joined: Sat Oct 26, 2019 9:13 am
Phoenix Version: v1.1.0.6
Has thanked: 12 times
Been thanked: 11 times

Re: S03e08 - Country / State Selector QUESTIONS/SUPPORT

Post by mhsuffolk »

Found the problem.
I do not use the "State" Customer Data module.
In the Country State Selector module I had set the Require input to False. As I am not using the State CD module I thought having it set to True might cause a conflict.
I have discovered that if I set this to True then the default country works correctly.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S03e08 - Country / State Selector QUESTIONS/SUPPORT

Post by heatherbell »

The use of States (counties) in U.K. is a weird one, that is, no requirement for them on postal addresses but there is a dependency on them for some modules.
User avatar
mhsuffolk
Contributor
Posts: 199
Joined: Sat Oct 26, 2019 9:13 am
Phoenix Version: v1.1.0.6
Has thanked: 12 times
Been thanked: 11 times

Re: S03e08 - Country / State Selector QUESTIONS/SUPPORT

Post by mhsuffolk »

Yes I agree.
I only use Royal Mail which as you say do not use them.
Couriers like DPD do use them but I try to avoid confusing customers by not showing them the field.
heatherbell
Senior Contributor
Posts: 2540
Joined: Mon Oct 07, 2019 4:39 am
Phoenix Version:
Has thanked: 35 times
Been thanked: 243 times

Re: S03e08 - Country / State Selector QUESTIONS/SUPPORT

Post by heatherbell »

Using this on PHP 8+ does sometimes trigger a notice:
PHP message: PHP Warning: Undefined array key "HTTP_X_REQUESTED_WITH" in /ext/scripts/stateSelector.php on line 17;
PHP message: PHP Deprecated: strtolower(): Passing null to parameter #1 ($string) of type string is deprecated in /ext/scripts/stateSelector.php on line 17
That's a notice, not an error - it still works - but in this case, change /ext/scripts/stateSelector.php line 17
from:

Code: Select all

  if (!strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest') {
to:

Code: Select all

if (!(strtolower($_SERVER['HTTP_X_REQUESTED_WITH'] ?? '') === 'xmlhttprequest')) {
Omar_one
Senior Contributor
Posts: 676
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 QUESTIONS/SUPPORT

Post by Omar_one »

on the last version S03e08-1.1.0.0 the Allowed Countries function missing

Code: Select all

'MODULE_HEADER_TAGS_COUNTRY_STATE_SELECTOR_ALLOWED_COUNTRIES' => [
          'title' => 'Allowed Countries',
          'value' => '',
          'desc' => 'Allowed List of Countries in addition to the Default Country. Or leave Blank for all countries.',
          'use_func' => 'cs_show_countries',
          'set_func' => 'Config::select_multiple(Country::fetch_options(), ',
        ],

Code: Select all

function cs_show_countries($text) {
    return nl2br(implode("\n", array_map('Country::fetch_name', explode(';', $text))));
  }
Last edited by Omar_one on Tue Oct 28, 2025 9:41 pm, edited 1 time in total.
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: S03e08 - Country / State Selector QUESTIONS/SUPPORT

Post by burt »

This was removed as you now have the possibility to turn off countries in admin.
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply