Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    49
    Plugin Contributions
    0

    Default Empty entries in countries dropdown menu

    Very tiny bug appearing in case the Country set up for the top of Countries dropdown meny is actually disabled (status=0) in Admin

    What we have:

    1. zen_get_country_list function, which seems unchanged from v1.3.9 ages

    2. Option to change status of Countres ("Active for shipping") is appeared somehere later in 1.5.x

    3. zen_get_country_name function returning empty string in case the Country is disabled ("Active for shipping" set to No) in Admin

    Thus, in order to avoid entries with no text in $countries_array, some additional check should be added into zen_get_country_list function code:

    Code:
        //process array of top-of-list entries:
        foreach ($countriesAtTopOfList as $key=>$val) {
          if (zen_get_country_name($val) != '') $countries_array[] = array('id' => $val, 'text' => zen_get_country_name($val));
        }
    PS Please do not tell me, calling zen_get_country_name function twice is idiotic - I did this for better visibility only
    PPS Sorry, if my explanations are not very clear, lack of sleep...

  2. #2
    Join Date
    Jan 2004
    Location
    N of San Antonio TX
    Posts
    9,186
    Plugin Contributions
    11

    Default Re: Empty entries in countries dropdown menu


  3. #3
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Empty entries in countries dropdown menu

    Quote Originally Posted by yesaul View Post
    Very tiny bug appearing in case the Country set up for the top of Countries dropdown meny is actually disabled (status=0) in Admin

    What we have:

    1. zen_get_country_list function, which seems unchanged from v1.3.9 ages

    2. Option to change status of Countres ("Active for shipping") is appeared somehere later in 1.5.x

    3. zen_get_country_name function returning empty string in case the Country is disabled ("Active for shipping" set to No) in Admin

    Thus, in order to avoid entries with no text in $countries_array, some additional check should be added into zen_get_country_list function code:

    Code:
        //process array of top-of-list entries:
        foreach ($countriesAtTopOfList as $key=>$val) {
          if (zen_get_country_name($val) != '') $countries_array[] = array('id' => $val, 'text' => zen_get_country_name($val));
        }
    PS Please do not tell me, calling zen_get_country_name function twice is idiotic - I did this for better visibility only
    PPS Sorry, if my explanations are not very clear, lack of sleep...
    As you indicated, a bit of a corner-case, but still worth handling! I'll get a Zen Cart GitHub PR going, noting that I'll also add a PHP notice when the condition is found so that someone trying to debug why those countries aren't being shown in the dropdown has a clue!

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Empty entries in countries dropdown menu


 

 

Similar Threads

  1. v157 Empty entries in countries drop down menu
    By yesaul in forum Bug Reports
    Replies: 1
    Last Post: 15 Apr 2022, 07:19 PM
  2. v157 Countries dropdown menu
    By yesaul in forum Bug Reports
    Replies: 1
    Last Post: 15 Apr 2022, 07:18 PM
  3. v155 [Done v1.6.0] Countries, minor changes and missing entries
    By torvista in forum Bug Reports
    Replies: 2
    Last Post: 20 Jun 2016, 08:49 AM
  4. Header Dropdown Menu (CSS) Without the Dropdown???
    By hcd888 in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 27 May 2009, 01:20 AM
  5. Countries Dropdown
    By crichw in forum Basic Configuration
    Replies: 2
    Last Post: 26 Nov 2006, 06:59 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR