Skip Navigation

[Resolved] Content Template will not save to the database

This support ticket is created 6 years, 7 months 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.

Our next available supporter will start replying to tickets in about 8.03 hours from now. Thank you for your understanding.

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 6 replies, has 2 voices.

Last updated by CraigT4149 6 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#694415

I had my first content template working. I was working with it a bit experimenting.

Now each time I save it from the Divi Woocommerce Template Builder, it simply does not save. I tried deleting the template. Created a new one. Deleted the plugin, re-installed it. Same behavior. I hit update from the Divi side and it just reverts back to the previously saved version.

I can save it from the default non-Divi screen but that's pretty pointless.

The rest of Divi seems to be ok as far as the general plugin is concerned.

#694820

I removed my functions.php and recopied the child theme, and that did the trick. Not sure why ...

#695017

Sorry, it's happening again. Assistance would be appreciated. It's very erratic. It simply decides not to save the latest version and it only happens when clicking UPDATE from the Divi Screen before returning to the Content Template screen. Luckily I have been able to save it as a Divi Saved Layout but can't make changes.

#695533

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - we need to check this further why template is not saved. I want you to check following things:
1)
Could you please try to resolve your issue by deactivating all third-party plugins as well as the default theme to check for any possible conflicts with any of the plugins or themes?

2)
- Could you please activate WP_DEBUG from wp-config.php file and send me possible errors for review.
- Do you see any error on your browser's console?

3)
Do you see anything with your server's error log?
More info:
https://toolset.com/documentation/programmer-reference/debugging-sites-built-with-toolset/#php-debugging

Could you please follow above step and share all required details if found.

#698348

So debugging helped.

First there's this:
Notice: Trying to get property of non-object in /var/www/html/wp-content/plugins/woocommerce-views/Class_WooCommerce_Views.php on line 4705

What I think it might be is a custom shortcode I am trying to write which throws the following exception:

Notice: Undefined index: id in /var/www/html/wp-content/themes/Divi-child/functions.php on line 20

Fatal error: Uncaught Error: Call to a member function get_dimensions() on boolean in /var/www/html/wp-content/themes/Divi-child/functions.php:22 Stack trace: #0 /var/www/html/wp-includes/shortcodes.php(319): custom_dimension_function(Array, '', 'wpv_craig_art_d...') #1 [internal function]: do_shortcode_tag(Array) #2 /var/www/html/wp-includes/shortcodes.php(197): preg_replace_callback('/\\[(\\[?)(wpv\\-w...', 'do_shortcode_ta...', '<h5 style="font...') #3 /var/www/html/wp-content/themes/Divi/includes/builder/class-et-builder-element.php(845): do_shortcode('<h5 style="font...') #4 /var/www/html/wp-includes/shortcodes.php(319): ET_Builder_Element->_shortcode_callback(Array, '<h5 style="font...', 'et_pb_text') #5 [internal function]: do_shortcode_tag(Array) #6 /var/www/html/wp-includes/shortcodes.php(197): preg_replace_callback('/\\[(\\[?)(wpv\\-w...', 'do_shortcode_ta...', '[et_pb_text _bu...') #7 /var/www/html/wp-content/themes/Divi/includes/builder/main-structure-elements.php(4642): do_shortcode('[et_pb_text _bu...') #8 / in /var/www/html/wp-content/themes/Divi-child/functions.php on line 22

Which is odd because it prints fine in the UI, but I get this when I try to load Divi Template Builder. I comment out this code and it goes back to working. I did register it in the Settings section of Toolset custom short codes.

Shortcode called by

[wpv_craig_art_dimensions id="[wpv-post-id]"]

functions.php:

add_shortcode('wpv_craig_art_dimensions','custom_dimension_function');
function custom_dimension_function($atts)
{
	$product_id = $atts['id'];
	$product = wc_get_product( $product_id );
	$dimensions = $product->get_dimensions(FALSE);

	if ( ! empty( $dimensions ) ) {
		$data = '<span>' .  $dimensions['height'] . ' X ' .  $dimensions['width'] . ' ' .  get_option( 'woocommerce_dimension_unit' ) . '.</span>';
	}
  	return $data;	
}

Thanks,
Craig

#700515

Minesh
Supporter

Languages: English (English )

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

Well - this is custom code which is eventually beyond the scope of our support policy.

However - I can give you few hints if that helps to fix this issue:

Please try to use following code:

add_shortcode('wpv_craig_art_dimensions','custom_dimension_function');
function custom_dimension_function($atts) {
$a = shortcode_atts( array(
        'id' => '',
       ), $atts );

If($a['id'] != '' and is_numeric($a['id'] )) {
    $product_id = $a['id'];
    $product = wc_get_product( $product_id );
    $dimensions = $product->get_dimensions(FALSE);
 
    if ( ! empty( $dimensions ) ) {
        $data = '<span>' .  $dimensions['height'] . ' X ' .  $dimensions['width'] . ' ' .  get_option( 'woocommerce_dimension_unit' ) . '.</span>';
    }
    return $data;
}   
}
#728271

It seems it was a conflict with the WP-Editor plugin but also I had syntax errors in functions.php which weren't throwing the errors until I enabled debug. Thank you.