4

I want to theme the page /cart/checkout/complete

I already saw the settings in admin/store/settings/checkout/settings, but they are not enough. I want to add some HTML i.e. add a print button at the top of the page.

I would like to have a .tpl.php file to use as template, or otherwise, using an alternate checkout page, how to insert the texts defined in checkout settings.

I tried to make a uc_cart_complete_sale.tpl.php but it isn't called.

Thank you in advance.

user1014351
  • 437
  • 1
  • 5
  • 16

4 Answers4

5

According to the Template Suggestion documentation you can provide a custom page.tpl.php for absolutely any path, so a template file with the following name would override page.tpl.php for the path cart/checkout/complete:

page--cart--checkout--complete.tpl.php

Be sure to clear Drupal's cache once you've create the file so the changes are picked up in the theme registry.

Clive
  • 36,918
  • 8
  • 87
  • 113
  • thanks very much, the document you suggested really saves me much time, I am Drupal newbie. – Sean Nov 23 '12 at 02:40
1

After hard work, i found the template page.

It is:

page--cart--checkout--complete.tpl.php

remember to clear the cache

user1014351
  • 437
  • 1
  • 5
  • 16
0

In D6 at least, you can theme the message by overriding theme_uc_cart_complete_sale() - so if that's what you're after, theme the message by overriding that in your theme (for example, function mytheme_uc_cart_complete_sale($message, $order) {}

rfay
  • 9,963
  • 1
  • 47
  • 89
0

firstly, you should probably check this page: admin/store/settings/checkout/edit/messages

there you can customize a header for the message displayed when the checkout completes.

other than that, you can implement some functions to alter this page. from a short look in the ubercart api maybe this function will do: my_module_checkout_complete() in this link the guy says it worked

another function that should work is theme_uc_cart_complete_sale

there are other options, such as in your template.php check if this is /checkout/complete and do whatever you want. like this:

if (arg(0) == 'cart' && arg(1) == 'checkout' && arg(2) == 'complete')

and than redirect to your page. anyway, there are plenty of ways to accomplish this, but just naming a file 'uc_cart_complete_sale.tpl.php' won't work. sorry...

Moshe Shaham
  • 15,448
  • 22
  • 74
  • 114
  • 1) about the admin page, this solution could be a fast solution, but is not what i wanted, because i would like a control on the page with something like a node or page template 2) yes, the link is one of the best possible solution i found, but it's ubercart 2 and i hoped in ubercart 3 there was easiers solutions. 3) i don't want to modify the modules, then the solution is more complicated 4) possible solution, i thought another dirty solution modifying the page.tpl.php page – user1014351 Dec 23 '11 at 09:34
  • Ubercart 3 has this function, although the arguments changed to a $variables array containing "message" and "order" keys. – Jason Gray Aug 28 '13 at 13:45