Jump to content

  • You cannot start a new topic
  • You cannot reply to this topic

Modify Email Subject With Field From Form Builder Rate Topic   - - - - -

 
  • arteeni
  • Advanced Member
  • Members
  • Join Date: 07-Aug 15
  • 85 posts

Posted 27 February 2016 - 11:47 PM #1

Hi everyone. I'm running into an issue and was hoping someone could point me in the right direction.

 

I am trying to modify the email subject template (form builder addon) so that it includes the value from one of the fields that is on the form. The field is a select box and is called "Type of question" (see attached screenshot for reference). When someone chooses an option from that box and submits the form, I want the text value to be part of the email subject. That way I can use Gmail filters to automatically move or forward the email.

 

Looking at the contact form's html page source, I found:

<select id="elm_11" class="ty-form-builder__select" name="form_values[11]">
<option label="" value="">- Select -</option>
<option value="12" >Product</option>
<option value="13" >Shipping</option>
<option value="14" >Order</option>
<option value="32" >Return</option>
<option value="31" >Personal Shopper request</option>
<option value="28" >Website issue</option>
<option value="15" >Other</option>
</select>

I looked at the code in the email template (design/backend/mail/templates/addons/form_builder/form.tpl) and after some trial and error, I figured out I should be able to get this value from {$form_values.$element_id} where element_id is equal to "11" from the page source.

 

So, I added {$form_values.11} to the template (design/backend/mail/templates/addons/form_builder/form_subj.tpl) and submitted the form selecting the option "Product". The resulting email subject says "12", which is the option value in the html source code, not the text value. But, that text value is displayed in the email body, so it should be retrievable somehow.

 

Any ideas?

 

Thanks in advance,

Jason

Attached Files


Arteeni - a marketplace for artisan, handmade goods, with a charitable twist.


 
  • tbirnseth
  • CS Cart Expert
  • Authorized Reseller
  • Join Date: 08-Nov 08
  • 11384 posts

Posted 28 February 2016 - 08:17 AM #2

Jason, I think you want to do something like:

{$elements[11].variants[12].description}

You will probably want to use a variable for whatever is delivering you '12' in your particular form.


EZ Merchant Solutions: Custom (USA based) B2B Development, Consulting, Development and Special Projects (get a quote here).
Commercial addons, payment methods and modifications to meet your business and operations needs.


 
  • arteeni
  • Advanced Member
  • Members
  • Join Date: 07-Aug 15
  • 85 posts

Posted 28 February 2016 - 06:53 PM #3

Jason, I think you want to do something like:

{$elements[11].variants[12].description}

You will probably want to use a variable for whatever is delivering you '12' in your particular form.

 

 

Thanks Tony - that's what I needed. I ended up using this to get it to work:

{$elements[11].variants[$form_values.11].description}

Arteeni - a marketplace for artisan, handmade goods, with a charitable twist.


 
  • Qbasix
  • Advanced Member
  • Members
  • Join Date: 19-Nov 13
  • 137 posts

Posted 30 January 2017 - 02:43 AM #4

I'm doing a custom form too and found this very useful.