postcode-nl / PostcodeNl_Api_MagentoPlugin

A Magento plugin 1.9 that implements the Postcode.nl API for Dutch addresses
BSD 2-Clause "Simplified" License
21 stars 12 forks source link

Huisnummer toevoeging wordt niet onthouden. #14

Closed paales closed 9 years ago

paales commented 9 years ago

Na een refresh van de pagina wordt de huisnummer toevoeging niet goed uit het street3 veld gehaald.

Ik zie dat de toevoeging ook in street2 wordt toegevoegd, kan er een optie zijn dat deze in een los veld wordt geplaatst?

paales commented 9 years ago

De eigenlijke vraag is dan: Kan er een optie komen waarmee we de huisnummer toevoegingen in adresregel 3 kunnen opslaan, ipv samenvoegen op regel twee?

DaanBroekhof commented 9 years ago

Deze feature is vaker aangevraagd door andere gebruikers, en al eens (gedeeltelijk) uitgevoerd in een fork.

Ik heb eens eerder een quickhack zo gecommuniceerd naar een gebruiker in mail, maar eigenlijk moet deze netter uitgevoerd worden nog, met een extra admin optie, los van useStreet2AsHouseNumber. (waarschijnlijk useStreet3AsHouseNumberAddition)

In 'js/postcodenl/api/lookup.js':

Regel 970, vervang:

if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
{
    housenumber_match = $(prefix + street2).getValue().match('^('+ this.REGEXP_HOUSENUMBER +')([^0-9a-zA-Z]*('+ this.REGEXP_HOUSENUMBER_ADDITION +'))?\\s*$');
    if (housenumber_match)
    {
        housenumber = housenumber_match[1].trim();
        housenumber_addition = housenumber_match[3] === undefined ? '' : housenumber_match[3].trim();
    }
}

Met:

if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2) && $(prefix + street3))
{
    housenumber = $(prefix + street2).getValue();
    housenumber_addition = $(prefix + street3).getValue();
}

Regel 400, vervang:

if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2))
{
    $(prefix + street1).setValue((data.street).trim());
    $(prefix + street2).setValue((data.houseNumber +' '+ (data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition)).trim());
}

Met:

if (PCNLAPI_CONFIG.useStreet2AsHouseNumber && $(prefix + street2) && $(prefix + street3))
{
    $(prefix + street1).setValue((data.street).trim());
    $(prefix + street2).setValue((data.houseNumber).trim());
    $(prefix + street3).setValue((data.houseNumberAddition ? data.houseNumberAddition : housenumber_addition).trim());
}
paales commented 9 years ago

@DaanBroekhof Met de wijzigingen doorgevoerd zoals je ze hierboven omschreven werkt het nog niet volledig. De toevoeging wordt inderdaad in street3 toegevoegd, echter wordt de waarde van street3 niet in de dropdown toegevoegd.

Als je na het selecteren van de toevoeging het vinkje van Handmatig adres invullen aanzet dan vergeet hij de toevoeging. Ideeën?

paales commented 9 years ago

@DaanBroekhof Nog mogelijkheid gezien om dit op te pakken?

DaanBroekhof commented 9 years ago

I've implemented this, feature will be in next minor version update, which is undergoing testing - will land sometime next week.

paales commented 9 years ago

@DaanBroekhof Great :)

DaanBroekhof commented 9 years ago

This feature is implemented in v1.2.0.0: 8a8429a4f6fc33d83c47b5f1fd45548c05ae7199

paales commented 9 years ago

@DaanBroekhof Still some errors, http://cl.ly/2Q0A3H2n3H3L

        var fields = this.content.select('input', 'select', 'textarea');
        for (var i = 0, l = fields.length; i < l; i ++) {
            if (fields[i].hasClassName('no-autosubmit')) {
                continue;
            }

            fields[i].observe('change', this.onChange);
        }

It it maybe possible to trigger this event when you change the input fields. This properly triggers the CheckItOut module and will thus fix the second bug.

DaanBroekhof commented 9 years ago

Ah I'll take a look at it. Thanks for the clear video-bug report. :D

paales commented 9 years ago

@DaanBroekhof Did you have the time to take a look?

DaanBroekhof commented 9 years ago

Unfortunately due to the busy holidays & vacation I haven't looked at this yet, will do this week.

DaanBroekhof commented 9 years ago

I have investigated your errors, and both issues are not the direct result of the implementation this feature (adding the third-street-field-for-suffix option), they existed before this feature too - so I will handle them in separate issues:

"Housenumber additions are re-checked on page load": https://github.com/postcode-nl/PostcodeNl_Api_MagentoPlugin/issues/18

"Not all fields are triggered via events when the extension changes their values": https://github.com/postcode-nl/PostcodeNl_Api_MagentoPlugin/issues/19

Let me know if you disagree, or have other issues specifically related to the implementation of this feature. (will close this thread otherwise)

DaanBroekhof commented 9 years ago

This feature was resolved. The other issues are still open. (see https://github.com/postcode-nl/PostcodeNl_Api_MagentoPlugin/issues/14#issuecomment-69050087)