Jump to content

Custom Field to Show in Cart & Invoice?


RMIGHTY1

Recommended Posts

How do I get a custom field on a product to show in the cart during checkout and in the invoice?

 

I have read the Documentation Manual, info on Smarty Templates and spent days in the WHMCS files on the server but could not figure it out.

 

The textarea for comments shows up in the administrative panel and I would also like for that to show in the cart and on the invoice.

 

Amazon.com does this and I think it is a very nice touch.

 

I do not know php but I think with some skillful help, this can be accomplished.

 

Thank you,

 

~~Ray :)

Link to comment
Share on other sites

Searched forum all day Saturday. Learned a lot more about WHMCS :)

 

My product custom fields are not even showing up in the Confirmation Email :(

 

For two custom fields, 1) Your Domain Name and 2) Domain tld, I have tried the following in the Order Confirmation email template:

 

{$client_custom_field_yourdomainname}

{$client_custom_field_domaintld}

{$service_custom_field_yourdomainname}

{$service_custom_field_domaintld}

{$client_custom_field_0}

{$client_custom_field_1}

{$service_custom_field_0}

{$service_custom_field_1}

{$client_custom_field_2}

{$client_custom_field_3}

{$service_custom_field_2}

{$service_custom_field_3}

{$client_custom_field_4}

{$client_custom_field_5}

{$service_custom_field_4}

{$service_custom_field_5}

{$client_custom_field_6}

{$client_custom_field_7}

{$service_custom_field_6}

{$service_custom_field_7}

 

 

 

{$service_custom_field.0}

{$service_custom_field.1}

{$service_custom_field.2}

{$service_custom_field.3}

{$service_custom_field.4}

{$service_custom_field.5}

{$service_custom_field.6}

{$service_custom_field.7}

 

 

 

****

 

{$client_custom_fields_yourdomainname}

{$client_custom_fields_domaintld}

{$service_custom_fields_yourdomainname}

{$service_custom_fields_domaintld}

{$client_custom_fields_0}

{$client_custom_fields_1}

{$service_custom_fields_0}

{$service_custom_fields_1}

{$client_custom_fields_2}

{$client_custom_fields_3}

{$service_custom_fields_2}

{$service_custom_fields_3}

{$client_custom_fields_4}

{$client_custom_fields_5}

{$service_custom_fields_4}

{$service_custom_fields_5}

{$client_custom_fields_6}

{$client_custom_fields_7}

{$service_custom_fields_6}

{$service_custom_fields_7}

 

{$service_custom_fields.0}

{$service_custom_fields.1}

{$service_custom_fields.2}

{$service_custom_fields.3}

{$service_custom_fields.4}

{$service_custom_fields.5}

{$service_custom_fields.6}

{$service_custom_fields.7}

 

Still not showing in the email template. Sheeesh!

 

Is the Validation field a required field perhaps? I do not know regular expressions but if it is a required field, I will go learn them. Any suggestions? Be polite now ;)

 

Thanx,

 

~~Ray :)

Link to comment
Share on other sites

To show them in the cart you can add this line (I added it below the if-statement of $product.configoptions in the viewcart.tpl.

 

{if $product.customfields}{foreach key=custnum item=customfields from=$product.customfields}
 » {$customfields.name}: {$customfields.value}<br />
{/foreach}{/if}

 

Not sure how to get this in the invoice, I'm looking into that one. ;-)

Link to comment
Share on other sites

I realize now that the textarea for comments cannot be shown in the cart as it follows the cart in the checkout flow.

 

m00, thank you for the solution to showing the custom fields in the cart. I did what you said and it works like a charm. You're the BEST!

 

I will have yet another look at the invoice in light of what you have presented here. Getting the custom fields to show in the confirmation email really baffles me. I must be missing something obvoius. The default strings show up just fine.

 

Also, I have finally found the textarea comments and the custom fields in the administrative panel so they show up there just fine once you know where to look.

 

Thank you again m00!

 

~~Ray :)

Edited by RMIGHTY1
Link to comment
Share on other sites

I'm affraid that the there's no customfield variable available on the invoice page and mailer system. Solution for this can be the following: Inside the invoice page there is an $invoiceitem.relid available. This variable is also used in the MySQL table tblcustomfieldsvalues which seems to store the values of the custom fields. You can try to request the value of that table using a PHP-code, but I'm not sure how to do that (i'm just WHMCS user for a week, and completely new to Smarty ;)).

Link to comment
Share on other sites

Thank you m00. I can give up the invoice entry but not the email entry. There is a list of variables that can be used in emails below each email template. Custom fields array is one of them for the order confirmation email but for the life of me I cannot get it to show in the confirmation email. The order number and other order details show nicely. Sheeesh!

 

Well I will keep trying and I thank you again m00 for your help. You are doing pretty good for just having started this. Keep up the good work!

 

~~Ray :)

Link to comment
Share on other sites

  • 2 months later...
  • 1 month later...

Hello,

 

I did a support ticket on this as this is what they said:

 

Hi,

Custom product fields can be included in Product email template types by using the following merge field:

 

{$product_custom_field_fieldname}

 

fieldname is the name of the custom field all in lowercase and with no spaces. Eg: IP Address would be {$product_custom_field_ipaddress}

 

---

 

I have not done this yet, but if you do, let me know your results.

 

-BW

Link to comment
Share on other sites

  • 1 year later...

did not work for me on custom template {$product_custom_field_softwareinstallurl} shows nothing, i know it has value because it shows up on the standard invoice. The custom field name is Software Install URL

 

it is the only custom field i have so should i go back to putting 1 or 2 or 0 or what?

Edited by durangod
Link to comment
Share on other sites

UPDATE i put a whole list of formats in the template and

 

{$service_custom_fields.0} works

 

but {$service_custom_fields.softwareinstallurl} does not work, so i guess ill just have to remember if i ever change the order to change the template as the naming option does not work.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated