I need to allow a user to create their own product (just a blank text field?), price and quantity and have it show up correctly in the order form portion of the email. Is this possible? If so how?
Thanks
Brad
I need to allow a user to create their own product (just a blank text field?), price and quantity and have it show up correctly in the order form portion of the email. Is this possible? If so how?
Thanks
Brad
Currently it's possible to allow the user to input the quantity and user defined price, but the Product Name is currently not populated from a field. But this would be possible via a customization using code to set the Product Name to use a value from another Input Field. How comfortable are you with PHP and the use of WordPress hooks/filters to customize things?
Very comfortable could you give me a crude example.
Any love? :P
You would use the gform_post_submission hook to update and change the name of the product to use the value they input in the text field you use to let them enter the name. The gform_post_submission hook is documented here:
http://www.gravityhelp.com/documentation/page/Gform_post_submission
I don't know if the post submission documentation will help. That just permanently changes the value of a post. Maybe I'm missing something?
I'm trying to add the values of the "Product" field to the order form that is mailed to the email on the Notifications tab using values supplied by the user.
So we get
<email form>
Name user info etc.
Order form
12 widgets $1200
1 blue widget $1.00
</end email>
Please look at my form here. http://dev.cheminc.com/order-form/
Please select: I have my Customer Code.
Maybe it will make more sense.
I understand exactly what you are trying to do. The gform_post_submission hook is what you would want to use to do it.
You want to make the Product Name of the Product that appears in the Order Data use the Name the user enters in a text field. You have to do this when the form is submitted.
There isn't currently an option to the let the user name the Product, so you'd have to have a Single Input field that asks them for the Product Name and then you'd use the gform_post_submission hook to update the name of the real Product Field so that it uses the value of the Single Input field.
The gform_post_submission isn't for changing the value of a post, it's for manipulating the form data after it is submitted. Which is what you want to do, you want to manipulate the name of the product after the user submits it.
Ok so now that I have the values where do I assign them? Can you clarify what the "real Product Field" is?
"There isn't currently an option to the let the user name the Product, so you'd have to have a Single Input field that asks them for the Product Name and then you'd use the gform_post_submission hook to update the name of the real Product Field so that it uses the value of the Single Input field."
So should I use a multi page form and update the "real Product Field" on the next form page or can I do it all in one page? Can it be done somehow with ajax so that once they enter the product name it updates the "real Product Field'?
How I found the Keys and Values for those wondering.
foreach($entry as $key => $value)
$temp .= "Key: $key; Value: $value
\n";
Key: 16; Value: 1
Key: 17; Value: product 1
Key: 18; Value: 2
Key: 19; Value: product 2
Key: 20; Value: 3
Key: 21; Value: product 3
You would have to have a Product field on your form that would be the real Product Field that will be updated with the user generated name.
Then you'd have a standard single input field on your form for the user to enter the name of the Product.
Then using the gform_post_submission hook when the form is submitted, not when they go to the next page of a multi-page form, but when the form is submitted on the final page of the form and the form is processed which is when the gform_post_submissino hook is triggered.
Using the gform_post_submission hook and the Entry object you would get the value of the field you used for the user to enter the product name and UPDATE the name of the real Product Field with that value of the input field used to ask the user for the product field using the entry object.
I'm not sure how else to explain it short of actually writing the customization.
I understand what you are saying.
Key: 23.1; Value: Product Name
Key: 23.2; Value: $0.00
Key: 23.3; Value: 1
Key: 17; Value: Product Name 1
How do I update the entry value? $entry['23.1'] = $entry['17']; ? That doesn't work.
Also thanks for all your help so far Carl.
Hi Brad13x,
This thread sounds very similar to what you are trying to do:
Awesome David. This is what I was looking for. Now is there a way to remove the values from the product fields (the product names I no longer need) so they don't show up in the email.
What I have so far.
add_filter("gform_product_info_1", "update_product_info", 10, 3);<br />
function update_product_info($product_info, $form, $lead){</p>
//23:17 24:19 25:21 26:28 27:29
$product_info["products"][23]["name"] = rgpost('input_17');
$product_info["products"][24]["name"] = rgpost('input_19');
$product_info["products"][25]["name"] = rgpost('input_21');
$product_info["products"][26]["name"] = rgpost('input_28');
$product_info["products"][27]["name"] = rgpost('input_29');
return $product_info;
}
Any help?
Hi Brad,
Looks like the issue was with the source code I provided in the other thread. Instead of the using rgpost() to retrieve the value, you can get the value from the $lead variable instead. This means rgpost('input_17') would become $lead[17].
Would changing the value of $lead[17] remove it from the invoice page?
Here is an example of what I want and don't want. This is the email that gform sends after the form is submitted.
After I'm done with the user created product I no longer need it to appear above the Order section like it's doing now. It is redundant.
How can I edit the values in $lead[17] so that they no longer show up on the purchase order? Once I'm done with the values in $lead[17] how can I clear them or remove them so they don't show up on the invoice.
Hi Brad,
Assuming these unwanted fields are not product fields, the only way to remove them would be not user the {all_fields} token and create a custom email format for the notifications.
Thanks David. Did the trick. Any easy way to format it?
Unfortunately, there will be nothing as easy as the {all_fields} token for formatting. Anything else will have to be by hand or using an HTML editor and pasting the code in.