2

Using the quick-create-product option on Configurable Products gives an error. An AJAX call is made, the product is created but the JSON response is wrong. So the 'Please wait' overlay stays and the site appears to be frozen. It is supposed to return:

{attributes: [{label: "Koper", value_index: "65", attribute_id: "136"}],…}

Which it does, on my local machine. But the live code returns an additional wrapper around the JSON response:

sitename_store2_idx2sitename_default_idx2sitename_store3_idx1{attributes: [{label: "Koper", value_index: "65", attribute_id: "136"}],…}

The codes of three store views in the website are in the name of that wrapper, with 'sitename_' and '_idx2' around it.

After that the response is managed by JavaScript code like so:

result.attributes.each(function(attribute)){...}

But since there is no result.attributes it does not work. The overlay remains and the loading gif stays visible so no buttons work either.

My local machine and the server are both on HEAD so it is the same code. I could make a JavaScript workaround but that's a dirty solution. For the time being I suggested using the regular 'create related item' but it still needs solving. Does anyone know what could cause this?

  • Go check your code at Mage_Adminhtml_Catalog_ProductController::quickCreateAction(): see if the extra string is part of $result. return; at different points inside the method to see where it's being injected. – pong Nov 14 '16 at 14:28
0

If anyone is still wondering, I've made a workaround in JavaScript. In js/mage/adminhtml/product.js where the JSON is handled I've added this code:

result = result.substring(result.indexOf('{"attributes"'), result.length);

It selects the {attributes} part from the result so the extra wrapper is removed. It works fine for now.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.