Skip Navigation

[Closed] Edit form only in frontend – continued

This support ticket is created 4 years, 1 month ago. 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.

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)

Author
Posts
#1871661
original-camp.png
edit-camp-form.png

Basically i do not have a preference on how it is being set up - i just need to be able to edit both basic info and then the woocommerce product info.
Right, you need to be able to edit the price and other information stored in each Product post, which is a separate post from the Camp post. Camp has no information about price, only Product has information about price. Since a single Form can only edit one post, multiple Forms are required to edit the Camp and edit the individual Products related to each Camp. Those edit forms are displayed in different locations, and must be submitted individually.

We have already set up the Edit Camp Post Form, and it is working as expected. I've also set up the Edit Product Form and created links to edit each related product using this Edit Product Form, and inserted them in the design. Those Edit Product Links are displayed in two locations:
1. In the original Camp post page, we are displaying links to edit each related Product in the list of related Products. See original-camp.png. This Camp/Product example is a bit confusing because both the Camp post and the related Product post have the same title: VB Begynder camp. In a real-world scenario, the Camp and its related Products should probably have different titles for clarity because they represent different things.

2. In the Edit Camp Form page, we are displaying Edit Product Links for each of those related Products. See edit-camp-form.png. Again, this Camp/Product example is a bit confusing because both the Camp post and the related Product post have the same title: VB Begynder camp. In a real-world scenario, the Camp and its related Products should probably have different titles for clarity because they represent different things.

When you click one of the Edit Product Links highlighted in the screenshots here, you will be redirected to a Form where you can edit the price and other information for that specific Product post.

What else do you need to accomplish?

#1871815

Hi Christian,

I see that it works now! And I can understand what you mean by product and camp having different names. It is a bit confusing!

So right now, when i press "rediger camp" and edit the camp post: Do i have to press "Submit" to save before i can click on the edit link for the product?

Also, is it possible to have both of the links in the top of the page right under the cover image?
If it is possible to change the name of the link, maybe we can call them separate things like: "Edit basic info" and "Edit price etc." to make it less confusing?

#1871883

So right now, when i press "rediger camp" and edit the camp post: Do i have to press "Submit" to save before i can click on the edit link for the product?
Yes, it is required to press Submit to save the Camp post. If you click one of the Edit Product Links before clicking Submit, none of the changes in the Camp form will be saved. If these links are too confusing, I suggest you remove the View of Edit Product Links at the bottom of the Content Template here:
hidden link
Delete the View block and these links will disappear from the Edit Camp Form page.

Also, is it possible to have both of the links in the top of the page right under the cover image?
Since Camps and Products are in a one-to-many (O2M) relationship, it is possible that many Products can be related to one Camp. Therefore, a View is required to loop over all the related product posts and generate that Edit Product Link for each Product.

Right now, the Edit Product Links are displayed inside an existing View of related Product posts. If you want to move those Edit Product Links outside of the View of related Products, you must create a second View of related Product posts to produce those links elsewhere. You would delete the Edit Product Links from the current related Product View's loop by deleting the Fields and Text block. Instead of displaying all the Product information in the new View of Product posts, you would display only the Edit Product Link, using a Fields and Text block as I described before. Then place the new View of related Products in the Camp Content Template wherever you want to display those links to edit each related Product.

If it is possible to change the name of the link, maybe we can call them separate things like: "Edit basic info" and "Edit price etc." to make it less confusing?
You can modify the text for each Edit Post link in the Block Editor. In the Fields and Text block that generates each link, you can delete the contents of the block and click the Forms icon again in the block toolbar to generate a new Edit Post Link with any text you want. Or delete the entire Fields and Text block and create a new one, then follow those same instructions in the new block.

#1874769

Hi Christian,

I have tried following your writing, and i must admit that it is pretty hard to understand and follow, when i haven't been a part of it.

Status is that i removed the Edit product link from the Edit post form as you suggested.
Then i wanted to do the following but could not succeed:

1) Move the Edit product link from the buttom of the template to the top of the template right next to the Edit post link

2) Rename the Edit product name link from "Edit (camp name)" to "Rediger priser, antal pladser mm."

#1874923

1) Move the Edit product link from the buttom of the template to the top of the template right next to the Edit post link
My previous instructions were:
"Right now, the Edit Product Links are displayed inside an existing View of related Product posts. If you want to move those Edit Product Links outside of the View of related Products, you must create a second View of related Product posts to produce those links elsewhere. You would delete the Edit Product Links from the current related Product View's loop by deleting the Fields and Text block. Instead of displaying all the Product information in the new View of Product posts, you would display only the Edit Product Link, using a Fields and Text block as I described before. Then place the new View of related Products in the Camp Content Template wherever you want to display those links to edit each related Product."

So the first step is to create a new View Block in your Content Template where you want to display the new edit Product links. I don't see this View added to your template yet, so you must create one here:
hidden link
When creating the View, you must add a post relationship Query Filter, so that only Products related to the Camp post being displayed are included in the results. This documentation explains how to add Query Filters to a View:
https://toolset.com/course-lesson/creating-a-view/#filter-the-list-of-posts
You can also check the configurations for the "Camp product" View to see how this Query Filter should be set up.

In the Loop of this new View, insert a Fields and Text Block. I provided instructions here to insert an Edit Post Link for each Product post using a Fields and Text block already here: https://toolset.com/forums/topic/edit-form-only-in-frontend-continued/#post-1870563

I suggest you perform these modifications yourself so you become more comfortable maintaining your content. If there is one specific step in this process that is not clear, feel free to elaborate and I can give you more detailed information.

2) Rename the Edit product name link from "Edit (camp name)" to "Rediger priser, antal pladser mm."
Select the corresponding Fields and Text block in the View block of your Content Template here: hidden link
When the Fields and Text block is selected, you can highlight and delete the existing link. Then, create a new one by clicking the Forms icon above the text editor area of this block. I have uploaded a recording showing how to make changes to the link text in an existing Edit Post Link:
https://drive.google.com/file/d/1j4xXQj4d9PYR28Jtwe8y2Q9upnxpawpf/view?usp=sharing

Or, you can delete the existing Fields and Text block and create a new one following the instructions here: https://toolset.com/forums/topic/edit-form-only-in-frontend-continued/#post-1870563

I have tried following your writing, and i must admit that it is pretty hard to understand and follow, when i haven't been a part of it.
I understand, and this is exactly why I think it is important for you to perform these changes yourself. Otherwise, the whole setup will never be clear and you will always need a supporter to help you perform tasks that you could accomplish in wp-admin without supporter assistance. It will help you save time in the future, if you invest the time now to understand how it works. So please tell me exactly where you are having trouble and I will do my best to explain the process in more detail.

The topic ‘[Closed] Edit form only in frontend – continued’ is closed to new replies.