Jump to content
thirty bees forum
  • 0

Javasript error when adding or removing goods in BO


Question

Posted

When I add or remove an item to a BO order I get the following Javascript error:

In Chromium 79.0.3945.79 (Официальная сборка), Built on Ubuntu , running on Ubuntu 18.04 (64 бит)

or Windows 7 Google Chrome 79.0.3945.130

jquery-1.11.0.min.js?ts=1564066310:3 Uncaught TypeError: Cannot read property 'createDocumentFragment' of undefined
    at eb (jquery-1.11.0.min.js?ts=1564066310:3)
    at Function.buildFragment (jquery-1.11.0.min.js?ts=1564066310:3)
    at e.fn.init.domManip (jquery-1.11.0.min.js?ts=1564066310:3)
    at e.fn.init.append (jquery-1.11.0.min.js?ts=1564066310:3)
    at Object.<anonymous> (orders.js?ts=1580215242:59)
    at Function.each (jquery-1.11.0.min.js?ts=1564066310:2)
    at HTMLSelectElement.<anonymous> (orders.js?ts=1580215242:52)
    at Function.each (jquery-1.11.0.min.js?ts=1564066310:2)
    at e.fn.init.each (jquery-1.11.0.min.js?ts=1564066310:2)
    at updateInvoice (orders.js?ts=1580215242:48)
eb @ jquery-1.11.0.min.js?ts=1564066310:3
buildFragment @ jquery-1.11.0.min.js?ts=1564066310:3
domManip @ jquery-1.11.0.min.js?ts=1564066310:3
append @ jquery-1.11.0.min.js?ts=1564066310:3
(anonymous) @ orders.js?ts=1580215242:59
each @ jquery-1.11.0.min.js?ts=1564066310:2
(anonymous) @ orders.js?ts=1580215242:52
each @ jquery-1.11.0.min.js?ts=1564066310:2
each @ jquery-1.11.0.min.js?ts=1564066310:2
updateInvoice @ orders.js?ts=1580215242:48
success @ orders.js?ts=1580215242:557
j @ jquery-1.11.0.min.js?ts=1564066310:2
fireWith @ jquery-1.11.0.min.js?ts=1564066310:2
x @ jquery-1.11.0.min.js?ts=1564066310:4
b @ jquery-1.11.0.min.js?ts=1564066310:4
XMLHttpRequest.send (async)
send @ jquery-1.11.0.min.js?ts=1564066310:4
ajax @ jquery-1.11.0.min.js?ts=1564066310:4
(anonymous) @ orders.js?ts=1580215242:542
dispatch @ jquery-1.11.0.min.js?ts=1564066310:3
r.handle @ jquery-1.11.0.min.js?ts=1564066310:3

In Firefox 72.0.1 (64-bit) on Ubuntu 18.10:

TypeError: a is undefinedjquery-1.11.0.min.js:3:15071
    jQuery 4
        eb
        buildFragment
        domManip
        append
    updateInvoice http://tb110.local/js/admin/orders.js?ts=1580215242:59
    each jQuery
    updateInvoice http://tb110.local/js/admin/orders.js?ts=1580215242:52
    jQuery 2
        each
        each
    updateInvoice http://tb110.local/js/admin/orders.js?ts=1580215242:48
    success http://tb110.local/js/admin/orders.js?ts=1580215242:557
    jQuery 4
        j
        fireWith
        x
        b

My shop is Thirtybees 1.1.x Bleeding Edge last release. Files are not modified.

Someone can check the addition or removal of goods in your order.

2 answers to this question

Recommended Posts

  • 0
Posted

This is probably the wrong context for "this" inside the "each" function. If you return it as it was in Prestashop, then there will be no error:

function updateInvoice(invoices) {
  // Update select on product edition line
  $('.edit_product_invoice').each(function () {
    var selected = $(this).children('option:selected').val();

    $(this).children('option').remove();
    //$.each(invoices, function (i) {
    for(i in invoices) {
      // Create new option
      var option = $('<option>' + invoices[i].name + '</option>').attr('value', invoices[i].id);
      if (invoices[i].id === selected) {
        option.attr('selected', true);
      }

      $(this).append(option);
    }
    //});
  });

  // Update select on product addition line
  $('#add_product_product_invoice').each(function () {
    var parent = $(this).children('optgroup.existing');
    parent.children('option').remove();
    $.each(invoices, function (i) {
      // Create new option
      var option = $('<option>' + invoices[i].name + '</option>').attr('value', invoices[i].id);

      parent.append(option);
    });
    parent.children('option:first').attr('selected', true);
  });

  // Update select on product addition line
  $('#payment_invoice').each(function () {
    $(this).children('option').remove();
    //$.each(invoices, function (i) {
    for(i in invoices) {
      // Create new option
      var option = $('<option>' + invoices[i].name + '</option>').attr('value', invoices[i].id);

      $(this).append(option);
    }
    //});
  });
}

 

Whoever knows Javascript can confirm this?

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...