I need to wrap ubercart cart, cart/checkout and other front-end pages in extra html, but cannot find a way to do it (some template files or way to add my extra html).

For example, mydomain/cart ubercart content is inside

<div id="cart-form-pane"></div>

, and i need to add more html before and after that div.

I could watch for ubercart in page.tpl.php with current_path(); and on occurance add that extra html, but would like to know is there any more propper way.

Update: it is Drupal 7 with Ubercart 3


You can achieve this in following ways, 1) define a template file:- in your template.php, define a template file for checkout page

* Implements hook_theme().
function themename_theme($existing, $type, $theme, $path) {
  $items = array();

  $items['uc_cart_checkout_form'] = array(
  'render element' => 'form',
'template' => 'uc-cart-checkout-form',
  'path' => $path . '/templates/',//where the tpl files are located

   return $items;

Then in your templates folder create a file uc-cart-checkout-form.tpl.php, here you can render your form with additional htmls

2) Override the theme

Check this instruction on Ubercart How to Theme the Checkout pane in Ubercart 3, by following this you can include your custom html.

Similarly the above methods are applicable to cart page also

  • Thanks, i am doing implementation under 1), how exactly do i output form in uc-cart-checkout-form.tpl.php? – NenadP Oct 27 '12 at 9:06
  • Got it! There is ready-made template here - pastebin.com/1nwkSx4A – NenadP Oct 27 '12 at 9:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.