Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduced multiple dispatch events in login form. #1206

Merged
merged 1 commit into from
Dec 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,38 +32,40 @@
*/
/** @var $this Mage_Checkout_Block_Onepage_Login */
?>
<?php $isRegistrationAllowed = $this->helper('customer')->isRegistrationAllowed() ?>
<?php $isAllowedGuestCheckout = $this->getQuote()->isAllowedGuestCheckout() ?>
<?php echo $this->getChildHtml('login_before') ?>
<div class="col2-set<?php if (!$this->helper('customer')->isRegistrationAllowed() && !$this->getQuote()->isAllowedGuestCheckout()) echo ' login-only' ?>">
<div class="col2-set<?php if (!$isRegistrationAllowed && !$isAllowedGuestCheckout) echo ' login-only' ?>">
<div class="col-1">
<h3>
<?php if( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
<?php if ($isAllowedGuestCheckout && $isRegistrationAllowed): ?>
<?php echo $this->__('Checkout as a Guest or Register') ?>
<?php elseif ( $this->getQuote()->isAllowedGuestCheckout() && !$this->helper('customer')->isRegistrationAllowed() ): ?>
<?php elseif ($isAllowedGuestCheckout && !$isRegistrationAllowed): ?>
<?php echo $this->__('Checkout as a Guest') ?>
<?php else: ?>
<?php echo $this->__('Register to Create an Account') ?>
<?php endif; ?>
</h3>
<?php if( !$this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
<?php if (!$isAllowedGuestCheckout && $isRegistrationAllowed): ?>
<p class="description"><?php echo $this->__('Register and save time!') ?></strong><br />
<?php echo $this->__('Register with us for future convenience:') ?></p>
<ul>
<li><?php echo $this->__('Fast and easy check out') ?></li>
<li><?php echo $this->__('Easy access to your order history and status') ?></li>
</ul>
<?php elseif( $this->getQuote()->isAllowedGuestCheckout() && $this->helper('customer')->isRegistrationAllowed() ): ?>
<?php elseif ($isAllowedGuestCheckout && $isRegistrationAllowed): ?>
<p class="description"><?php echo $this->__('Register with us for future convenience:') ?></p>
<?php endif ?>
<?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
<?php if ($isAllowedGuestCheckout): ?>
<ul class="form-list">
<?php if( $this->getQuote()->isAllowedGuestCheckout() ): ?>
<?php if ($isAllowedGuestCheckout): ?>
<li class="control">
<input type="radio" name="checkout_method" id="login:guest" value="guest"<?php if($this->getQuote()->getCheckoutMethod()!=Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER): ?> checked="checked"<?php endif; ?> class="radio" /><label for="login:guest"><?php echo $this->__('Checkout as Guest') ?></label>
</li>
<?php endif; ?>
<?php if( $this->helper('customer')->isRegistrationAllowed() ): ?>
<?php if ($isRegistrationAllowed): ?>
<li class="control">
<input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$this->getQuote()->isAllowedGuestCheckout()): ?> checked="checked"<?php endif ?> class="radio" />
<input type="radio" name="checkout_method" id="login:register" value="register"<?php if($this->getQuote()->getCheckoutMethod()==Mage_Checkout_Model_Type_Onepage::METHOD_REGISTER || !$isAllowedGuestCheckout): ?> checked="checked"<?php endif ?> class="radio" />
<label for="login:register"><?php echo $this->__('Register and Checkout') ?></label>
</li>
<?php endif; ?>
Expand All @@ -73,7 +75,7 @@
<?php endif; ?>
<div class="buttons-set">
<p class="required">&nbsp;</p>
<?php if ($this->getQuote()->isAllowedGuestCheckout()): ?>
<?php if ($isAllowedGuestCheckout): ?>
<button id="onepage-guest-register-button" type="button" class="button" onclick="checkout.setMethod();"><span><span><?php echo $this->__('Continue') ?></span></span></button>
<?php elseif ($this->helper('checkout')->isCustomerMustBeLogged()): ?>
<button id="onepage-guest-register-button" type="button" class="button" onclick="window.location='<?php echo $this->helper('checkout/url')->getRegistrationUrl();?>'"><span><span><?php echo $this->__('Register') ?></span></span></button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@
*/
/** @var $this Mage_Customer_Block_Form_Login */
?>
<div class="account-login<?php if (!$this->helper('customer')->isRegistrationAllowed()) echo ' login-only' ?>">
<?php $isRegistrationAllowed = $this->helper('customer')->isRegistrationAllowed() ?>
<div class="account-login<?php if (!$isRegistrationAllowed) echo ' login-only' ?>">
<div class="page-title">
<h1><?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
<h1><?php if ($isRegistrationAllowed): ?>
<?php echo $this->__('Login or Create an Account') ?>
<?php else: ?>
<?php echo $this->__('Login'); ?>
Expand All @@ -44,7 +45,7 @@
<form action="<?php echo $this->getPostActionUrl() ?>" method="post" id="login-form" class="scaffold-form">
<?php echo $this->getBlockHtml('formkey'); ?>
<div class="col2-set">
<?php if ($this->helper('customer')->isRegistrationAllowed()): ?>
<?php if ($isRegistrationAllowed): ?>
<div class="col-1 new-users">
<div class="content">
<h2><?php echo $this->__('New Here?') ?></h2>
Expand All @@ -61,7 +62,7 @@
</div>
<?php endif; ?>
<?php // This column should be col-1 if the registration column is not displayed ?>
<div class="<?php if ($this->helper('customer')->isRegistrationAllowed()): ?>col-2<?php else: ?>col-1<?php endif; ?> registered-users">
<div class="<?php if ($isRegistrationAllowed): ?>col-2<?php else: ?>col-1<?php endif; ?> registered-users">
<div class="content fieldset">
<h2><?php echo $this->__('Already registered?') ?></h2>
<p class="form-instructions"><?php echo $this->__('If you have an account with us, please log in.') ?></p>
Expand Down