Redirect to cart after add

essbee's picture
Offline
Joined: 07/21/2010
Juice: 29
Redirect to cart after add

I have the redirect to cart functionality working, with views hack. Basically I'm just leveraging the exiting ubercart redirect functionality.

In store admin > configuration > cart settings: put the path to your cart (probably just 'cart') in the field 'Add to cart redirect'

Now you will have to add in a line of code into the multibuy module (this should probably get rolled into the next version as has no other impact). I posted this back at #82 in this thread but have reposted below:

The following is added to the end of the uc_multibuy_form_submit() function.

<?php
//Added to get redirect functionality -SB 15/07/2010
 
if (isset($_GET['destination'])) {
   
drupal_goto();
  }

$redirect = variable_get('uc_add_item_redirect', 'cart');
  if (
$redirect != '<none>') {
   
$_SESSION['uc_cart_last_url'] = uc_referer_uri();
   
drupal_goto($redirect);
  }
  else {
   
drupal_goto(uc_referer_uri());
  }
?>

Thats it, the multibuy form should now respect the cart redirect setting.

Multi-buy By: oliver coleman (131 replies) Fri, 05/30/2008 - 05:14
  • Redirecting cart after multi-buy... By: cardell (06/01/2010 - 17:52)
  • Multi-Buy and Out of Stock options? By: starryeyez024 (05/19/2010 - 17:57)
  • Re: Multi-buy By: LuckySMack (05/08/2010 - 06:54)
  • No Popups By: LuckySMack (05/07/2010 - 16:53)
  • Re: Multi-buy By: LuckySMack (05/07/2010 - 09:41)
  • Brain Fart By: LuckySMack (05/07/2010 - 09:07)
  • Re: Multi-buy By: LuckySMack (05/07/2010 - 08:45)
  • Re: Multi-buy By: LuckySMack (05/07/2010 - 08:19)
  • A suggestion By: lostchord (04/04/2010 - 15:58)
  • Re: Multi-buy By: avi (03/15/2010 - 12:33)
  • Re: Multi-buy By: freatida (01/12/2010 - 11:41)
  • Re: Multi-buy By: freatida (01/12/2010 - 09:12)
  • Ding, 6.x-2.3 for UC 6.x-2.2 is ready By: oliver coleman (01/11/2010 - 21:26)
  • setting up multi-buy By: liquidkrep (01/11/2010 - 13:24)
  • Getting started on upgrade By: oliver coleman (01/10/2010 - 19:11)
  • Re: Multi-buy By: freatida (01/07/2010 - 12:56)
  • Re: Multi-buy By: brandonratz (01/07/2010 - 11:32)
  • Views and time By: oliver coleman (01/06/2010 - 17:57)
  • Re: Multi-buy By: freatida (12/29/2009 - 07:07)
  • Re: Multi-buy By: freatida (12/23/2009 - 06:04)
  • Re: Multi-buy By: freatida (12/23/2009 - 03:44)
  • Re: Multi-buy By: freatida (12/18/2009 - 13:56)
  • Re: Multi-buy By: freatida (12/17/2009 - 11:41)
  • Re: Multi-buy By: freatida (12/16/2009 - 09:19)
  • Unsure what I need to do to get this working. By: ckopack (08/27/2009 - 13:49)
  • Changes required to work with Ubercart 2.0-rc6 By: garethsprice (08/21/2009 - 16:34)
  • Patch to remove required attribute and amount By: webbyworker (06/10/2009 - 19:42)
  • Patch to Multi-Buy -- 3-part By: bibeksahu (06/09/2009 - 20:16)
  • Compatibility fix for UC-6.x-2.x-rc3 By: oliver coleman (06/08/2009 - 19:53)
  • A couple questions about multi-buy... By: melanie_me (05/01/2009 - 14:31)
  • Re: Multi-buy By: melanie_me (04/06/2009 - 12:50)
  • e-geek -- great module. Had some support(?) questions... By: GreyHawk (04/02/2009 - 14:27)
  • This module is fabulous--Just what I needed By: janemmm (03/19/2009 - 14:05)
  • Hi there, Firstly thanks for By: Dubs (08/27/2008 - 11:42)
  • Re: Multi-buy By: TR (07/23/2008 - 01:11)