1

we are creating product programatically once we click on login button.

now we needed to do same after click on register button. so we tried below code, after that now login button is not working , it shows ajax symbol onclick.

template :

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
    <div id="ajaxlogin-create-window" style="display: none;">
        <div class="page-title">
            <span><?php echo $this->__('Create an Account') ?></span>
        </div>
        <form action="<?php echo $this->getUrl('example/amasty/createSimpleProductAndRedirect1', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'), 'id' => Mage::registry('current_product')->getId())) ?>" id="ajaxlogin-login-form">
            <?php echo $this->getChildHtml(); ?>
        </form>
        <script type="text/javascript">
            //<![CDATA[
            var ajaxCreateForm = new VarienForm('ajaxlogin-create-form', true);
            //]]>
        </script>
    </div>
<?php endif; ?>

you can see file here

enter image description here

3
  • Seems you are getting an error. Check errors under chrome developer tools. Commented Apr 23, 2017 at 5:49
  • @BGKavinga i am checking now, thanks......
    – raj
    Commented Apr 23, 2017 at 5:51
  • @BGKavinga i apprecite your help, i got solution.....
    – raj
    Commented Apr 25, 2017 at 16:07

1 Answer 1

1
<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
    <div id="ajaxlogin-forgot-window" style="display: none;">
        <div class="page-title">
            <span><?php echo $this->__('Forgot Your Password?') ?></span>
        </div>
        <form action="<?php echo $this->getUrl('productlike/index/forgotpassword', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-forgot-password-form">
            <div class="content">
                <?php
                $customerHelper = Mage::helper('customer');
                if (method_exists($customerHelper, 'generateResetPasswordLinkToken')) : ?>
                    <p><?php echo $this->__('Please enter your email address below. You will receive a link to reset your password.') ?></p>
                <?php else: ?>
                    <p><?php echo $this->__('Please enter your email below and we will send you a new password.') ?></p>
                <?php endif; ?>
                <ul class="form-list">
                    <li>
                        <label for="email_address" class="required"><em>*</em><?php echo $this->__('Email Address') ?></label>
                        <div class="input-box">
                            <input type="text" name="email" id="email_address" class="input-text required-entry validate-email" value="<?php echo $this->htmlEscape($this->getEmailValue()) ?>" />
                        </div>
                    </li>
                    <?php echo $this->getChildHtml('form.additional.info'); ?>
                </ul>
            </div>
            <div class="buttons-set">
                <button type="submit" title="<?php echo $this->__('Submit') ?>" id="btn-forgot" class="button"><span><span><?php echo $this->__('Submit') ?></span></span></button>
                <div class="progress-indicator">
                    <span class="please-wait" id="forgot-please-wait" style="display:none;">
                        <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt=""/>
                    </span>
                </div>
                <p class="back-link"><a href="<?php echo $this->helper('customer')->getLoginUrl() ?>" class="ajaxlogin-login"><?php echo $this->__('Back to Login') ?></a></p>
            </div>
        </form>
        <script type="text/javascript">
            //<![CDATA[
            var ajaxForgotForm = new VarienForm('ajaxlogin-forgot-password-form', true);
            //]]>
        </script>
    </div>
<?php endif; ?>

<?php if (!Mage::getSingleton('customer/session')->isLoggedIn()): ?>
    <div id="ajaxlogin-create-window" style="display: none;">
        <div class="page-title">
            <span><?php echo $this->__('Create an Account') ?></span>
        </div>
        <form action="<?php echo $this->getUrl('productlike/index/create', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-create-form">
            <?php echo $this->getChildHtml(); ?>
        </form>
        <script type="text/javascript">
            //<![CDATA[
            var ajaxCreateForm = new VarienForm('ajaxlogin-create-form', true);
            //]]>
        </script>
    </div>
<?php endif; ?>

