Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi, I got the same problem. I don’t know if it’s due to conflict between plugins or an error. But it’s really annoying if I have to rewrite each rules. Did you find a solution ?

    J’ai unminify le fichier shipping-method.min.js
    ligne 50 :submitForm: function(e)
    Dans la boucle ligne55 : quand r vaut 0 : [name=’pricing-items[” + 0 + ‘][“price-from”]
    ca n’existe pas car le HTMLTableRowElement inspecté vaut pour cette ligne : name=’pricing-items[1][“price-from”], soit l’ancienne position.

    Est ce possible d’avoir de l’aide, un patch?. Je n’ai pas le temps de devoir debugger. les input:name=pricing-items[ x ][..] devraient se raffraichir lorsqu’on drag&drop pour prendre leur nouvelle position ?
    Je fais peut être fausse route, mais c’est urgent, merci

    for (var r = 0; r < n.length; r++) {
                        var i = n[r],
                            o = {
                                "price-from": i.querySelector("[name='pricing-items[" + r + ']["price-from"]\']').value,
                                "price-to": i.querySelector("[name='pricing-items[" + r + ']["price-to"]\']').value,
                                "weight-from": i.querySelector("[name='pricing-items[" + r + ']["weight-from"]\']').value,
                                "weight-to": i.querySelector("[name='pricing-items[" + r + ']["weight-to"]\']').value,
                                "shipping-class": Array.apply(null, i.querySelector("[name='pricing-items[" + r + ']["shipping-class"][]\']').options).filter(function(e) {
                                    return e.selected
                                }).map(function(e) {
                                    return e.value
                                }),
                                "parcel-point-network": Array.apply(null, i.querySelector("[name='pricing-items[" + r + ']["parcel-point-network"][]\']').options).filter(function(e) {
                                    return e.selected
                                }).map(function(e) {
                                    return e.value
                                }),
                                pricing: i.querySelector("[name='pricing-items[" + r + ']["pricing"]\']').value,
                                "flat-rate": i.querySelector("[name='pricing-items[" + r + ']["flat-rate"]\']').value
                            };
                        t.push(o)
                    }
    Thread Starter LaurentAngeli

    (@laurentangeli)

    Well, Boxtal doesn’t seem interested by this bug…
    Looking at js code (thx @yohanndev) i can tell that those selector are more complicated than necessary.
    There is no need to access td with complete name, taking just td which contains price-from or price-to… is enough to get the value.

    So in instruction beginning in line 57, i have replaced every selector from
    querySelector("[name='pricing-items[" + r + ']["price-from"]\']')
    to
    querySelector("[name*='price-from']")
    Like that we don’t care if row have number 0 or 1 or 2 inside its name.

    I give you the whole line 57 to replace :

    o = {
                  "price-from": i.querySelector("[name*='price-from']").value,
                  "price-to": i.querySelector("[name*='price-to']").value,
                  "weight-from": i.querySelector("[name*='weight-from']").value,
                  "weight-to": i.querySelector("[name*='weight-to']").value,
                  "shipping-class": Array.apply(null, i.querySelector("[name*='shipping-class']").options).filter(function(e) {
                    return e.selected
                  }).map(function(e) {
                    return e.value
                  }),
                  "parcel-point-network": Array.apply(null, i.querySelector("[name*='parcel-point-network']").options).filter(function(e) {
                    return e.selected
                  }).map(function(e) {
                    return e.value
                  }),
                  pricing: i.querySelector("[name*='pricing'").value,
                  "flat-rate": i.querySelector("[name*='flat-rate'").value
                };

    Replacing just this line is enough to make re-ordering recorded again.

    I hope that Boxtal will update the plugin fast with this code because i don’t like changes in plugin core files.

    Thread Starter LaurentAngeli

    (@laurentangeli)

    EDIT : Humm, my code don’t work… Flat-rate is not recorded anymore !

    Be careful, i have missed 2 bracket in the previous code…
    Here is the good one :

                o = {
                  "price-from": i.querySelector("[name*='price-from']").value,
                  "price-to": i.querySelector("[name*='price-to']").value,
                  "weight-from": i.querySelector("[name*='weight-from']").value,
                  "weight-to": i.querySelector("[name*='weight-to']").value,
                  "shipping-class": Array.apply(null, i.querySelector("[name*='shipping-class']").options).filter(function(e) {
                    return e.selected
                  }).map(function(e) {
                    return e.value
                  }),
                  "parcel-point-network": Array.apply(null, i.querySelector("[name*='parcel-point-network']").options).filter(function(e) {
                    return e.selected
                  }).map(function(e) {
                    return e.value
                  }),
                  pricing: i.querySelector("[name*='pricing']").value,
                  "flat-rate": i.querySelector("[name*='flat-rate']").value
                };
    • This reply was modified 5 years, 8 months ago by LaurentAngeli.
    Thread Starter LaurentAngeli

    (@laurentangeli)

    Well, there was another error on pricing selector.
    Add brackets [] around ‘pricing’.
    here is the final code which work.

    o={
    "price-from":i.querySelector("[name*='price-from']").value,
    "price-to":i.querySelector("[name*='price-to']").value,
    "weight-from":i.querySelector("[name*='weight-from']").value,
    "weight-to":i.querySelector("[name*='weight-to']").value,
    "shipping-class":Array.apply(null,i.querySelector("[name*='shipping-class']").options).filter(function(e){return e.selected}).map(function(e){return e.value}),
    "parcel-point-network":Array.apply(null,i.querySelector("[name*='parcel-point-network']").options).filter(function(e){return e.selected}).map(function(e){return e.value}),
    pricing:i.querySelector("[name*='[\"pricing\"]']").value,
    "flat-rate":i.querySelector("[name*='flat-rate']").value
    };

    Fantastic, I like internet for this kind of idea sharing. Your code works perfectly. Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Pricing Rules re-order bug in admin’ is closed to new replies.