Skip Navigation

[Fermé] Uploading Product using Forms

This support ticket is created Il y a 4 années. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 13 réponses, has 3 voix.

Last updated by Christian Cox Il y a 3 années et 11 mois.

Assisted by: Christian Cox.

Auteur
Publications
#1598099
Toolset_product_form_back.jpg
Toolset_product_form_front.jpg

Tell us what you are trying to do? I created a Form to upload products. It seems to work but I have questions:

- When a User lists a product, what is the default assigned Product Type, keeping in mind that there are different product types (Simple, group, variable, event ticket)

- How to control Product Fields such as Stock/ Inventory? Is it possible to include the Inventory Field on the form?

I created fields on the Form as Organiser / Email / Phone because I wanted the submitter to submit their contact details. However, it allowed the User to assign the Product to any Organiser on the database (this should be restricted) and the Emal and Phone fields were not picked up

- What is the function of the Email and Phone fields?
- How can I add a Single Field for the User to submit their name?
- Is it possible to add a Preview button to allow the User to preview the submission before submitting?
- Is it possible to allow the User to save his work? Maybe add a Save button?
- As a User clicks the Submit button, Is it possible to redirect to a form asking the User to Register or Login? So that only Users with an account are allowed to submit posts?

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/front-end-forms/creating-woocommerce-products-using-cred-forms/

Is there a similar example that we can see? https://toolset.com/documentation/user-guides/front-end-forms/creating-woocommerce-products-using-cred-forms/

What is the link to your site? hidden link

#1598867

You do mean to add Fields to the product themselves, correct?

In this case, you should add a Custom Field Group in Toolset > Custom Fields, assign it to the products post type, and then create a Post Form to add or edit products
When you do that, those fields will be automatically already included on the Form, or you can always drag them into the form.

They will then save as post meta fields - like on other posts.

Hence you don't really need a "function" for those fields, but just insert them in the Form and submit.

It is not possible to preview Posts when adding or creating them with Forms
The only way here would be to submit the form and set to a non-published status the user can still access, to preview, and then either edit again or publish in a new (edit) form.

Similarly, you have to proceed to create a "save work" button.
Just submit the form, save the post in a non-public state and let the user edit that post later in an edit form

It's also possible to redirect on submit, however, I'd maybe invert the logic here and rather ask the user before reaching the form to register.
It saves the "surprise" moment for your users and also avoids data loss or people leaving the form because "surprised" that after the hard work, they need to subscribe. It's eventually better doing this before letting them see the form

Redirects of this kind would require custom code as you'd also have to check if the user is eventually already logged in (existing user)

Let me know if I can help further?

#1598957
Product_form.jpg

>In this case, you should add a Custom Field Group in Toolset > Custom Fields, assign it to the products post type, and then create a Post Form to add or edit products
When you do that, those fields will be automatically already included on the Form, or you can always drag them into the form.

My Original questions:
- When a User lists a product, what is the default assigned Product Type, keeping in mind that there are different product types (Simple, group, variable, event ticket)

- How to control Product Fields such as Stock/ Inventory? Is it possible to include the Inventory Field on the form?

Why would I create a new Custom Field Group when items such as Product Type (Simple, Group, Ticket etc) are already part of the Product posting? The number of items to be sold should also be a field that can be added to the form. However, it is not an option for the User to add - see screen.

#1598999

1. When a User lists a product, what is the default assigned Product Type, keeping in mind that there are different product types (Simple, group, variable, event ticket)

As a quick test when submitting such form shows, by default, it'll be a simple product.

Toolset Forms will only create simple and external products, which can be _virtual or _downloadable
Please see the DOC here:
https://toolset.com/documentation/user-guides/front-end-forms/creating-woocommerce-products-using-cred-forms/#what-kinds-of-products-you-can-add-with-forms,
https://toolset.com/documentation/user-guides/front-end-forms/creating-woocommerce-products-using-cred-forms/#what-kinds-of-products-you-can-add-with-forms

The information in the product is stored as a field, not an option of a field but a checkbox (single)
For example, _virtual or _downloadable
How to add those fields to forms is shown here https://toolset.com/documentation/user-guides/front-end-forms/creating-woocommerce-products-using-cred-forms/#registration

