diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..62c8935 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea/ \ No newline at end of file diff --git a/src/app/code/community/Fontis/Australia/Helper/Data.php b/src/app/code/community/Fontis/Australia/Helper/Data.php index 5be054d..1bc92aa 100644 --- a/src/app/code/community/Fontis/Australia/Helper/Data.php +++ b/src/app/code/community/Fontis/Australia/Helper/Data.php @@ -112,6 +112,9 @@ public function getPostcodeAutocompleteResults() return array(); } + $cityQueryTet = (Mage::getStoreConfig("fontis_australia/postcode_autocomplete/match_start")) + ? $this->getQueryText() : '%' . $this->getQueryText(); + $res = Mage::getSingleton('core/resource'); /* @var $conn Varien_Db_Adapter_Pdo_Mysql */ $conn = $res->getConnection('australia_read'); @@ -120,7 +123,7 @@ public function getPostcodeAutocompleteResults() INNER JOIN ' . $res->getTableName('directory_country_region') . ' AS dcr ON au.region_code = dcr.code WHERE city LIKE :city ORDER BY city, region_code, postcode LIMIT ' . $this->getPostcodeAutocompleteMaxResults(), - array('city' => '%' . $this->getQueryText() . '%') + array('city' => $cityQueryTet . '%') ); } } diff --git a/src/app/code/community/Fontis/Australia/etc/system.xml b/src/app/code/community/Fontis/Australia/etc/system.xml index 9bd5dfd..1d5220c 100644 --- a/src/app/code/community/Fontis/Australia/etc/system.xml +++ b/src/app/code/community/Fontis/Australia/etc/system.xml @@ -783,6 +783,15 @@ 1 1 + + + select + adminhtml/system_config_source_yesno + 15 + 1 + 1 + 1 + diff --git a/src/app/design/frontend/base/default/template/fontis/australia/postcode-checkout.phtml b/src/app/design/frontend/base/default/template/fontis/australia/postcode-checkout.phtml index 3c2dd91..917578b 100644 --- a/src/app/design/frontend/base/default/template/fontis/australia/postcode-checkout.phtml +++ b/src/app/design/frontend/base/default/template/fontis/australia/postcode-checkout.phtml @@ -21,10 +21,16 @@ var citySuggestUrl = 'helper('australia')->getCitySuggestUrl(); ?>'; //============ Billing ============// + var autocomplete_city_billing_indicator = new Element('div', { + id: 'autocomplete_city_billing_indicator', + 'class': 'fontis-postcode-autocomplete-indicator', + 'style': 'display:none;' + }); var autocomplete_city_billing = new Element('div', { id: 'autocomplete_city_billing', 'class': 'fontis-postcode-autocomplete' }); - if ($('billing:city')) { - $('billing:city').parentNode.appendChild(autocomplete_city_billing); + if ($('billing:city')) { + $('billing:city').parentNode.appendChild(autocomplete_city_billing_indicator) + .parentNode.appendChild(autocomplete_city_billing); function updateAddressBilling(text, item) { // Update state and postcode fields @@ -40,6 +46,7 @@ var completer = new Ajax.Autocompleter("billing:city", "autocomplete_city_billing", citySuggestUrl, { afterUpdateElement: updateAddressBilling, minChars: 2, + indicator: 'autocomplete_city_billing_indicator', callback: function (inputElement, queryString) { return queryString + '&' + 'country=' + $F('billing:country_id'); } @@ -47,10 +54,16 @@ } //============ Shipping ============// + var autocomplete_city_shipping_indicator = new Element('div', { + id: 'autocomplete_city_shipping_indicator', + 'class': 'fontis-postcode-autocomplete-indicator', + 'style': 'display:none;' + }); var autocomplete_city_shipping = new Element('div', { id: 'autocomplete_city_shipping', 'class': 'fontis-postcode-autocomplete' }); - if ($('shipping:city')) { - $('shipping:city').parentNode.appendChild(autocomplete_city_shipping); + if ($('shipping:city')) { + $('shipping:city').parentNode.appendChild(autocomplete_city_shipping_indicator) + .parentNode.appendChild(autocomplete_city_shipping); function updateAddressShipping(text, item) { // Update state and postcode fields @@ -66,6 +79,7 @@ var completer = new Ajax.Autocompleter("shipping:city", "autocomplete_city_shipping", citySuggestUrl, { afterUpdateElement: updateAddressShipping, minChars: 2, + indicator: 'autocomplete_city_shipping_indicator', callback: function (inputElement, queryString) { return queryString + '&' + 'country=' + $F('shipping:country_id'); } diff --git a/src/app/design/frontend/base/default/template/fontis/australia/postcode.phtml b/src/app/design/frontend/base/default/template/fontis/australia/postcode.phtml index cccc223..7d704b5 100644 --- a/src/app/design/frontend/base/default/template/fontis/australia/postcode.phtml +++ b/src/app/design/frontend/base/default/template/fontis/australia/postcode.phtml @@ -22,8 +22,14 @@ // Create and insert the div that will hold the list of autocomplete items. This // is added to the DOM immediately following the #city field. + var autocomplete_city_indicator = new Element('div', { + id: 'autocomplete_city_indicator', + 'class': 'fontis-postcode-autocomplete-indicator', + 'style': 'display:none;' + }); var autocomplete_city = new Element('div', { id: 'autocomplete_city', 'class': 'fontis-postcode-autocomplete' }); - $('city').parentNode.appendChild(autocomplete_city); + $('city').parentNode.appendChild(autocomplete_city_indicator) + .parentNode.appendChild(autocomplete_city); function updateAddress(text, item) { // Update state and postcode fields @@ -39,6 +45,7 @@ var completer = new Ajax.Autocompleter("city", "autocomplete_city", citySuggestUrl, { afterUpdateElement: updateAddress, minChars: 2, + indicator: 'autocomplete_city_indicator', parameters: 'country=' + $F('country') }); diff --git a/src/skin/frontend/base/default/fontis/australia/css/postcode-autocomplete.css b/src/skin/frontend/base/default/fontis/australia/css/postcode-autocomplete.css index 9f131ff..3ec122f 100644 --- a/src/skin/frontend/base/default/fontis/australia/css/postcode-autocomplete.css +++ b/src/skin/frontend/base/default/fontis/australia/css/postcode-autocomplete.css @@ -21,3 +21,10 @@ .fontis-postcode-autocomplete li.selected { background-color:#f7e8dd; } +.fontis-postcode-autocomplete-indicator { + background-image: url('../images/ajax-loader.gif'); + height: 16px; + width: 16px; + float: right; +} + diff --git a/src/skin/frontend/base/default/fontis/australia/images/ajax-loader.gif b/src/skin/frontend/base/default/fontis/australia/images/ajax-loader.gif new file mode 100755 index 0000000..5b33f7e Binary files /dev/null and b/src/skin/frontend/base/default/fontis/australia/images/ajax-loader.gif differ