• The plugin works fine but I get an error in Breakdance page builder when the plugin is active

    Breakdance\Lib\Vendor\Whoops\Exception\ErrorException:?Undefined property: WP_Error::$description?in?/home/juniorgems/public_html/wp-content/plugins/markup-by-attribute-for-woocommerce/src/utility/general.php?on?81

    // Add markup description to attribute terms
    $results = $wpdb->get_results(“SELECT * FROM {$wpdb->prefix}termmeta WHERE meta_key LIKE ‘mt2mba_markup'”);
    foreach ($results as $row) {
    $term = get_term((integer) $row->term_id);
    $description = trim($this->remove_bracketed_string(ATTRB_MARKUP_DESC_BEG, ATTRB_MARKUP_END, trim($term->description)));
    $description .= PHP_EOL . ATTRB_MARKUP_DESC_BEG . $row->meta_value . ATTRB_MARKUP_END;
    wp_update_term($row->term_id, $term->taxonomy, array(‘description’ => trim($description)));
    }

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Mark Tomlinson

    (@marktomlinson)

    Interesting. You are going through a section of code that you probably shouldn’t be going through. My hunch is that an if() statement several steps ahead incorrectly assumes a database update is necessary. That’s easy enough to test and correct.

    You say, “The plugin is working fine”, so, can I assume this is not a fatal error? I’m working on a new release right now that I hope to get out by the end of next week, and I’d like to put this into it.

    Thread Starter rzareianfard

    (@rzareianfard)

    Hi Mark,

    Thanks for your reply,

    This plugin works but unfortunately it is breaking Breakdance editor completely due to this error and not letting me to even open the page builder, so it’s a blocker atm.

    Cheers,

    Plugin Author Mark Tomlinson

    (@marktomlinson)

    Oh. Ouch. The code in question is for upgrades from version 1.0, a long time ago, and I only left it in out of an abundance of caution. Breakdance shouldn’t be wandering there, but I can’t fix them.

    What I can do, however, is give you a workaround until I get the next release out. We’ll just delete the offending code. Navigate on your WordPress dashboard to Plugins ? Plugin File Editor. From there, select Markup by Attribute for WooCommerce. Then, you can navigate to markup-by-attribute-for-woocommerce/src/utility/general.php. Once you see general.php in the editor, delete lines 65 through 114.

    65		// --------------------------------------------------------------
    66 // Update database from version 1.x. Leave 1.x data for fallback.
    67 // --------------------------------------------------------------
    68 if ($current_db_version < 2.0) {
    69 // Add prefix to attribute markup meta data key
    .
    . DELETE ALL OF THIS, FROM LINES 65 TO 114
    .
    110 // Clean database for conversion from version 2.3.
    111 $wpdb->delete("{$wpdb->prefix}options", array('option_name'=>'mt2mba_decimal_points'));
    112 $wpdb->delete("{$wpdb->prefix}options", array('option_name'=>'mt2mba_symbol_before'));
    113 $wpdb->delete("{$wpdb->prefix}options", array('option_name'=>'mt2mba_symbol_after'));
    114 }

    Then, [Update File].

    That should take care of it for now. I’ll put some more robust version checking in the release I’m working on, and that might fix it in the future. Might… there is no reason Breakdance should be in that code, so I’m only guessing it has to do with the if() on line 68.

    Plugin Author Mark Tomlinson

    (@marktomlinson)

    I’ve restructured that section of code in release 4.3 and greater. Breakdance shouldn’t have a problem with it now.

    Or, at least, it shouldn’t. The working theory is that the first installation never got to the point of recording the database version, so Breakdance continued to loop through, breaking every time. I’m now using the PHP command version_compare(), which should solve the problem.

    Please let me know if it works.

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.