We have 2 buttons in product view page
1)Create - create product programtically
2)Add to cart - Add product to cart & creating product programatically.
Issue is we dont need to create product once click on "Add to cart"
create button code
<button id="submit-editorApply-{{rand}}" onclick="return setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\', event);setrequestlogin();" >
create
</button>
Add to cart
<button onclick="productAddToCartForm.submit(this)" id="submit-editorApply-add-to-cart">
Add to cart>
</button>
related code
initObservers: function()
{
if (this.config.editorEnabled) {
$('submit-editorApply-' + this.config.rand).observe('click', this.saveDesignBut.bindAsEventListener(this));
$('submit-editorApply-add-to-cart').observe('click', this.submitApply.bindAsEventListener(this));
}
},
submitApply: function(event)
{
Event.stop(event);
this.option.apply();
if(window.productAddToCartForm == 'undefined') {
var productAddToCartForm = new VarienForm('product_addtocart_form');
} else {
var productAddToCartForm = window.productAddToCartForm;
}
productAddToCartForm.submit();
},
Update
once i remove function : submitApply: function(event)
[see full function above ] , than Add to cart button will not create any product. but after that, we need to click on create
button to click on Add to cart
, otherwise Add to cart
will not work....
update 2
when i hide this code : $('submit-editorApply-add-to-cart').observe('click', this.submitApply.bindAsEventListener(this));
& removed aitcg-required
, than both features will work, but one more issue will create that once we click directly on add to cart [ without click on create] button, than in cart page, we dont see custom image :