2. How to control Product Fields such as Stock/ Inventory? Is it possible to include the Inventory Field on the form?
On the very same DOC you referred, we explain how to control the fields with Forms
Please refer to the table here https://toolset.com/documentation/user-guides/front-end-forms/creating-woocommerce-products-using-cred-forms/#which-product-fields-you-can-use-in-toolset-forms

There are outlined all fields you can control - Stock Status is one of them, Inventory is not a field but a "category" of data, to which Stock belongs to.
You can control and edit all of them:
Sale price dates, SKU, Manage stock, Stock status, Sold individually

3. You also asked about other things, to which my reply mainly referred.
You do not need to create new fields, of course, if the field exists already.
In that case, you can control it with Forms by setting it as forms controlled in Toolset > Post Forms > Manage non-Toolset Post Fields (wp-admin/admin.php?page=CRED_Fields)

Does this help?

#1600049
forms_fields.jpg

Hello thank you for the information. It says that Toolset can edit Custom Fields created by other plugins and in the instructions it says to "go to Toolset -> Post Forms and click on Manage non-Toolset Post Fields in the section just below the list of your forms."

https://toolset.com/documentation/user-guides/front-end-forms/letting-cred-edit-custom-fields-created-by-other-plugins/

I dont see where is the section that Managers Non Toolset Post Fields - can you tell me where to go? Attached is a screenshot of what I see.

In the screenshot on the right square, you can see all the Fields that I have access to and I cannot see the Stock/Inventory Field so I cannot add it. What I have access to is very different from the documentation..Why is that?

#1600337
Bildschirmfoto 2020-04-25 um 15.26.47.png

Exactly as the Documentation tells, I also shared the direct link in my previous reply here:
https://toolset.com/forums/topic/uploading-product-using-forms/#post-1598999:
wp-admin/admin.php?page=CRED_Fields

Go to Toolset > Post Forms and click on "Manage non-Toolset Post Fields" in the section just below the list of your forms.
I can't explain it better.
Please also refer to above direct link I shared, and the screenshot I added now to this reply.

After following the DOC, you should be able to insert those fields as the DOC shows.

#1600965
product_forms.jpg
product_forms2.jpg

Thank you for the clarification. I was able to add extra fields following your instructions.

I have a follow up question about your prior answer:
> you should add a Custom Field Group in Toolset > Custom Fields, assign it to the products post type, and then create a Post Form to add or edit products
> When you do that, those fields will be automatically already included on the Form, or you can always drag them into the form.

I am planning to create a Custom Field Group to be assigned to the Product Content Template and I want this to also be assigned to the Product From. How do I do that? Do I have to create 2 Custom Field Groups with repeating Fields?

I created fields on the Form as Organiser but I am confused as to how it works. When I tested it, it allowed the Form User to assign the Product to any Organiser on the database (see attched) - actually this should be restricted so that if the User is logged in, they would assign themselves as Organiser and not other people. So maybe I need some type of Conditional function (something like - If User logged, assign User Name).

There is a Field on back end called 'Additional Classnames' - I dont know what it does and I cannot delete it - see circled in red. How do I delete it?

#1603841

1. I am planning to create a Custom Field Group to be assigned to the Product Content Template and I want this to also be assigned to the Product From. How do I do that? Do I have to create 2 Custom Field Groups with repeating Fields?

You can't assign a Custom Field Group to a Content Template.
You can, of course, assign a Content Template to a Post, under the condition that some particular Content Template is used on the post you are editing.

Also, you cannot assign a Content Template or a Custom Field Group to a Toolset Form, because the form will instead edit those fields of the posts that it addresses.

Repeating fields are fields that repeat. It will not determine where those fields are seen or assigned

2. I created fields on the Form as Organiser but I am confused as to how it works. When I tested it, it allowed the Form User to assign the Product to any Organiser on the database (see attched) - actually this should be restricted so that if the User is logged in, they would assign themselves as Organiser and not other people. So maybe I need some type of Conditional function (something like - If User logged, assign User Name).

Please open a new ticket for this explaining precisely what organizers and products are, how they relate, who can edit them and who should be able to connect them.
We should be able to control this with HTML Conditions, Access and Access ShortCodes, as well as with default user permissions.
But it'll require some particular work that better is handled in a specific ticket.

