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?
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?
I think this is where the tweaking should be, (tpl_modules_create_account.php) however my basic php knowledge limits me....
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'.)
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.....
How about replacingwithPHP 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
}
?>andPHP Code:<input type="text" id="state" name="state" value="Quebec" readonly /><br class="clearBoth" />
withPHP 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>': ''); ?>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)
Thanks !
Just what I needed ! :)
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" />
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 insteadOriginally Posted by johnny43
Let me know how that goes, and if that's not it. I'll take a closer look tomorrow.<input type="text" id="country" name="country" value="38" readonly />
Kuroi Web Design and Development | Twitter
(Questions answered in the forum only - so that any forum member can benefit - not by personal message)
Soory, that just puts 38 in the field...
Thanks for the reply !