user can upload image and text on product image, after that user muct click on custom button "save design" , after that only onclick "Add to cart" button will add item to cart. but we want to remove that validation for add to cart button.
What i need is Once user upload image or text and if user click on "Add to cart", it should add item to cart.
We have below code for "save design"
_getControlPanelHtml: function()
{
if (this.config.editorEnabled) {
return '<div id="aitcg-control-panel">' +
'<button id="submit-editorApply-{{rand}}" >SAVE DESIGN</button>' +
'<button >Reset</button>' +
'</div>';
}
return '';
},
initObservers: function()
{
if (this.config.editorEnabled) {
$('submit-editorApply-' + this.config.rand).observe('click', this.submitApply.bindAsEventListener(this));
$('submit-editorReset-' + this.config.rand).observe('click', this.submitReset.bindAsEventListener(this));
}
},
submitApply: function(event)
{
Event.stop(event);
this.option.apply();
},
I tried below code , now "Add to cart" is working without clicking "save design", but after clicking "save design", than "Add to cart" is not working.
<script>
initObservers: function()
{
if (this.config.editorEnabled) {
$('submit-editorApply-' + this.config.rand).observe('click', this.submitApply.bindAsEventListener(this));
$('submit-editorReset-' + this.config.rand).observe('click', this.submitReset.bindAsEventListener(this));
var buttonCart = $$('.btn-cart')[0];
buttonCart.removeAttribute('onclick');
buttonCart.observe('click', this.addToCart.bindAsEventListener(this));
console.log(buttonCart);
}
},
addToCart: function(event)
{
Event.stop(event);
this.submitApply(event);
productAddToCartForm.submit(this)
},
phtml : https://pastebin.com/xeWKNUs4 , script : https://pastebin.com/p8UU7zQ1
Best Answer
You can check function submit of Add to Cart button in ...\app\design\frontend......\template\catalog\product\view.phtml
Check this script:
Change to
Hope it helps.