5 replies [Last post]
johnnygphotography's picture
Offline
Joined: 10/20/2008
Juice: 10
Was this information Helpful?

Hello. I will soon be adding Ubercart to a one page site which will only have one item to sell. Can this be designed so rather than clicking on "add to cart" and being taken to the shopping cart page, the customers are directed straight to the checkout page?

Also, can this one home page be designed in html and when the link is clicked, it goes to the Drupal page with the cart? or does the whole site need to be designed in Drupal

Thanks so much for any direction you could give me...

Johnny G

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: one item to sell. can it go directly to checkout instead of

You can use the core cart links module to construct a link that will direct the customer to the checkout page, but if they wanted they could cancel out of there to get to the shopping cart page. I'm sure you can play with it to get it where you need it to be.

BenStallings's picture
Offline
Joined: 03/13/2008
Juice: 91
cart links link to cart, not to checkout

I may be missing something, but when I use cart links, they link to the shopping cart page, not to the checkout page. How do you make them go to the checkout page?

BenStallings's picture
Offline
Joined: 03/13/2008
Juice: 91
what I've tried

I've tried a couple PHP approaches to this problem, and both had the same problem. I created a page node with this code in it:

<?php
//empty the cart
$cartid= uc_cart_get_id();
uc_cart_empty($cartid);
//insert the product (nid 7)
uc_cart_add_item(7, 1NULL, $cartid, FALSE, FALSE);
//display cart contents
print uc_cart_view();
//go to checkout
//drupal_goto('cart/checkout');
?>

As it is above, it does the same thing as a cart link to cart/add/e-p7_q1 . But if you comment out the print_uc_cart_view(); line and uncomment the drupal_goto line, you go straight to checkout. So far so good. But if you then fill in the checkout form and submit it, you get returned to the checkout form with all fields blanked out and have to fill it in a second time!

I tried using uc_cart_checkout() instead of drupal_goto(), and the same thing happened.

Any ideas?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15438
Re: what I've tried

You need to add ?destination=cart/checkout to the end of your cart link to redirect to checkout.

BenStallings's picture
Offline
Joined: 03/13/2008
Juice: 91
thanks! is that documented somewhere?

Thanks, Ryan! Now that I know that, I see that it is in fact documented in the Cart Links help screen, but I sure didn't see it before. Smiling