Skip Navigation

[Resolved] Content Template Custom Theme Support for Toolset Forms

This support ticket is created 5 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 11 replies, has 2 voices.

Last updated by Nashaat 5 years, 1 month ago.

Assisted by: Minesh.

Author
Posts
#1353077

I have created a metabox that actually works with Toolset Content Template, it shows / Hide elements depending on metabox values.

The issue comes when a Content Template is used for Edit Forms.
I have made following:

1- created a Content Template for WooCommerce single Products
2- created a Toolset form and added it to a Content Template, where i changed the metaboxes to hide many elements
3- try to edit one of the products, the content template has the metabox values of the Content Template for Single Products

This is happening because when editing a product, it's calling the ID of the Product / Content Template and not the ID of content Template of the Form. How to solve this? or what is the best way to call the ID of the content Template of the form?

#1353223

I pulled the ID from the URL path of the content Template like following

$inputClass = 'top_header';
$getPath = basename($_SERVER['REQUEST_URI'], '?' . $_SERVER['QUERY_STRING']);
$pathId =  explode("content-template-id=", $getPath);
$pathId = end($pathId);
$post_meta_val_ct = getMetaValue($pathId,'mytheme_enable_' . $inputClass . '') ? getMetaValue($pathId,'mytheme_enable_' . $inputClass . '') : 'default';

if ( $post_meta_val_ct !='default' ) {

    return $post_meta_val_ct;

}

This works fine, but i am just curious if there is any other simpler solution for this.

#1353375

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Based on the information you shared - I still do not understand anything here.

I need to know what theme you are using?
Could you please send me debug information that will help us to investigate your issue.
=> https://toolset.com/faq/provide-debug-information-faster-support/

Are you using Toolset Create form or Edit form? Based on the code you shared it looks like you may need to customize the things as you already did.

#1353417

I am using a custom theme with own metabox for controlling the Sidebar/Header/Footer/etc..

The Metabox is compatible with Toolset Content-Template (Toolset Blocks). I am using the Views Beta where i create content templates with Toolset Blocks.
The issue is the theme settings for Sidebar/footer/etc are not working when adding an edit post form to it. because the content Template is called like following:

hidden link

let's say
- the ID of the content template for single product is 10
- the ID of the content template where the Edit form is inserted to it is 20

when i try to edit the product it opens the form but it pulls the metabox values of content template with the ID 10. this means if the sidebar is disabled on Content Template with ID 10 and enabled with the content template ID 20, it will render the values of Content Template 10 and not 20 ( so it will be disabled).

I know it's sounds complicated but this was always like this with Content Templates when used for forms. it doesn't matter which Theme is used.

#1353423
Content-Template-for-Edit-Form.jpg

This is an edit Form (for product) added to a content template with the Theme setting metabox.. It doesn't matter what metabox values is it in this Content Template, it will always pull the value of the single product content template instead. to pull the correct value of this form content template i have pulled the id from the URL Path

$inputClass = 'top_header';
$getPath = basename($_SERVER['REQUEST_URI'], '?' . $_SERVER['QUERY_STRING']);
$pathId =  explode("content-template-id=", $getPath);
$pathId = end($pathId);

$pathId will return the ID of the content template of the edit form
example: hidden link

$pathId returns 123

#1353733

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Yes - there is no such option to control this. You need to control this with the custom code you added.

Or

What if you create a new page and add the edit post form to this page directly and pass the ID of post which you want to edit as URL param.

#1353755

Can you tell me more about how i can add an "edit button" to a new Page? and call this page within an edit post link?

example:
1 - crate page and add form to edit products
2- add "Edit Product link" on a product page
3- once clicked it opens the page form and product can be edited?

#1353801

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Try to follow the following steps:
- Create a new page and add Toolset Edit form to it as given under.
For example:

[cred_form form='your-form-slug' post='[wpv-search-term param='product_id']']

- Now, within your view, try to link to the newly created page above as given under:

<a href="link-to-your-page/?product_id="[wpv-post-id]> Edit  Product </a>
#1353815

My issue is resolved now. Thank you!

I just had to insert the ID like following

<a href="<em><u>hidden link</u></em>;"> Edit  Product </a>
#1353817
#1353819

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know the solution I shared helps you to resolve your issue.

I've make that reply private so its not public. Please feel free to mark resolve this ticket 🙂

#1353821

My issue is resolved now. Thank you!