Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Hard code Province & Country

    Hello,
    I would like to hard code the state/provimce and country to Quebec, canada respectively, as my store only will be for quebec, can this be done?

  2. #2
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: Hard code Province & Country

    I think this is where the tweaking should be, (tpl_modules_create_account.php) however my basic php knowledge limits me....

  3. #3
    Paul B Guest

    Default Re: Hard code Province & Country

    BACKUP FIRST. This can only be done if you are familair with the likes of PHPmyAdmin.

    In the database do something like this:
    -----------------------------------------------------------
    DROP TABLE IF EXISTS `countries`;
    CREATE TABLE `countries` (
    `countries_id` int(11) NOT NULL auto_increment,
    `countries_name` varchar(64) NOT NULL default '',
    `countries_iso_code_2` char(2) NOT NULL default '',
    `countries_iso_code_3` char(3) NOT NULL default '',
    `address_format_id` int(11) NOT NULL default '0',
    PRIMARY KEY (`countries_id`),
    KEY `idx_countries_name_zen` (`countries_name`)
    ) TYPE=MyISAM AUTO_INCREMENT=241 ;

    #
    # Dumping data for table `countries`
    #

    INSERT INTO `countries` VALUES (38, 'Canada', 'CA', 'CAN', 1);
    -----------------------------------------------------------


    So now you only have Canada as a country that can be used in registration.

    Then:
    -----------------------------------------------------------


    DROP TABLE IF EXISTS `zones`;
    CREATE TABLE `zones` (
    `zone_id` int(11) NOT NULL auto_increment,
    `zone_country_id` int(11) NOT NULL default '0',
    `zone_code` varchar(32) NOT NULL default '',
    `zone_name` varchar(32) NOT NULL default '',
    PRIMARY KEY (`zone_id`)
    ) TYPE=MyISAM AUTO_INCREMENT=182 ;

    #
    # Dumping data for table `zones`
    #

    INSERT INTO `zones` VALUES (76, 38, 'QC', 'Quebec');

    -----------------------------------------------------------

    That should do it.

    It's a nice idea to show this clearly elsewhere on your site so that people outside Quebec don't get annoyed.

    I always remove a lot of 'unwanted' countries from the db. There are also some errors in the names of zones in the default db too. (like 'Kärtnen' and 'Zrich' for Zürich - somewhere there was and umlaut problem. I suggest either ignoring umlauts (Zürich is Zurich in English anyway) or replacing umlatued letters with an 'e' after. This is correct in german: 'Zuerich'.)

  4. #4
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: Hard code Province & Country

    Thanks for the SQL.

    My site is a local delivery of produce...
    So I would have liked to "Hard Code" Province: Quebec and Country: Canada
    Your SQL still would require user to select...Also very annoying...:)
    Thanks for the heads up on "Clearly stating our delivery policies for non quebec residents.....

  5. #5
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Hard code Province & Country

    How about replacing
    PHP Code:
    <?php
        
    if ($process == true || $entry_state_has_zones == true ) {
          if (
    $entry_state_has_zones == true) {
            echo 
    zen_draw_pull_down_menu('state'$zones_array$zone_name' id="state"');
          } else {
            echo 
    zen_draw_input_field('state'''zen_set_field_length(TABLE_ADDRESS_BOOK'entry_state''40'), ' id="state"');
          }
        } else {
          echo 
    zen_draw_input_field('state'''zen_set_field_length(TABLE_ADDRESS_BOOK'entry_state''40'), ' id="state"');
        }
        if (
    zen_not_null(ENTRY_STATE_TEXT)) echo '<span class="alert">' ENTRY_STATE_TEXT '</span>';?>
    <br class="clearBoth" />
    <?php
      
    }
    ?>
    with
    PHP Code:
    <input type="text" id="state" name="state" value="Quebec" readonly /><br class="clearBoth" /> 
    and
    PHP Code:
    <?php
      $selected_country 
    = ($_POST['country']) ? $country SHOW_CREATE_ACCOUNT_DEFAULT_COUNTRY;
    ?>
    <?php 
    echo zen_get_country_list('country'$selected_country'id="country"') . (zen_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="alert">' ENTRY_COUNTRY_TEXT '</span>'''); ?>
    with
    PHP Code:
    <input type="text" id="country" name="country" value="Canada" readonly /> 
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  6. #6
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: Hard code Province & Country

    Thanks !

    Just what I needed ! :)

  7. #7
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: Hard code Province & Country

    Thanks again for the snipet, :)

    Please note on State/Provice :

    the PHP to replace is :

    <?php
    if ($process == true || $entry_state_has_zones == true ) {
    if ($entry_state_has_zones == true) {
    echo zen_draw_pull_down_menu('state', $zones_array, $zone_name, ' id="state"');
    } else {
    echo zen_draw_input_field('state', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40'), ' id="state"');
    }
    } else {
    echo zen_draw_input_field('state', '', zen_set_field_length(TABLE_ADDRESS_BOOK, 'entry_state', '40'), ' id="state"');
    }
    if (zen_not_null(ENTRY_STATE_TEXT)) echo '<span class="alert">' . ENTRY_STATE_TEXT . '</span>';?>
    <br class="clearBoth" />

  8. #8
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Re: Hard code Province & Country

    Getting an error....the form will not validate, getting error saying must select country...PLease help !

  9. #9
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: Hard code Province & Country

    Quote Originally Posted by johnny43
    Getting an error....the form will not validate, getting error saying must select country...PLease help !
    Hi Johnny too late in the day for anything other than a quick guess, but maybe we should have put this instead
    <input type="text" id="country" name="country" value="38" readonly />
    Let me know how that goes, and if that's not it. I'll take a closer look tomorrow.
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  10. #10
    Join Date
    Feb 2006
    Posts
    235
    Plugin Contributions
    1

    Default Re: Hard code Province & Country

    Soory, that just puts 38 in the field...

    Thanks for the reply !

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Force State/Province dropdown to show relevant options for selected COUNTRY
    By schoolboy in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 13 Dec 2010, 12:54 PM
  2. Replies: 6
    Last Post: 31 Mar 2009, 04:59 AM
  3. Zone Rates using Zone Code & Country ISO Codes?
    By dcmall in forum Built-in Shipping and Payment Modules
    Replies: 2
    Last Post: 8 Aug 2007, 09:08 AM

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