No replies
andrewkew's picture
Offline
Joined: 11/11/2014
Juice: 5
Was this information Helpful?

I am busy building an e-commerce site using Drupal 7 and Ubercart. I have the standard functionality working for this module but now want to customise the following pages

/cart
/cart/checkout

From what I understand there are a couple of ways of doing this, either overwriting the page/node template or creating theme_uc_* functions in your template.php file. I have decided to go down the route of complete control and am creating page template files so that I can customise the entire look and feel to the pages.

For the /cart page I have created a file in my theme directory called page--cart.tpl.php so that I have complete control over the look of this page. To get the cart contents I am using

<?php
$cart
= uc_cart_get_contents();
?>

And then looping through the $cart variable to display the shopping cart. This is all very well but the problem I am having is how do I correctly generate the form that this cart is meant to fit between, so that fields like form_build_id and form_token are set correctly, so that I can update/remove elements on the page and then checkout as well.

Can someone please help me with how best to generate the form for this page (and the checkout page) correctly when creating these page--* pages for ubercart

Thanks Andrew