Hi there,
my customer wants a custom redirect for users who login. These users should be redirected to a view with new products (the site uses ubercart for the shop). As he also wants no anonymous checkout in ubercart I have a problem. Usually when an anonymous user wants to check out, the login/registration site is displayed - after the login, the shop proceeds to checkout. Now, with my redirection rule, it's like that: Each time a user proceeds from cart to checkout and does the login, the triggered rule with the redirect is executed and the user gets to the new products page.
I added a condition to the rule, but i'm not sure how to catch only checkout-logins. Has anyone an idea how to set up this condition?
Comments
Tricky with Ubercart
The Ubercart module (as it looks now) is pretty tricky to work with. It keeps a good portion of its information stored in its own ways, and I'm not sure that you will be able to access information from Ubercart easily from Rules.
In your case I would probably go for a quick-and-dirty solution, if it works:
Does the URL of the login/registration page show any redirects or so when you create account from Ubercart? If so, you can try to use these variables as conditions in Rules.
If the URL is nice and clean (/user/register), you'll probably have to dig deeper to find any variable to check against. :-(
Good luck, in any case.
//Johan Falk, NodeOne, Sweden
PS: From what I've heard the next version of Ubercart will build much more on Drupal's built-in API and handling of variables. Yay!
Hi Itangalo, thanks for your
Hi Itangalo,
thanks for your fast reply.
Unfortunately the URL is nice and clean (/user/register for registration and /user for login). I'll have to dig now :/ Do you have any idea where to start? I mean, where could this kind of information be stored in? Any global variable?
PS: I hope so...but i think it will need again its time until all contrib modules etc are available (he, it's always the same - just think of D7?!) :)
Try to use cart id
Hi,
I thought about your question and knew I saw something that might be relevant.
Then it got me - while logged-in cart id is identical to the user id, anonymous cart id is random.
<?php
/**
* Return the unique cart_id of the user.
*/
function uc_cart_get_id() {
global $user;
if ($user->uid) {
return $user->uid;
}
elseif (!isset($_SESSION['uc_cart_id'])) {
$_SESSION['uc_cart_id'] = md5(uniqid(rand(), TRUE));
}
return $_SESSION['uc_cart_id'];
}
?>
I have no real idea how to push this information into Rules, but I feel it might be a good start to work with.
What I am trying to say is that checkout-logins will have random cart id, and somehow it can be used...
Hope this help, and hope it won't be a wrong direction...