Version Notes
Fixes:
- Better support IWD One Step Checkout
- Better support for updates in admin
Features:
- Detection of checkout type, for better future checkout extension support
Download this release
Release Info
| Developer | Postcode.nl Technical Support |
| Extension | PostcodeNl_Api |
| Version | 1.1.2.0 |
| Comparing to | |
| See all releases | |
Code changes from version 1.1.1.0 to 1.1.2.0
app/code/community/PostcodeNl/Api/Helper/Data.php
CHANGED
|
@@ -6,6 +6,8 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 6 |
|
| 7 |
protected $_modules;
|
| 8 |
|
|
|
|
|
|
|
| 9 |
protected function _getMagentoVersion()
|
| 10 |
{
|
| 11 |
if ($this->_getModuleInfo('Enterprise_CatalogPermissions') !== null)
|
|
@@ -100,6 +102,13 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 100 |
return $html;
|
| 101 |
}
|
| 102 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 103 |
public function lookupAddress($postcode, $houseNumber, $houseNumberAddition)
|
| 104 |
{
|
| 105 |
if (!Mage::getStoreConfig('postcodenl_api/config/enabled'))
|
|
@@ -148,14 +157,15 @@ class PostcodeNl_Api_Helper_Data extends Mage_Core_Helper_Abstract
|
|
| 148 |
return $sendResponse;
|
| 149 |
}
|
| 150 |
|
| 151 |
-
$url = $serviceUrl . '/rest/addresses/' .
|
|
|
|
| 152 |
$ch = curl_init();
|
| 153 |
curl_setopt($ch, CURLOPT_URL, $url);
|
| 154 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 155 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::API_TIMEOUT);
|
| 156 |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
| 157 |
curl_setopt($ch, CURLOPT_USERPWD, $serviceKey .':'. $serviceSecret);
|
| 158 |
-
curl_setopt($ch, CURLOPT_USERAGENT, 'PostcodeNl_Api_MagentoPlugin/' . $extensionVersion .' '. $this->_getMagentoVersion() .' PHP/'. phpversion());
|
| 159 |
$jsonResponse = curl_exec($ch);
|
| 160 |
$curlError = curl_error($ch);
|
| 161 |
curl_close($ch);
|
| 6 |
|
| 7 |
protected $_modules;
|
| 8 |
|
| 9 |
+
protected $_enrichType = 0;
|
| 10 |
+
|
| 11 |
protected function _getMagentoVersion()
|
| 12 |
{
|
| 13 |
if ($this->_getModuleInfo('Enterprise_CatalogPermissions') !== null)
|
| 102 |
return $html;
|
| 103 |
}
|
| 104 |
|
| 105 |
+
public function setEnrichType($enrichType)
|
| 106 |
+
{
|
| 107 |
+
$this->_enrichType = preg_replace('~[^0-9a-z\-_,]~i', '', $enrichType);
|
| 108 |
+
if (strlen($this->_enrichType) > 40)
|
| 109 |
+
$this->_enrichType = substr($this->_enrichType, 0, 40);
|
| 110 |
+
}
|
| 111 |
+
|
| 112 |
public function lookupAddress($postcode, $houseNumber, $houseNumberAddition)
|
| 113 |
{
|
| 114 |
if (!Mage::getStoreConfig('postcodenl_api/config/enabled'))
|
| 157 |
return $sendResponse;
|
| 158 |
}
|
| 159 |
|
| 160 |
+
$url = $serviceUrl . '/rest/addresses/' . rawurlencode($postcode). '/'. rawurlencode($houseNumber) . '/'. rawurlencode($houseNumberAddition);
|
| 161 |
+
|
| 162 |
$ch = curl_init();
|
| 163 |
curl_setopt($ch, CURLOPT_URL, $url);
|
| 164 |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
| 165 |
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, self::API_TIMEOUT);
|
| 166 |
curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
|
| 167 |
curl_setopt($ch, CURLOPT_USERPWD, $serviceKey .':'. $serviceSecret);
|
| 168 |
+
curl_setopt($ch, CURLOPT_USERAGENT, 'PostcodeNl_Api_MagentoPlugin/' . $extensionVersion .' '. $this->_getMagentoVersion() .' PHP/'. phpversion() .' EnrichType/'. $this->_enrichType);
|
| 169 |
$jsonResponse = curl_exec($ch);
|
| 170 |
$curlError = curl_error($ch);
|
| 171 |
curl_close($ch);
|
app/code/community/PostcodeNl/Api/controllers/Adminhtml/PcnlController.php
CHANGED
|
@@ -5,6 +5,9 @@ class PostcodeNl_Api_Adminhtml_PcnlController extends Mage_Adminhtml_Controller_
|
|
| 5 |
{
|
| 6 |
$helper = Mage::helper('postcodenl_api');
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 9 |
$this->getResponse()->setBody(json_encode($helper->lookupAddress(
|
| 10 |
$this->getRequest()->getParam('postcode'),
|
| 5 |
{
|
| 6 |
$helper = Mage::helper('postcodenl_api');
|
| 7 |
|
| 8 |
+
if ($this->getRequest()->getParam('et'))
|
| 9 |
+
$helper->setEnrichType($this->getRequest()->getParam('et'));
|
| 10 |
+
|
| 11 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 12 |
$this->getResponse()->setBody(json_encode($helper->lookupAddress(
|
| 13 |
$this->getRequest()->getParam('postcode'),
|
app/code/community/PostcodeNl/Api/controllers/JsonController.php
CHANGED
|
@@ -5,6 +5,9 @@ class PostcodeNl_Api_JsonController extends Mage_Core_Controller_Front_Action
|
|
| 5 |
{
|
| 6 |
$helper = Mage::helper('postcodenl_api');
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 9 |
$this->getResponse()->setBody(json_encode($helper->lookupAddress(
|
| 10 |
$this->getRequest()->getParam('postcode'),
|
| 5 |
{
|
| 6 |
$helper = Mage::helper('postcodenl_api');
|
| 7 |
|
| 8 |
+
if ($this->getRequest()->getParam('et'))
|
| 9 |
+
$helper->setEnrichType($this->getRequest()->getParam('et'));
|
| 10 |
+
|
| 11 |
$this->getResponse()->setHeader('Content-type', 'application/json');
|
| 12 |
$this->getResponse()->setBody(json_encode($helper->lookupAddress(
|
| 13 |
$this->getRequest()->getParam('postcode'),
|
js/postcodenl/api/lookup.js
CHANGED
|
@@ -53,6 +53,34 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 53 |
*/
|
| 54 |
enrichType: 'Unknown',
|
| 55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
/**
|
| 57 |
* Hide multiple field-rows in forms
|
| 58 |
*/
|
|
@@ -259,7 +287,9 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 259 |
// Make uppercase to prevent double, but identical, requests
|
| 260 |
postcode = postcode.toUpperCase();
|
| 261 |
|
| 262 |
-
var
|
|
|
|
|
|
|
| 263 |
if (this.requestCache[url] === undefined)
|
| 264 |
{
|
| 265 |
new Ajax.Request(url,
|
|
@@ -457,8 +487,6 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 457 |
this.removeHousenumberAddition(prefix);
|
| 458 |
}
|
| 459 |
|
| 460 |
-
$(prefix + postcodeFieldId).fire('postcode:updated');
|
| 461 |
-
|
| 462 |
// Add support for syncing Billing & Shipping
|
| 463 |
if (prefix == 'billing:' && $('shipping:' + postcodeFieldId)) {
|
| 464 |
// 'shipping' is a global object created on most checkout pages
|
|
@@ -488,6 +516,7 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 488 |
if ($(prefix + countryFieldId).getValue() == 'NL')
|
| 489 |
{
|
| 490 |
// The Netherlands is selected - add our own validated inputs.
|
|
|
|
| 491 |
|
| 492 |
if (!$(prefix +'postcode_input:wrapper'))
|
| 493 |
{
|
|
@@ -857,13 +886,30 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 857 |
$(prefix + 'telephone-moved').insert(clone);
|
| 858 |
}
|
| 859 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 860 |
else
|
| 861 |
{
|
| 862 |
// Support for regular Magento 'one page' checkout
|
| 863 |
// + Fire Checkout
|
| 864 |
// + Quick One Page Checkout (by KAM)
|
| 865 |
// + MAGExtended MasterCheckout
|
| 866 |
-
// + IWD Free One Page / Step Checkout v3
|
| 867 |
|
| 868 |
if ($(document.body).hasClassName('firecheckout-index-index'))
|
| 869 |
this.enrichType = 'Fire Checkout';
|
|
@@ -871,20 +917,18 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 871 |
this.enrichType = 'Quick One Page Checkout (by KAM)';
|
| 872 |
else if ($(document.body).hasClassName('mastercheckout-index-index'))
|
| 873 |
this.enrichType = 'MAGExtended MasterCheckout';
|
| 874 |
-
else if ($(document.body).hasClassName('opc-index-index'))
|
| 875 |
-
this.enrichType = 'IWD Free One Page / Step Checkout v3';
|
| 876 |
else if ($(document.body).hasClassName('checkout-onepage-index'))
|
| 877 |
this.enrichType = 'Basic';
|
| 878 |
else if ($(document.body).hasClassName('customer-address-form'))
|
| 879 |
this.enrichType = 'Customer Address Form';
|
| 880 |
else
|
| 881 |
-
this.enrichType = 'Unknown
|
| 882 |
|
| 883 |
if (!$(prefix +'postcode_input:info'))
|
| 884 |
{
|
| 885 |
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="wide pcnl-info"><div><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text" id="' + prefix + 'postcode_input:info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
|
| 886 |
}
|
| 887 |
-
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="fields"><div class="field input-postcode"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em class="required">*</em></label><div class="input-box"><div class="field-wrapper"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div></div><div class="field input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em class="required">*</em></label><div class="input-box"><div class="field-wrapper"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="
|
| 888 |
if (!$(prefix +'postcode_input:checkbox'))
|
| 889 |
{
|
| 890 |
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="wide control pcnl-manual-checkbox"><div class="fields"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox " /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
|
|
@@ -990,6 +1034,10 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 990 |
*/
|
| 991 |
toggleAddressFields: function(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, values)
|
| 992 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
| 993 |
if (!$(prefix + 'postcode_input_checkbox').checked)
|
| 994 |
{
|
| 995 |
this.setFieldsReadonly([
|
|
@@ -1130,6 +1178,25 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 1130 |
this.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
|
| 1131 |
}
|
| 1132 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1133 |
}
|
| 1134 |
if ($('shipping:country_id'))
|
| 1135 |
{
|
|
@@ -1210,14 +1277,25 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 1210 |
// Admin 'create order' & 'edit order' address editting
|
| 1211 |
if ($('order-billing_address'))
|
| 1212 |
{
|
| 1213 |
-
|
| 1214 |
-
this.
|
| 1215 |
-
|
| 1216 |
-
|
| 1217 |
-
if ($('order-
|
| 1218 |
-
|
| 1219 |
-
|
| 1220 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1221 |
}
|
| 1222 |
},
|
| 1223 |
observeAdminCustomerAddress: function ()
|
|
@@ -1246,7 +1324,7 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 1246 |
}
|
| 1247 |
}
|
| 1248 |
},
|
| 1249 |
-
|
| 1250 |
{
|
| 1251 |
var pcnlapi = this;
|
| 1252 |
// Billing
|
|
@@ -1262,19 +1340,15 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 1262 |
});
|
| 1263 |
if ($('order-billing_address_country_id').getValue() == 'NL')
|
| 1264 |
this.toggleCountryPostcode('order-billing_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
|
| 1265 |
-
|
|
|
|
|
|
|
| 1266 |
{
|
| 1267 |
-
|
| 1268 |
-
|
| 1269 |
-
type: e.type,
|
| 1270 |
-
currentTarget: $('order-billing_address_street0'),
|
| 1271 |
-
target: $('order-billing_address_street0')
|
| 1272 |
-
};
|
| 1273 |
-
order.changeAddressField(event);
|
| 1274 |
-
});
|
| 1275 |
}
|
| 1276 |
},
|
| 1277 |
-
|
| 1278 |
{
|
| 1279 |
var pcnlapi = this;
|
| 1280 |
// Shipping
|
|
@@ -1287,6 +1361,12 @@ document.observe("dom:loaded", PCNL_START_FUNCTION = function()
|
|
| 1287 |
$('order-shipping_address_country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3'); });
|
| 1288 |
if ($('order-shipping_address_country_id').getValue() == 'NL')
|
| 1289 |
pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1290 |
}
|
| 1291 |
}
|
| 1292 |
};
|
| 53 |
*/
|
| 54 |
enrichType: 'Unknown',
|
| 55 |
|
| 56 |
+
/*
|
| 57 |
+
* List of supported / recognized checkout extensions.
|
| 58 |
+
*/
|
| 59 |
+
enrichTypes: {
|
| 60 |
+
'Unknown': 0,
|
| 61 |
+
'Basic': 1,
|
| 62 |
+
'Admin': 2,
|
| 63 |
+
'OneStepCheckout.com': 3,
|
| 64 |
+
'Apptha One Step Checkout': 4,
|
| 65 |
+
'MageStore One Step Checkout': 5,
|
| 66 |
+
'GoMage LightCheckout': 6,
|
| 67 |
+
'MageWorld One Step Checkout Pro': 7,
|
| 68 |
+
'AheadWorks One Step Checkout': 8,
|
| 69 |
+
'J2T OneCheckout': 9,
|
| 70 |
+
'Aitoc One Step Checkout Manager': 10,
|
| 71 |
+
'Magento Templates - OnePage Magento Checkout': 11,
|
| 72 |
+
'EcommerceTeam Easy Checkout 2': 12,
|
| 73 |
+
'GrafischDirect One Step Checkout': 13,
|
| 74 |
+
'FME One Step Checkout': 14,
|
| 75 |
+
'IWD Free One Page / Step Checkout v2': 15,
|
| 76 |
+
'IWD Free One Page / Step Checkout v3': 16,
|
| 77 |
+
'Fire Checkout': 17,
|
| 78 |
+
'Quick One Page Checkout (by KAM)': 18,
|
| 79 |
+
'MAGExtended MasterCheckout': 19,
|
| 80 |
+
'Customer Address Form': 20,
|
| 81 |
+
},
|
| 82 |
+
enrichHint: null,
|
| 83 |
+
|
| 84 |
/**
|
| 85 |
* Hide multiple field-rows in forms
|
| 86 |
*/
|
| 287 |
// Make uppercase to prevent double, but identical, requests
|
| 288 |
postcode = postcode.toUpperCase();
|
| 289 |
|
| 290 |
+
var et = this.enrichTypes[this.enrichType] ? this.enrichTypes[this.enrichType] : this.enrichHint;
|
| 291 |
+
|
| 292 |
+
var url = PCNLAPI_CONFIG.baseUrl +'lookup?postcode=' + postcode + '&houseNumber=' + housenumber + '&houseNumberAddition=' + housenumber_addition + '&et=' + encodeURIComponent(et);
|
| 293 |
if (this.requestCache[url] === undefined)
|
| 294 |
{
|
| 295 |
new Ajax.Request(url,
|
| 487 |
this.removeHousenumberAddition(prefix);
|
| 488 |
}
|
| 489 |
|
|
|
|
|
|
|
| 490 |
// Add support for syncing Billing & Shipping
|
| 491 |
if (prefix == 'billing:' && $('shipping:' + postcodeFieldId)) {
|
| 492 |
// 'shipping' is a global object created on most checkout pages
|
| 516 |
if ($(prefix + countryFieldId).getValue() == 'NL')
|
| 517 |
{
|
| 518 |
// The Netherlands is selected - add our own validated inputs.
|
| 519 |
+
this.enrichHint = $(document.body).className.trim().replace(' ', ',');
|
| 520 |
|
| 521 |
if (!$(prefix +'postcode_input:wrapper'))
|
| 522 |
{
|
| 886 |
$(prefix + 'telephone-moved').insert(clone);
|
| 887 |
}
|
| 888 |
}
|
| 889 |
+
else if ($(document.body).hasClassName('opc-index-index'))
|
| 890 |
+
{
|
| 891 |
+
// IWD Free One Page / Step Checkout v3
|
| 892 |
+
this.enrichType = 'IWD Free One Page / Step Checkout v3';
|
| 893 |
+
|
| 894 |
+
if (!$(prefix +'postcode_input:info'))
|
| 895 |
+
{
|
| 896 |
+
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="wide pcnl-info"><div><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text" id="' + prefix + 'postcode_input:info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
|
| 897 |
+
}
|
| 898 |
+
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="fields"><div class="field input-postcode"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em class="required">*</em></label><div class="input-box"><div class="field-wrapper"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" name="' + prefix + 'postcode_input" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div></div><div class="field input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em class="required">*</em></label><div class="input-box"><div class="field-wrapper"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="' + prefix + 'postcode_housenumber" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></div></li>'});
|
| 899 |
+
if (!$(prefix +'postcode_input:checkbox'))
|
| 900 |
+
{
|
| 901 |
+
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="wide control pcnl-manual-checkbox"><div class="fields"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox " /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
|
| 902 |
+
|
| 903 |
+
$(prefix + 'postcode_input_checkbox').observe('click', function () { pcnlapi.toggleCountryPostcode(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4); });
|
| 904 |
+
}
|
| 905 |
+
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:output" class="wide pcnl-hidden-field"><div><label>'+ PCNLAPI_CONFIG.translations.outputLabel +'</label><div id="' + prefix + 'postcode_output" class="pcnl-address-text"></div></div></li>'});
|
| 906 |
+
}
|
| 907 |
else
|
| 908 |
{
|
| 909 |
// Support for regular Magento 'one page' checkout
|
| 910 |
// + Fire Checkout
|
| 911 |
// + Quick One Page Checkout (by KAM)
|
| 912 |
// + MAGExtended MasterCheckout
|
|
|
|
| 913 |
|
| 914 |
if ($(document.body).hasClassName('firecheckout-index-index'))
|
| 915 |
this.enrichType = 'Fire Checkout';
|
| 917 |
this.enrichType = 'Quick One Page Checkout (by KAM)';
|
| 918 |
else if ($(document.body).hasClassName('mastercheckout-index-index'))
|
| 919 |
this.enrichType = 'MAGExtended MasterCheckout';
|
|
|
|
|
|
|
| 920 |
else if ($(document.body).hasClassName('checkout-onepage-index'))
|
| 921 |
this.enrichType = 'Basic';
|
| 922 |
else if ($(document.body).hasClassName('customer-address-form'))
|
| 923 |
this.enrichType = 'Customer Address Form';
|
| 924 |
else
|
| 925 |
+
this.enrichType = 'Unknown';
|
| 926 |
|
| 927 |
if (!$(prefix +'postcode_input:info'))
|
| 928 |
{
|
| 929 |
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:info" class="wide pcnl-info"><div><label class="pcnl-info-label">'+ PCNLAPI_CONFIG.translations.infoLabel +'</label><div class="pcnl-info-text" id="' + prefix + 'postcode_input:info-text">'+ PCNLAPI_CONFIG.translations.infoText +'</div></div></li>'});
|
| 930 |
}
|
| 931 |
+
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:wrapper" class="fields"><div class="field input-postcode"><label for="' + prefix + 'postcode_input" class="required">'+ PCNLAPI_CONFIG.translations.postcodeInputLabel +'<em class="required">*</em></label><div class="input-box"><div class="field-wrapper"><input type="text" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input" value="" class="input-text required-entry" /></div></div></div><div class="field input-postcode pcnl-input-housenumber"><label for="' + prefix + 'postcode_housenumber" class="required">'+ PCNLAPI_CONFIG.translations.houseNumberLabel +' <em class="required">*</em></label><div class="input-box"><div class="field-wrapper"><input type="text" title="'+ PCNLAPI_CONFIG.translations.houseNumberTitle +'" name="' + prefix + 'postcode_housenumber" id="' + prefix + 'postcode_housenumber" value="" class="input-text pcnl-input-text-half required-entry" /></div></div></div></li>'});
|
| 932 |
if (!$(prefix +'postcode_input:checkbox'))
|
| 933 |
{
|
| 934 |
$(prefix + street1).up('li').insert({before: '<li id="' + prefix + 'postcode_input:checkbox" class="wide control pcnl-manual-checkbox"><div class="fields"><div class="input-box"><input type="checkbox" title="'+ PCNLAPI_CONFIG.translations.postcodeInputTitle +'" id="' + prefix + 'postcode_input_checkbox" value="" class="checkbox " /><label for="' + prefix + 'postcode_input_checkbox">'+ PCNLAPI_CONFIG.translations.manualInputText +'</label></div></div></li>'});
|
| 1034 |
*/
|
| 1035 |
toggleAddressFields: function(prefix, postcodeFieldId, countryFieldId, street1, street2, street3, street4, values)
|
| 1036 |
{
|
| 1037 |
+
// Should not happen, but may occur if things go half-awry
|
| 1038 |
+
if (!$(prefix + 'postcode_input_checkbox'))
|
| 1039 |
+
return;
|
| 1040 |
+
|
| 1041 |
if (!$(prefix + 'postcode_input_checkbox').checked)
|
| 1042 |
{
|
| 1043 |
this.setFieldsReadonly([
|
| 1178 |
this.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
|
| 1179 |
}
|
| 1180 |
}
|
| 1181 |
+
|
| 1182 |
+
// Some extensions evade 'observe' by setting directly on elements when toggling shipping
|
| 1183 |
+
if ($('billing:country_id') && $('shipping:country_id'))
|
| 1184 |
+
{
|
| 1185 |
+
if ($('billing:use_for_shipping_yes'))
|
| 1186 |
+
{
|
| 1187 |
+
$('billing:use_for_shipping_yes').observe('click', function () {
|
| 1188 |
+
pcnlapi.toggleCountryPostcode('billing:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
|
| 1189 |
+
pcnlapi.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
|
| 1190 |
+
});
|
| 1191 |
+
}
|
| 1192 |
+
if ($('billing:use_for_shipping_no'))
|
| 1193 |
+
{
|
| 1194 |
+
$('billing:use_for_shipping_no').observe('click', function () {
|
| 1195 |
+
pcnlapi.toggleCountryPostcode('billing:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
|
| 1196 |
+
pcnlapi.toggleCountryPostcode('shipping:', 'postcode', 'country_id', 'street1', 'street2', 'street3', 'street4');
|
| 1197 |
+
});
|
| 1198 |
+
}
|
| 1199 |
+
}
|
| 1200 |
}
|
| 1201 |
if ($('shipping:country_id'))
|
| 1202 |
{
|
| 1277 |
// Admin 'create order' & 'edit order' address editting
|
| 1278 |
if ($('order-billing_address'))
|
| 1279 |
{
|
| 1280 |
+
var recursionDetection = false;
|
| 1281 |
+
this.observeAdminBillingAddress();
|
| 1282 |
+
this.observeAdminShippingAddress();
|
| 1283 |
+
|
| 1284 |
+
if ($('order-data'))
|
| 1285 |
+
{
|
| 1286 |
+
$('order-data').observe('DOMNodeInserted', function(e) {
|
| 1287 |
+
if (event.target.nodeName == 'DIV')
|
| 1288 |
+
{
|
| 1289 |
+
if (!recursionDetection)
|
| 1290 |
+
{
|
| 1291 |
+
recursionDetection = true;
|
| 1292 |
+
pcnlapi.observeAdminBillingAddress();
|
| 1293 |
+
pcnlapi.observeAdminShippingAddress();
|
| 1294 |
+
recursionDetection = false;
|
| 1295 |
+
}
|
| 1296 |
+
}
|
| 1297 |
+
});
|
| 1298 |
+
}
|
| 1299 |
}
|
| 1300 |
},
|
| 1301 |
observeAdminCustomerAddress: function ()
|
| 1324 |
}
|
| 1325 |
}
|
| 1326 |
},
|
| 1327 |
+
observeAdminBillingAddress: function ()
|
| 1328 |
{
|
| 1329 |
var pcnlapi = this;
|
| 1330 |
// Billing
|
| 1340 |
});
|
| 1341 |
if ($('order-billing_address_country_id').getValue() == 'NL')
|
| 1342 |
this.toggleCountryPostcode('order-billing_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
|
| 1343 |
+
|
| 1344 |
+
// Use custom Magento 'changeUpdater' hook as well, because 'change' observe sometimes is not called...
|
| 1345 |
+
$('order-billing_address_country_id').changeUpdater = function ()
|
| 1346 |
{
|
| 1347 |
+
pcnlapi.toggleCountryPostcode('order-billing_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
|
| 1348 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1349 |
}
|
| 1350 |
},
|
| 1351 |
+
observeAdminShippingAddress: function ()
|
| 1352 |
{
|
| 1353 |
var pcnlapi = this;
|
| 1354 |
// Shipping
|
| 1361 |
$('order-shipping_address_country_id').observe('change', function () { pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3'); });
|
| 1362 |
if ($('order-shipping_address_country_id').getValue() == 'NL')
|
| 1363 |
pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
|
| 1364 |
+
|
| 1365 |
+
// Use custom Magento 'changeUpdater' hook as well, because 'change' observe sometimes is not called...
|
| 1366 |
+
$('order-shipping_address_country_id').changeUpdater = function ()
|
| 1367 |
+
{
|
| 1368 |
+
pcnlapi.toggleCountryPostcode('order-shipping_address_', 'postcode', 'country_id', 'street0', 'street1', 'street2', 'street3');
|
| 1369 |
+
};
|
| 1370 |
}
|
| 1371 |
}
|
| 1372 |
};
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>PostcodeNl_Api</name>
|
| 4 |
-
<version>1.1.
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>Simplified BSD License</license>
|
| 7 |
<channel>community</channel>
|
|
@@ -16,20 +16,15 @@
|
|
| 16 |

|
| 17 |
The postcode Magento plugin from Postcode.nl is free of charge, based on a Fair-Use policy. The use of the Postcode.nl Magento plugin is subject to our Terms and Conditions.</description>
|
| 18 |
<notes>Fixes:
|
| 19 |
-
-
|
| 20 |
-
-
|
| 21 |
-
- Corrected some checkout extension detection
|
| 22 |
-
- Editing roles/rights in admin would fail
|
| 23 |
-
Added provisional support for the following checkout modules:
|
| 24 |
-
- MAGExtentended MasterCheckout
|
| 25 |
Features:
|
| 26 |
-
-
|
| 27 |
-
- Tweaked compatibility with Magento 1.9
|
| 28 |
</notes>
|
| 29 |
<authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
|
| 30 |
-
<date>2014-
|
| 31 |
-
<time>
|
| 32 |
-
<contents><target name="magecommunity"><dir name="PostcodeNl"><dir name="Api"><dir name="Block"><file name="Jsinit.php" hash="79bb826a50ce0cf4f87cc2f958bfafa1"/></dir><dir name="Helper"><file name="Data.php" hash="
|
| 33 |
<compatible/>
|
| 34 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min>7.10.5</min><max>7.99.0</max></extension></required></dependencies>
|
| 35 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>PostcodeNl_Api</name>
|
| 4 |
+
<version>1.1.2.0</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>Simplified BSD License</license>
|
| 7 |
<channel>community</channel>
|
| 16 |

|
| 17 |
The postcode Magento plugin from Postcode.nl is free of charge, based on a Fair-Use policy. The use of the Postcode.nl Magento plugin is subject to our Terms and Conditions.</description>
|
| 18 |
<notes>Fixes:
|
| 19 |
+
- Better support IWD One Step Checkout
|
| 20 |
+
- Better support for updates in admin
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
Features:
|
| 22 |
+
- Detection of checkout type, for better future checkout extension support
|
|
|
|
| 23 |
</notes>
|
| 24 |
<authors><author><name>Postcode.nl Technical Support</name><user>TechPostcodeNl</user><email>tech@postcode.nl</email></author></authors>
|
| 25 |
+
<date>2014-10-09</date>
|
| 26 |
+
<time>13:13:10</time>
|
| 27 |
+
<contents><target name="magecommunity"><dir name="PostcodeNl"><dir name="Api"><dir name="Block"><file name="Jsinit.php" hash="79bb826a50ce0cf4f87cc2f958bfafa1"/></dir><dir name="Helper"><file name="Data.php" hash="08fc025ba86655de3de7c69ad1d1c68d"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="PcnlController.php" hash="1a8eaf87ed60481f51f3f74eab3ab63f"/></dir><file name="JsonController.php" hash="6a3bff054e3229faaae2aa55f9a3cf3c"/></dir><dir name="data"><dir name="postcodenl_api_setup"><file name="data-upgrade-1.0.8.0-1.1.0.0.php" hash="e0acdb124cf735198c021f0c827c82bc"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="5d518aeaeae028b6299c7cf3d6e54f60"/><file name="config.xml" hash="a4c135d9cc949f452aac80d59522945b"/><file name="system.xml" hash="b92863ff806bd444125e4a829ecdc24c"/></dir></dir></dir></target><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="e8f6295a91c9c5bfd116ae1048a5445d"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="8623676f4c6f4068d0b51e31dcfa08e9"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="88c6556ea3cc3b3c6746021e8636a24c"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="ff32e12bbc26e4414dd8ca76edc4ed0f"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="layout"><dir name="postcodenl"><dir name="api"><file name="lookup.xml" hash="88c6556ea3cc3b3c6746021e8636a24c"/></dir></dir></dir><dir name="template"><dir name="postcodenl"><dir name="api"><file name="jsinit.phtml" hash="ff32e12bbc26e4414dd8ca76edc4ed0f"/></dir></dir></dir></dir></dir></dir></target><target name="magelocale"><dir name="en_US"><file name="PostcodeNl_Api.csv" hash="0f85a94e876ec148734c556d9cf363a3"/></dir><dir name="nl_NL"><file name="PostcodeNl_Api.csv" hash="51fa45866ef7461769058d9c83d21766"/></dir></target><target name="mageweb"><dir name="js"><dir name="postcodenl"><dir name="api"><file name="lookup.js" hash="892ba29a3403c12f499ba109331bd52d"/></dir></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c58103b505f8bcdf55cea1159ca21e27"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c6ffbeceb6907b2e8463d1ff30810304"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir><dir name="base"><dir name="default"><dir name="postcodenl"><dir name="api"><dir name="css"><file name="lookup.css" hash="c6ffbeceb6907b2e8463d1ff30810304"/></dir><dir name="images"><file name="postcode-logo.png" hash="da02bc29be1057a0201e63f81ee4bd02"/></dir></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="PostcodeNl_Api.xml" hash="feeaf95128ffe4ad109ed8b0b8bc85ab"/></dir></target></contents>
|
| 28 |
<compatible/>
|
| 29 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php><extension><name>curl</name><min>7.10.5</min><max>7.99.0</max></extension></required></dependencies>
|
| 30 |
</package>
|
