17 replies [Last post]
himagarwal's picture
Offline
Joined: 06/24/2008
Juice: 302
Was this information Helpful?

1. Is it possible to save custom invoice template to /files directory or any other safer place so that when an update (personally, I delete and replace old version completely with new one) is made to Ubercart it doesn't get deleted mistakenly.
2. How to set custom invoice as default invoice?
3. Is there a token for a customer's country only?
4. Is there a way to add dynamic "S.No."?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15459
Re: Creating custom invoice template.

All that's been written on the topic can be found here: http://www.ubercart.org/docs/developer/246/invoice_system

Once you create your custom invoice, simply change the setting in the order and notification settings to your file.

himagarwal's picture
Offline
Joined: 06/24/2008
Juice: 302
Re: Re: Creating custom invoice template.

I would like to print customer's delivery country in invoice template.

I did something like this

<?php echo $order->country; ?>

but it didn't worked. Does anyone know how to do this?

Ryan's picture
Offline
Joined: 08/07/2007
Juice: 15459
Re: Re: Re: Creating custom invoice template.

You need a combination of something like this...

<?php
  $country
= uc_get_country_data(array('country_id' => $order->country));
  echo
$country['country_name'];
?>
himagarwal's picture
Offline
Joined: 06/24/2008
Juice: 302
Re: Re: Re: Re: Creating custom invoice template.

thanks Ryan but it didn't worked out...

smcochin's picture
Offline
Joined: 03/18/2009
Juice: 3
A function to build licence key

Ryan,
You are doing a wonderful job in this forum. Thanks.
Is it possible to have function that can create a licence key for a digital product?

Where would I include such a function, inside the template, module or .inc file?

You advice would apprecaited

thanks in advance

smcochin

ambrojio's picture
Offline
Joined: 01/07/2010
Juice: 2
Re: A function to build licence key

There really should be a way to select an invoice template that's not in the module itself, but in the theme directory. Drupal best practice is to never put anything custom into Drupal core, or a module's core directory. This current system requires that site maintainers backup and replace custom invoices every time UC is updated.

At the very least, the core templates should not have element level CSS embedded in them. I would assume that 90% of invoice customization is just making it match the site's color palette, and it would be a breeze to override some CSS attributes if the invoice elements were classed.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3300
ambrojio wrote: There really
ambrojio wrote:

There really should be a way to select an invoice template that's not in the module itself, but in the theme directory. Drupal best practice is to never put anything custom into Drupal core, or a module's core directory. This current system requires that site maintainers backup and replace custom invoices every time UC is updated.

Please participate in the discussion about this at http://drupal.org/node/295423 if this issue is important to you.

ambrojio wrote:

At the very least, the core templates should not have element level CSS embedded in them. I would assume that 90% of invoice customization is just making it match the site's color palette, and it would be a breeze to override some CSS attributes if the invoice elements were classed.

If you have a suggestion for how to modify the templates so they will be more useful, please post your suggested code (preferably in the form of a patch) in the Ubercart issue queue at http://drupal.org/project/issues/ubercart

<tr>.
mstrelan's picture
Offline
Joined: 12/02/2009
Juice: 73
Move templates to theme folder

Can you comment on the first question? Personally I would like to move the files to my theme directory

"Is it possible to save custom invoice template to /files directory or any other safer place so that when an update (personally, I delete and replace old version completely with new one) is made to Ubercart it doesn't get deleted mistakenly."

William Aubert's picture
Offline
Joined: 03/03/2010
Juice: 9
Re: Creating custom invoice template.

I do that in customer.itpl.php for the delivery country :

<?php
  $delivery_country
= uc_get_country_data(array('country_id' => $order->delivery_country));
  echo
$delivery_country[0] ['country_name'];
?>

and for the billing country :

<?php
  $billing_country
= uc_get_country_data(array('country_id' => $order->billing_country));
  echo
$billing_country[0] ['country_name'];
?>

It seems working...

evilgenius's picture
Offline
Joined: 11/09/2010
Juice: 134
Re: Re: Creating custom invoice template.

How to for the Province/State? Thanks.

jumpfightgo's picture
Offline
Joined: 12/03/2009
Juice: 24
Re: Creating custom invoice template.

Yes point #1 is very important. The invoice templates folder does not follow drupal standards, and instead ubercart should look for those templates in the users theme folder. This is especially important if you are creating a theme for a client, for example.

buysnakewine's picture
Offline
Joined: 03/31/2009
Juice: 105
Ubercart Multi Install - 2 languages, use 2 templates ?

Ubercart Multi Install - 2 languages, is it possible to use 2 templates ? How to select the right language template ?

Hi,

I have a multi-install Drupal 6 Ubercart, and everything is OK but:

When customers orders they will receive a confirmation / summary Email that you can find in this file: uc_order-customer.tpl.php

It is possible to add a second uc_order-customer.tpl.php for the second website of the multi install (different language) ?
And how to select which template to use depending on which website customers ordered ?

Thanks for help.

icedangel61's picture
Offline
Joined: 01/05/2011
Juice: 17
Hello, Is it possible to

Hello,

Is it possible to print out the last 4 digit number of credit card on the invoice? I couldn't find a proper token for it.

Thanks,

evilgenius's picture
Offline
Joined: 11/09/2010
Juice: 134
HI icedangel61, Can you

HI icedangel61,

Can you please share all other tokens you have for your invoice template? I'm having difficulty finding them. Thanks.

bunset's picture
Offline
Joined: 03/06/2011
Juice: 33
tokens in invoice doesnt works

I am with UC -2.4.
My default order template is in this way:

<?php
if ($order->payment_method=='bank_transfer') {
?>


<?php
echo t('To:');
?>

[order-payment-bank-details]

<?php
}
?>

so you have no tokens here, when I try to include a token it doesnt work in my template and I dont know how to show some fields like bank details or others and how to discover.
I tip here is very welcome, How can I know vars and fields present in ubercart to show in my custom template?
Thanks.

bobknocker's picture
Offline
Joined: 11/17/2010
Juice: 37
comments on customer invoice and cart item order

hi, i'm using the customer invoice in place of the admin invoice as it has more useful info, however it does not include the comments, have tried to add this using the info on this thread but not having much luck, any surgestions? also is there a way to make items added to the cart come up in the order they are added as they seem to come up in a random order, hope someone can help

pangi's picture
Offline
Joined: 09/11/2013
Juice: 4
Re: Creating custom invoice template.

Hi Ryan, You are doing a amazing job in this community. Thanks. Is it possible to have operate that can make a permit key for a electronic product? Where would I consist of such a operate, within the design, component or .inc file? I am using service of http://www.fetchflow.com/support/question/Generate-invoices-using-Excel.... which is quite great but a client want me to do work from ubercart because he has his account here. Please help me on this.

Pangi