0

we have below code and its creating new Product once registered user click on button "create"

_getControlPanelHtml: function()
 {
 if (this.config.editorEnabled) {
 return '<div id="aitcg-control-panel">' +
 '<button onclick="return setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\', event);setrequestlogin();" id="submit-editorApply-{{rand}}" >Create</button>' +
 '</div>';
 }
 return '';
 },

we are trying to apply if else conditions and adding below code for creating new product after guest click on "create" button and login to site. but it showing blank page

<script>
<?php if($customerId){?>
_getControlPanelHtml: function()
 {
 if (this.config.editorEnabled) {
 return '<div id="aitcg-control-panel">' +
 '<button onclick="return setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\', event);setrequestlogin();" id="submit-editorApply-{{rand}}" >Create</button>' +
 '</div>';
 }
 return '';
 },
<?php }else{?>
_getControlPanelHtml: function()
 {
 if (this.config.editorEnabled) {
 return '<div id="aitcg-control-panel">' +
 '<button onclick=" setproductlogin('<?php echo $_product->getEntityId()?>');setrequestlogin();" id="submit-editorApply-{{rand}}" >Create</button>' +
 '</div>';
 }
 return '';
 },
 <?php }?>
</script>
asked Apr 6, 2017 at 7:12

1 Answer 1

1

Replacing below code :

onclick="setproductlogin('<?php echo $_product->getEntityId()?>');setrequestlogin();"

by below code solved issue :

onclick="return setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\', event);setrequestlogin();"
answered Apr 6, 2017 at 7:53

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.