Booknetic Conditional Prices

Download Link:

This is a support topic for Booknetic Conditional Prices

The intention of this topic is to give you the opportunity to discuss problems and difficulties with other Festinger Vault customers, e.g. how to address incompatibilities or fix bugs, report malfunctioning features, or get help on how to configure this download.

:warning: You can ask us for update requests here as well! :love_you_gesture:

To request an update of a particular theme or plugin, kindly let us know your preferred version number and we will update it as soon as possible. Although update requests usually do not make much sense because we publish them as soon as they are available and we have the time to upload them.

Good day!

I’ve encountered an unexpected issue while trying to use the Booknetic Conditional Prices addon and would appreciate any advice. Here’s a summary of the problem and the steps I’ve taken:

  • Upon trying to add a Conditional Price in the Booknetic addon, I received an error indicating the absence of a table in the database. The error message was: ‘PHP message: WordPress database error Table ‘ytpmfrbngm.wp_bkntc_conditional_prices’ doesn’t exist for query SELECT COUNT’.
  • I reinstalled the Conditional Prices addon. During installation, I encountered a PHP error: ‘PHP message: PHP Warning: Invalid argument supplied for foreach() in /home/991299.cloudwaysapps.com/ytpmfrbngm/public_html/wp-content/plugins/booknetic/app/Providers/Core/Backend.php on line 452’, with the referer: https://mydomain.com/wp-admin/update.php?action=upload-plugin.
  • I deactivated all Booknetic plugins.
  • I reinstalled the main Booknetic plugin, which went smoothly without errors.
  • On installing the Booknetic Conditional Prices plugin again, I encountered the same error as before.

Has anyone else experienced this issue? Any insights would be greatly appreciated. Thank you.

The code in /home/991299.cloudwaysapps.com/ytpmfrbngm/public_html/wp-content/plugins/booknetic/app/Providers/Core/Backend.php:

451
452         foreach ( $migrations as $migrationStep )
453         {
454             if ( $migrationStep[ 'type' ] === 'sql' )
455             {
456                 $sql = str_replace( [ '{tableprefix}', '{tableprefixbase}' ] , [ DB::DB()->base_prefix . DB::PLUGIN_DB_PREFIX, DB::DB()->base_prefix ] , base64_decode( $migrationStep[ 'data' ] ) );
457
458                 foreach( preg_split( '/;\n|;\r/', $sql, -1, PREG_SPLIT_NO_EMPTY ) AS $sqlQueryOne )
459                 {
460                     $sqlQueryOne = trim( $sqlQueryOne );
461
462                     if ( empty( $sqlQueryOne ) ) continue;
463
464                     try {
465                         DB::DB()->query( $sqlQueryOne );
466                     } catch (\Exception $e) {}
467                 }
468             }
469             else if  ( $migrationStep[ 'type' ] === 'script' )
470             {
471                 $migrationFile  = base64_decode( $migrationStep[ 'data' ] );

You need to insert new table into DB manually then it works properly. I think the new table will only be added to the database automatically if you install the plugin from “boostore”, if you install it manually, then not.
Database table name: prefix_bkntc_conditional_prices

Plugin expects the following columns in database:

        $id = Helper::_post( 'id', 0, 'int' );
        $label = Helper::_post( 'label', '', 'string' );
        $color = Helper::_post( 'color', '', 'string' );
        $type = Helper::_post( 'type', '', 'string', [ 'addition', 'discount' ] );
        $amount = Helper::_post( 'amount', 0, 'float' );
        $amount_type = Helper::_post( 'amount_type', '', 'string', [ 'percent', 'price' ] );
        $price_source = Helper::_post( 'price_source', null, 'string', [ 'sum_price', 'service_price' ] );
        $start_date = Date::reformatDateFromCustomFormat( Helper::_post( 'start_date', 0, 'string' ) );
        $end_date = Date::reformatDateFromCustomFormat( Helper::_post( 'end_date', 0, 'string' ) );
        $is_active = Helper::_post( 'is_active', 0, 'int', [ 0,1 ] );
        $conditions = Helper::_post( 'conditions', '', 'json' );
2 Likes

Awesome! I’ll take your advice.
Thanks for the help; it should work for me. I’ll do it in the next 1-2 days and see how it goes.

Booknetic Conditional Prices has been updated to 1.0.6. You can download this version from here.