RMIGHTY1 Posted January 9, 2010 Share Posted January 9, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
RMIGHTY1 Posted January 10, 2010 Author Share Posted January 10, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted January 10, 2010 Share Posted January 10, 2010 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. ;-) 0 Quote Link to comment Share on other sites More sharing options...
RMIGHTY1 Posted January 10, 2010 Author Share Posted January 10, 2010 (edited) 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 January 10, 2010 by RMIGHTY1 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted January 11, 2010 Share Posted January 11, 2010 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 ). 0 Quote Link to comment Share on other sites More sharing options...
RMIGHTY1 Posted January 12, 2010 Author Share Posted January 12, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
hypertoast Posted April 6, 2010 Share Posted April 6, 2010 Has any one found a working solution to this question? I have exhausted quite few resources till date to get my product custom fields show up in the invoice... 0 Quote Link to comment Share on other sites More sharing options...
Ninthcom Posted June 3, 2010 Share Posted June 3, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted March 29, 2012 Share Posted March 29, 2012 (edited) 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 March 29, 2012 by durangod 0 Quote Link to comment Share on other sites More sharing options...
durangod Posted March 29, 2012 Share Posted March 29, 2012 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. 0 Quote Link to comment Share on other sites More sharing options...
dm800pvr Posted April 5, 2012 Share Posted April 5, 2012 {$service_custom_fields.0} didn't worked for me not in product not invoice email templates! 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.