Jump to content

Editing core.js for product combinations refresh

Recommended Posts

PS 1.7.5 
In the product.tpl there is the <form> to add to the cart the product with its combinations. Inside this form I'm using accordion to show and hide each step of customization (color, size, and other customizations). The problem is that all the inputs don't stay selected, there is a mini-refresh and it turns empty. I click for eg. color and immediatly after the click it's unselected, same for the others. 
I have to edit the core.js to have this result:
for the input inside the form > no refresh, the inputs stay selected, but the product image, must change with the combination selected in the form.
core line 233:

("body").on("change touchspin.on.startspin",".product-variants *[name]",function(e){i.default.emit("updateProduct",{eventType:"updatedProductCombination",event:e,resp:{},reason:{productUrl:i.default.urls.pages.product||""}})}),(0,r.default)("body").on("click",".product-refresh",function(e,t){e.preventDefault();var n="updatedProductCombination";void 0!==t&&t.eventType&&(n=t.eventType),i.default.emit("updateProduct",{eventType:n,event:e,resp:{},reason:{productUrl:i.default.urls.pages.product||""}})}),i.default.on("updateProduct",function(e){var t=e.eventType,n=e.event;(function(){var e=r.default.Deferred(),t=(0,r.default)(".product-actions"),n=(0,r.default)("#quantity_wanted");if(null!==i.default&&null!==i.default.urls&&null!==i.default.urls.pages&&""!==i.default.urls.pages.product&&null!==i.default.urls.pages.product)return e.resolve(i.default.urls.pages.product),e.promise();var o={};return(0,r.default)(t.find("form:first").serializeArray()).each(function(e,t){o[t.name]=t.value}),r.default.ajax({url:t.find("form:first").attr("action"),method:"POST",data:Object.assign({ajax:1,action:"productrefresh",quantity_wanted:n.val()},o),dataType:"json",success:function(t){var n=t.productUrl;i.default.page.canonical=n,e.resolve(n)},error:function(t,n,r){e.reject({jqXHR:t,textStatus:n,errorThrown:r})}}),e.promise()})().done(function(e){return l(n,t,e)}).fail(function(){0===(0,r.default)("section#main > .ajax-error").length&&d((0,r.default)("#product-availability"),"An error occurred while processing your request")})}),i.default.on("updatedProduct",function(e){if(e.product_url&&e.id_product_attribute&&!(0,r.default)

If I deleted this line, the input stay selected but the product image has no refresh and so no update.
Or is there a solution to make inputs stay selected even the form-fresh? Have I to change this line of core.js or are there others solutions?
data-product-attribute > action: "norefresh" or something like this...

Thank for who will help me!

Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More