4. There is a Field on back end called 'Additional Classnames' - I dont know what it does and I cannot delete it - see circled in red. How do I delete it?

This is an input of Form Fields, where you can add additional CSS classes.
CSS class is elaborated here hidden link
The particular you show is for the warning forms displays if some errors happen on submit. It is a default class, you do not need to remove it, it's calling a Bootstrap alert class.

#1606203

>It is not possible to preview Posts when adding or creating them with Forms
>The only way here would be to submit the form and set to a non-published status the user can still access, to preview, and then either edit again or publish in a new (edit) form.
>Similarly, you have to proceed to create a "save work" button.
>Just submit the form, save the post in a non-public state and let the user edit that post later in an edit form

Regarding the Save Work button - do you have any guidance/documentation that I can follow in order to create a Save Work button.

#1606685

There is no Documentation for that because it is basically the same as creating or managing any other form (be it edit or create)
The only difference is that you rename your button in the form (the label) to "Save Work" (for example) instead of the default "Submit" and you'd eventually change the Post Status in the Forms settings (where you can define the post status of this new or edited post after submitting the form)

Basically you'd:

1. Create an Add new Posts form, with a button "Save work", it drafts the submitted posts, with a redirect it to the new post
2. Create an Edit Post Form, which can be used to continue editing the previously saved post, this form publishes the post
3. Insert the Add new Post Form somewhere to add new posts.
4. The User who uses this form needs permissions to see drafts (use Access for that, if required)
==> The user using this form needs at least Read, Edit Own and Preview Any permissions on the post type and all rights on the Form.
5. Create a Content Template and assign it to your Post Type. In it, either include a link to the Edit Form, or the Edit Form itself.

Now the user can submit a post with the "create new post" form, it will redirect to the post (which is a draft) so no one else can see it generally, and you can apply a Content Template to those posts, where you insert either a Link to as Edit Form, or the edit form itself.

At this point, the user then can edit and submit again.
This edit form sets the post status to published.

You can also avoid the whole draft/publish process, for example you could use a simple Custom Field, that if checked tells any eventual query that the post is "in editing", and would be excluded from any View, for example.
This may be easier than dealing with the drafts and permissions and still allow for the same experience by the user on your site.

#1607057
Form_preview.jpg

> 1. Create an Add new Posts form, with a button "Save work", it drafts the submitted posts, with a redirect it to the new post
Done. See attached - after submitting the Post it redirects it to the Post. So maybe it would open the post in a new Window so that the User can keep the window to the Form open so he/she can edit the Form again before submitting.

> 2. Create an Edit Post Form, which can be used to continue editing the previously saved post, this form publishes the post
>5. Create a Content Template and assign it to your Post Type. In it, either include a link to the Edit Form, or the Edit Form itself.

So you are saying that the Content Template needs to have a link to the Edit Post Form which would pull the previously submitted post in draft form. How does it work that the Draft Post and all its contents are able to be recalled...

So the Edit Post link in the Content Template would need a conditional display in that the Link would only appear if the post is in draft form. This way Users only have the ability to edit Posts in draft form and the Edit Post Form needs to contain a final 'Submit' button.

Is it possible to create 2 buttons in one form- a 'Preview' button which will open a new window and show the Post in draft form and a 'Submit' button which will notify the website that a new post has been submitted.

#1607125

I want to mention that I set the Redirect towards displaying the Post after submission as a way to 'Preview' but the redirection page was not found, probably because it has not been published. So I dont know how to execute the redirect that you suggest if the Post is not published and cannot be seen..

> 1. Create an Add new Posts form, with a button "Save work", it drafts the submitted posts, with a redirect it to the new post

#1608023

Yes, as I mentioned, your user needs the proper rights to see a Draft.
Your Form should create Draft Posts.

Then after submitting the form, it will show the Draft.

You need Toolset Access for this, and control the Draft Access with it, over your Post Type.

I tested the mentioned workflow locally, which produces the desired results, it should hence not be affected by a BUG, but we never know - please let me know if above does not work for you.
I could also look at this closer if I can log in to the site.

#1614033

Hi, Beda is unavailable and I'm checking in on his open tickets. Let me know if you need additional information about using Draft posts and managing permissions for viewing these posts with Access.

Le sujet ‘[Fermé] Uploading Product using Forms’ est fermé à de nouvelles réponses.