Skip to content

Instantly share code, notes, and snippets.

@ben72
Last active December 15, 2015 06:19
Show Gist options
  • Save ben72/5215912 to your computer and use it in GitHub Desktop.
Save ben72/5215912 to your computer and use it in GitHub Desktop.
Improved error handling for shopplugin. This is just some customizations of the errors.php file. Replace the errors.php file in your shopp templates directory.
<div class="shopp shopp-errors">
<?php $msg = shopp('storefront','errors','echo=0');
// Don't display Errors header after successful password recovery as it will confuse the customer
if(strpos($msg, __('Check your email address for instructions on resetting the password for your account.','Shopp')) !== false
or strpos($msg, __('Check your email address for your new password.','Shopp')) !== false): ?>
<ul>
<?php print $msg; ?>
<?php
// Display a password recovery link when incorrect login password entered in checkout
elseif(strpos($msg, __('The password is incorrect.','Shopp')) !== false && shopp('storefront','is-checkout')): ?>
<h3>Errors</h3>
<ul>
<?php print $msg; ?>
<li><a href="<?php shopp('customer','recover-url'); ?>">Lost your password?</a></li>
<?php
// For all other errors just display the error message as usual
else: ?>
<h3>Errors</h3>
<ul>
<?php print $msg; ?>
<?php endif; ?>
</ul>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment