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>
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();"
|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.