Redirect to home page if cart is empty
- In
app/design/frontend/default/your-theme/template/checkout/cart/noItems.phtmladd (this may not be the best solution but does work)
<?php Mage::app()->getResponse()->setRedirect($this->getContinueShoppingUrl()); ?> - Create an observer (try
controller_action_predispatch_checkout_cart_delete) that check if your cart is empty then redirect see to the home page (for redirecting from observer see)
- Using javascript and timer so that the user will see that
there cart is empty before redirecting to home page (see time
delayed redirect?) Add code below to
noItems.phtmlsee solution #1
<script>setTimeout(function () {window.location.href = "<?php echo $this->getContinueShoppingUrl() ?>"; //will redirect to your blog page (an ex: blog.html)}, 2000); //will call the function after 2 secs.</script>
No comments:
Post a Comment