<?php if (Mage::getSingleton('customer/session')->isLoggedIn()): ?>
    <div id="ajaxlogin-logout-window" style="display: none;">
        <div class="page-title">
            <span><?php echo $this->__('Logout from your Account') ?></span>
        </div>
        <form action="<?php echo $this->getUrl('ajaxlogin/index/logout', array('_secure'=>(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS']==='on'))) ?>" method="post" id="ajaxlogin-logout-form">
            <div class="content">
               <p><?php echo $this->__('Are you sure you want to log out ?') ?></p>
            </div>
            <div class="buttons-set">
                <button type="submit" class="button" title="<?php echo $this->__('Login') ?>" name="send" id="send2"><span><span><?php echo $this->__('Logout') ?></span></span></button>
                <div class="progress-indicator">
                    <span class="please-wait" id="login-please-wait" style="display:none;">
                        <img src="<?php echo $this->getSkinUrl('images/opc-ajax-loader.gif') ?>" class="v-middle" alt=""/>
                    </span>
                </div>
            </div>
        </form>
        <script type="text/javascript">
            //<![CDATA[
            var ajaxLogoutForm = new VarienForm('ajaxlogin-logout-form', true);
            //]]>
        </script>
    </div>
<?php endif; ?>

<?php if (Mage::getConfig()->getModuleConfig('Mage_Persistent')) : ?>
    <?php
    $isActive = Mage::getConfig()->getNode('modules/Mage_Persistent/active');
    if (!$isActive || !in_array((string)$isActive, array('true', '1'))) {
        return false;
    }
    ?>

    <?php if (Mage::helper('persistent/session')->isPersistent() && !Mage::getSingleton('customer/session')->isLoggedIn()): ?>
        <?php $customer = Mage::helper('persistent/session')->getCustomer(); ?>
        <div id="persistent-cart-window" style="display:none;">
            <div class="page-title">
                <span><?php echo Mage::helper('persistent')->__('Welcome, %s!', Mage::helper('core')->escapeHtml($customer->getName(), null)) ?></span>
            </div>
            <div class="content">
                <p><?php
                    echo Mage::helper('ajaxlogin')->__(
                        'You are browsing our store as %s %s',
                        $customer->getName(),
                        $this->getLayout()->createBlock('persistent/header_additional')->toHtml()
                    );
                    ?></p>
                <p><?php
                    $login    = $this->__('Login');
                    $register = $this->__('Register');
                    echo Mage::helper('ajaxlogin')->__(
                        'Please %s or %s a new account to place order.',
                        "<a href='" . $this->getUrl('customer/account/login') . "' class='ajaxlogin-login'>" . $login . "</a>",
                        "<a href='" . $this->getUrl('persistent/index/saveMethod') . "' class='ajaxlogin-register'>" . $register . "</a>"
                    );
                    ?></p>
            </div>
        </div>

        <script type="text/javascript">
            //<![CDATA[
            document.observe("dom:loaded", function() {
                persistentWindow = new AjaxLogin({
                    triggers: {},
                    size: {
                        maxWidth: 400
                    }
                });
                if (!Mage.Cookies.get('hasPersistentBeenClosed'))
                {
                    persistentWindow.update($('persistent-cart-window'))
                        .setModal(0)
                        .show();
                }
            });

            $('persistent-cart-window') && $('persistent-cart-window').up().up().next('.close') && $('persistent-cart-window').up().up().next('.close').observe('click', function(e) {
                if (!Mage.Cookies.get("hasPersistentBeenClosed"))
                {
                    // Create the expiry date
                    var expiryDate = new Date();
                    expiryDate.setDate(expiryDate.getDate() + <?php echo ( Mage::helper('persistent')->getLifeTime() / 86400 ) ?>);
                    // Call the set method
                    Mage.Cookies.set('hasPersistentBeenClosed', true, expiryDate);
                }
            });
            //]]>
        </script>

    <?php endif; ?>
<?php endif; ?>

above code solved issue

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.