Community Add-Ons
Country-State Selector
for osCommerce Online Merchant v2.2
The Country-State Selector contribution provides the following enhancements to the Create Account and Address Book features of osCommerce:
- When the customer first views the Create Account or Add Address Book Entry form, a default country is pre-selected
- If the default country has zones (states, provinces, etc.), a drop-down list for the zones is automatically displayed; if no zones are in the database, a normal text input field is shown instead
- If the customer changes the country, the form refreshes and the state field is updated according to the new country; any entries in other fields are preserved
Please post support questions and/or feature requests in the Contribution Support Forum.
I want display waiting animation over window center,If you want do it ,follow me.
1.[file:includes/ajax.js.php]
change[about:line 44]:
getObject("indicator").style.visibility = 'visible';
with:
getObject("indicator").style.display = 'block';
change[about 63]:
getObject('indicator').style.visibility = 'hidden';
with:
getObject("indicator").style.display = 'none';
2.[file:stylesheet.css]
append:
#indicator{position:absolute;left:50%;top:50%;z-index:100;display:none;}
enjoy.
*** include file is dummy ,it contain nothing ****
He modificado el archivo catalog/admin/countries.php para activar y desactivar facilmente los paises.
catalog/functions/ajax.php omitted the closing </span>.
line 16
Corrected ajax.php file attached.
-adding european sql file to activeted all european countries
-adding visualization state of countries (a column in html) in admin countries page
adding control on admin panel to set/modify activate propriety of country
NO PHP files in this package, only manual updates required
This mod will allow you to limit the number of countries that are in the drop down. Of course you could just delete all the countries that you don't want to display, but this method will allow you to add them back at a later time if needed.
There is a bug in the latest versin 1.5.5 in /admin/customers.php that causes a "Parse error: syntax error, unexpected T_CASE in /path/to/admin/customers.php on line 221"
Original file messed up the // comment and included an extra "}" by mistake, see below.
After installing, find (around line 165):
// if ($error == false) {
// +Country-State Selector
} // End if (!$refresh)
if (($error == false) && ($refresh != 'true')) {
// -Country-State Selector
...and replace with:
// if ($error == false) {
// +Country-State Selector
// } End if (!$refresh)
if (($error == false) && ($refresh != 'true')) {
// -Country-State Selector
Note: File is the fixed README.HTM install file.
Insaini makes version upgrades but after that he doesn't add the upgrade documents, so it is a big lost for old users.
We waste time On every looking for ChangeLog.
Manual Upgrade from v1.5.1 to v1.5.5
1)in catalog/includes/modules address_book_details.php , checkout_new_address.php files and catalog/create_account.php file
Find:
<td class="main" colspan="3"><?php echo tep_get_country_list('country',$country,'onChange="getStates(this.value);"') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
Replace with:
<td class="main" colspan="3"><?php echo tep_get_country_list('country',$country,'onChange="getStates(this.value, 'states');"') . ' ' . (tep_not_null(ENTRY_COUNTRY_TEXT) ? '<span class="inputRequirement">' . ENTRY_COUNTRY_TEXT . '</span>': ''); ?></td>
2)Overwrite old files with new (of v1.5.5) catalog/includes/ajax.js.php and catalog/includes/functions/ajax.php files.
Optional:
3) If you like to show the picture of indicator.gif where the country is (+name, +overview) then look at the previous update.
Note:The file is not added.
Added ability to have multiple country-state drop-downs per page with each updating independently. Also fixed so that the form name is of no consequence to the code.
This is a full package
insaini
There were two sections of code missing from the manual installation instructions
Thanks to faaliyet for that info
installation instructions only have been updated.
This is a full package
insaini
Disregard v1.5.2 and v1.5.3
Includes fix of 1.5.3 and added fix of a missing condition statement to catalog/address_book_process.php which made it impossible for any update to be saved and processed.
This is a full package
insaini
Disregard the last package 1.5.2
The default zones code was added but the default state code was not (when a user has a self-typed state) would not show up. updated.
Full Package
insaini
Fixed:
Seems I left out some code pertaining to the default zone. The user when modifying their address does not get their currently saved state but defaults to the top of the list. This has been updated.
This is a full package.
insaini
In the Install.htm file of Country-State Selector v1.5.1 (AJAX) contribution, there are some mistakes and forgotten items that may cause a problem for the manual installation.
Ve ufak hatalari duzelttim.For users who use v1.4 may have a problem on language settings. ,I have changed a line to be used for more languages.
And, because of indicator.gif was seen above, i've changed it to be look better.also it was square viewed so I put it's own transparent picture.
i renamed it as "indicator-css.gif" to not to be confused with other indicator.gif in contributions which run by ajax. and i resized it.
Rather then this I have created the "manual upgrade from v1.4 to v1.5.html" file for v1.4 and v1.5 users to make manual update.I also add 2 screenshot from create_account.php page.
My Mistake I was adding the require command within an if when it should have been outside of the if statement..
in the 4 catalog root files
// +Country-State Selector
if (isset($HTTP_POST_VARS['action']) && $HTTP_POST_VARS['action'] == 'getStates' && isset($HTTP_POST_VARS['country'])) {
require(DIR_WS_FUNCTIONS . 'ajax.php'); ajax_get_zones_html(tep_db_prepare_input($HTTP_POST_VARS['country']), true);
} else {
// -Country-State Selector
should be
// +Country-State Selector
require(DIR_WS_FUNCTIONS . 'ajax.php');
if (isset($HTTP_POST_VARS['action']) && $HTTP_POST_VARS['action'] == 'getStates' && isset($HTTP_POST_VARS['country'])) {
ajax_get_zones_html(tep_db_prepare_input($HTTP_POST_VARS['country']), true);
} else {
// -Country-State Selector
Files have been updated
This is a full package
insaini
Thanks to Steve for this great contrib.. I have added AJAX functionality so that the page doesnt need refreshing..
if you dont want ajax functionality.. use a previous version.
insaini
In installation file it show the changes on catalog/admin/customers.php as follows .
But when you do that there is an extra } on the page and it become a reason to not complete " case 'deleteconfirm': " part and it doesn't work.
Replace:
$processed = true;
with:
$processed = true;
// +Country-State Selector
} else if ($refresh == 'true') {
$cInfo = new objectInfo($HTTP_POST_VARS);
}
// -Country-State Selector
So that change the part on top with the part down below.Now it works.
Replace:
$processed = true;
}
with:
$processed = true;
// +Country-State Selector
} else if ($refresh == 'true') {
$cInfo = new objectInfo($HTTP_POST_VARS);
}
// -Country-State Selector
No file.
I have changed some parts to make it work compatible.
Open catalog/create_account.php
Find:
$zones_array[] = array('id' => 0, 'text' => 'Please select...');
And Replace With:
$zones_array[] = array('id' => 0, 'text' => PULL_DOWN_DEFAULT);
The instructions were missing an edit for create_account.php that was in the pre-edited files. In the edit for line 418, add zone_code to the list of fields retrieved by the query.
Support at http://forums.oscommerce.com/index.php?showtopic=88987
- Require selection of a state from the dropdown (prevents defaults of "Alabama", etc.)
- Add zone code (state abbreviation) in dropdown
- Fix bug in checkout new addresses where a zone that was a substring of another zone was not accepted
- Add instructions on use with one country only
- Update to reflect osC 2.2-RC2a
Support at http://forums.oscommerce.com/index.php?showtopic=88987
If you get an error about an invalid in customers.php this is the fix...
catalog/admin/customers.php
Line 196:
Replace:
$processed = true;
}
with:
$processed = true;
// +Country-State Selector
} else if ($refresh == 'true') {
$cInfo = new objectInfo($HTTP_POST_VARS);
}
// -Country-State Selector
CONTINUE WITH ... Line 238:
Remove PWA merge files as those are now in the PWA contribution. Merged in the edits from the osCommerce 2.2-MS2 051113 update for the replacement files provided (catalog/address_book_process.php and catalog/admin/includes/functions/html_output.php). None of those edits are in code changed by this contribution, so if you've already made those edits, or don't want to, there's nothing new here.
Fix e-mail validation and HTML bugs in PWA merge Order_Info.php
Remove SetFocus optional feature that causes JavaScript warnings. Add debugging tips to readme.
By popular request, I added selector functionality to the Admin..Customers..Edit page and also included merged changes for those using this contribution along with Purchase Without Account. If you don't care about either of these, then there's nothing new for you here.
Fixes failure to clear state line on checkout address pages. See Readme for details.
Support at http://forums.oscommerce.com/index.php?showtopic=88987
Added logic to create_account.php to allow for zones that are an initial substring of other zones. This had already been done to the other pages. Minor bugfixes. See change history in README.htm for details.
Corrected a couple of typos in the README instructions related to <body> tags,
Move clearing of the state value to the form and out of form_check.js.php, for better cross-browser compatibility. In create_account.php, set focus to state field on refresh. See README.HTM for details.
The pre-edited checkout_shipping_address.php file did not have all the edits applied. This ZIP has the correct file. If you followed the readme and made the edits that way, you don't need to change anything.
The install instructions were missing a change to checkout_new_address.php line 104 (though it was in the included files.)
All files are included in this download.
Support and comments at http://forums.oscommerce.com/index.php?showtopic=88987
Add support for the Update Address feature during checkout. This update edits additional files only; files edited in previous versions are left unchanged.
Support and comments at http://forums.oscommerce.com/index.php?showtopic=88987
No code changes - just clean up the HTML in the install document to fix the last of the copy/paste issues (I hope!) and to remove tabs.
Support at http://forums.oscommerce.com/index.php?showtopic=88987
The install instructions were missing a line - fixed.
This update fixes problems when editing the address book, and includes other suggested fixes.
If you have suggestions or changes, or need help with this contribution, please go to http://forums.oscommerce.com/index.php?showtopic=88987
In my reference below, I meant to write
catalog/create_account.php
NOT
catalog/includes/modules/address_book_details.php
This is a good contribution. I was searching for this in the last few days, good timing!
I would make the following changes though:
fix bug:
what: need (int)$country instead of $country
reason: if you select "Please Select" as an option it will crap on the sql query
file: catalog/includes/modules/address_book_details.php
old line:
$zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = " . $country . " order by zone_name");
new line: $zones_query = tep_db_query("select zone_name from " . TABLE_ZONES . " where zone_country_id = " . (int)$country . " order by zone_name");
Also, put your global variable (DEFAULT_COUNTRY) in application_top.php instead of english.php. This makes it available for all languages.
:-)
Cheers,
calman
The Country-State Selector contribution provides the following enhancements to the Create Account and Address Book features of osCommerce:
- When the customer first views the Create Account or Add Address Book Entry form, a default country is pre-selected
- If the default country has zones (states, provinces, etc.), a drop-down list for the zones is automatically displayed; if no zones are in the database, a normal text input field is shown instead
- If the customer changes the country, the form refreshes and the state field is updated according to the new country; any entries in other fields are preserved
Please post support questions and/or feature requests in the Contribution Support Forum.
