0

We are using below code in addtocart.phtml to display pop up box once we click on "save design" buttton, its working fine.

<div class="ajaxlogin-login" id="productlistlogin" style="display:none;">Click Here</div>

<div onclick="setproductlogin('<?php echo $_product->getEntityId()?>');setrequestlogin();">
    <button class="button btn-cart">Save design</button>
</div> 

we are using same onclick code for another button present in below phtml file :

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

app/design/frontend/rwd/Theme1/template/aitcg - js_styles1.phtml

<?php $_product = $this->getProduct(); ?>
<div class="ajaxlogin-login" id="productlistlogin" style="display:none;">Click Here</div>

<script>

_getControlPanelHtml: function()
    {
        if (this.config.editorEnabled) {
            return '<div id="aitcg-control-panel">' +
                '<button onclick="setproductlogin('<?php echo $_product->getEntityId()?>');setrequestlogin();" id="submit-editorApply-{{rand}}">save design</button>' +
                '<button>reset</button>' +
                '</div>';
        }
        return '';
    },

    /**
     * Init Apply and Reset buttons events
     */
    initObservers: function()
    {
        if (this.config.editorEnabled) {
            $('submit-editorApply-' + this.config.rand).observe('click', this.submitApply.bindAsEventListener(this));
        }
    },

    submitApply: function(event)
    {
        Event.stop(event);
        this.option.apply();
    },

</script>

but after this Product view page will become blank , There is no errors in log files

enter image description here

Edit

console error after click on "save design" in link

Uncaught SyntaxError: Invalid or unexpected token
  • custom .phtml full code : pastebin.com/MxPmaiE1 – Baby in Magento Mar 20 '17 at 10:35
  • Try with onclick="setproductlogin('<?php echo Mage::registry("current_product")->getId()?>');setrequestlogin();" – Jaimin Sutariya Mar 20 '17 at 10:38
  • @JaiminSutariya now page loaded, but save design button not displaying...... link : site – Baby in Magento Mar 20 '17 at 10:40
  • @JaiminSutariya there is syntax error in console : Uncaught SyntaxError: Unexpected number – Baby in Magento Mar 20 '17 at 10:59
  • in view page source its displaying : <button onclick="setproductlogin('19960');setrequestlogin();" id="submit-editorApply-{{rand}}">save design</button>' //19960 is correct product id – Baby in Magento Mar 20 '17 at 11:09
2

Try with below,

<div onclick="setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\');setrequestlog‌​in();">
    <button class="button btn-cart">Save design</button>
</div> 

It should remove your "Unexpected Number" error.

  • yes, now save design button displaying, but once we click on save design pop up is not displaying...... its adding the product.... – Baby in Magento Mar 20 '17 at 11:13
  • in this code : '<button onclick="setproductlogin(\'<?php echo Mage::registry("current_product")->getId()?>\');setrequestlog‌​in();" id="submit-editorApply-{{rand}}" >save design</button>' + we are using both 1) onclick 2) id="submit-editorApply-{{rand}} , also as you know in some other file once we click on save design we are saving product and creating new image in server..... is it anything like that code is overriding this one ? – Baby in Magento Mar 20 '17 at 11:24
  • I think I am confused about your requirements here. :) – Jaimin Sutariya Mar 20 '17 at 11:40
  • please join : chat.stackexchange.com/rooms/55681/pop-up – Baby in Magento Mar 20 '17 at 11:59
  • @JaiminSutariya My add to cart button not working in CMS Page, could you pls help me to solve this -> justpaste.it/49eqz – Gem Aug 18 '18 at 7:13
1

in your app/design/frontend/rwd/Theme1/template/aitcg - js_styles1.phtml file change below line

instead of

<?php $_product = $this->getProduct(); ?>

try below

<?php $_product = Mage::registry('current_product'); ?>
  • Updated code, now page loaded, but save design button not displaying , showing some console errors : please check : pastebin.com/8WLVfSrP – Baby in Magento Mar 20 '17 at 10:57
  • Thanks a lot for helping me again & again, need your support like this only in upcoming days also..... – Baby in Magento Mar 20 '17 at 14:11

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.