Plugin Directory

Changeset 3315238


Ignore:
Timestamp:
06/20/2025 12:24:34 PM (8 months ago)
Author:
homescript
Message:

update plugin to version 1.9 for doko

Location:
doko-box-builder
Files:
314 added
23 edited

Legend:

Unmodified
Added
Removed
  • doko-box-builder/trunk/README.txt

    r3230317 r3315238  
    1 === DokoBuilder : The Ultimate dynamic bundle builder for WooCommerce  ===
     1=== Doko Bundle Builder : The Ultimate dynamic bundle builder for WooCommerce  ===
    22Contributors: homescript, freemius
    33Donate link: https://www.buymeacoffee.com/homescriptone
    44Tags: woocommerce bundles, bundle pricing, fast checkout, cart, woocommerce sales
    55Requires at least: 4.4
    6 Requires PHP : 7.4
    7 Tested up to: 6.7
    8 Stable tag: 1.8
     6Requires PHP : 8.0
     7Tested up to: 6.8
     8Stable tag: 1.9
    99License: GPLv2 or later
    1010License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1111Requires Plugins: woocommerce
    1212
    13 Boost sales with our bundle builder, allowing WooCommerce customers to create personalized bundles. Enjoy accurate pricing, increased average order value, and enticing discounts.
     13Enable bundle building in WooCommerce. Increase sales and order value with accurate pricing and smart discounts.
    1414
    1515== Description ==
    1616
    17 [DokoBuilder for WooCommerce](https://ultiwp.com/plugins/doko) is an easy bundle builder plugin for your WooCommerce store. It allows you to create bundle pages using your unsold products from various categories. On these pages, customers can choose and combine the products they want to buy in their preferred way.
     17[Doko Bundle Builder for WooCommerce](https://ultiwp.com/plugins/doko) is an easy bundle builder plugin for your WooCommerce store. It allows you to create bundle pages using your unsold products from various categories. On these pages, customers can choose and combine the products they want to buy in their preferred way.
    1818
    1919https://youtu.be/0CKWYVGPcAI?si=j0N1gZQQ1egWhwVU
    2020
    2121Would you like to see the plugin in action before installing it?
    22 We have a [DokoBuilder for WooCommerce demo website](https://demos.homescriptone.com/doko/our-demos/) showcasing all of the use case of the plugin!
     22We have a [Doko Bundle Builder for WooCommerce demo website](https://demos.homescriptone.com/doko/our-demos/) showcasing all of the use case of the plugin!
    2323
    2424= Features =
    25 An overview of DokoBuilder for WooCommerce features:
     25An overview of Doko Bundle Builder for WooCommerce features:
    2626* Compatible with both the Classic Editor and new **Gutenberg** editor,
    2727* Easy workflow to transform any post or page into a bundle builder page,
     
    5252
    5353<h4>Documentation</h4>
    54 <p>Find how to configure DokoBuilder <a href="https://docs.homescriptone.com/wordpress-plugins/doko-builder-the-ultimate-dynamic-bundle-builder-for-woocommerce?utm_source=wordpress" rel="follow">here</a></p>
     54<p>Find how to configure Doko Bundle Builder <a href="https://docs.homescriptone.com/wordpress-plugins/doko-builder-the-ultimate-dynamic-bundle-builder-for-woocommerce?utm_source=wordpress" rel="follow">here</a></p>
    5555
    5656
    5757<h4>Translation</h4>
    58 You can <a href="https://translate.wordpress.org/projects/wp-plugins/doko-box-builder/" rel="nofollow ugc">translate DokoBuilder</a> on <a href="https://translate.wordpress.org/projects/wp-plugins/doko-box-builder/" rel="nofollow ugc">translate.wordpress.org</a>.
     58You can <a href="https://translate.wordpress.org/projects/wp-plugins/doko-box-builder/" rel="nofollow ugc">translate Doko Bundle Builder</a> on <a href="https://translate.wordpress.org/projects/wp-plugins/doko-box-builder/" rel="nofollow ugc">translate.wordpress.org</a>.
    5959
    6060<h4>Installation </h4>
    6161= Automatic installation =
    6262
    63 Automatic installation is the easiest option -- WordPress will handles the file transfer, and you won’t need to leave your web browser. To do an automatic install of DokoBuilder, log in to your WordPress dashboard, navigate to the Plugins menu, and click “Add New.”
     63Automatic installation is the easiest option -- WordPress will handles the file transfer, and you won’t need to leave your web browser. To do an automatic install of Doko Bundle Builder, log in to your WordPress dashboard, navigate to the Plugins menu, and click “Add New.”
    6464
    65 In the search field type “DokoBuilder” then click “Search Plugins.” Once you’ve found us,  you can view details about it such as the point release, rating, and description. Most importantly of course, you can install it by! Click “Install Now,” and WordPress will take it from there.
     65In the search field type “Doko Bundle Builder” then click “Search Plugins.” Once you’ve found us,  you can view details about it such as the point release, rating, and description. Most importantly of course, you can install it by! Click “Install Now,” and WordPress will take it from there.
    6666
    6767= Manual installation =
    6868
    69 Manual installation method requires downloading the DokoBuilder plugin and uploading it to your web server via your favorite FTP application. The WordPress codex contains [instructions on how to do this here](https://wordpress.org/support/article/managing-plugins/#manual-plugin-installation).
     69Manual installation method requires downloading the Doko Bundle Builder plugin and uploading it to your web server via your favorite FTP application. The WordPress codex contains [instructions on how to do this here](https://wordpress.org/support/article/managing-plugins/#manual-plugin-installation).
    7070
    7171
     
    8080
    8181= Where can I find a demo and some more documentation? =
    82 Check out the [DokoBuilder demo collections website](https://demos.homescriptone.com/doko/our-demos/) and [DokoBuilder documentation](https://docs.homescriptone.com/wordpress-plugins/doko-builder-the-ultimate-dynamic-bundle-builder-for-woocommerce) for more information on all of the features!
     82Check out the [Doko Bundle Builder demo collections website](https://demos.homescriptone.com/doko/our-demos/) and [Doko Bundle Builder documentation](https://docs.homescriptone.com/wordpress-plugins/doko-builder-the-ultimate-dynamic-bundle-builder-for-woocommerce) for more information on all of the features!
    8383
    8484= Do you offer any support? =
     
    8686
    8787== Changelog ==
     88<h4> 1.9 - 4 April 2025 </h4>
     89<ul>
     90    <li> Include a modal describing the total showned in navigation bar,</li>
     91    <li> Add new filters for discounts add-on.</li>
     92    <li> Display variation correct name in list.</li>
     93    <li> Fix issue variation product in bundle page,</li>
     94    <li> Show/Hide hidden products in bundle page.</li>
     95    <li> Improve the modal of product description.</li>
     96    <li> Include custom product type in product bundle loop.</li>
     97    <li> Fix issue with variation not display properly,</li>
     98    <li> Add more details for description modal.</li>
     99    <li> Fix issue with conditional rules not running.</li>
     100</ul>
    88101<h4> 1.8 - 22 January 2025 </h4>
    89102<ul>
  • doko-box-builder/trunk/admin/class-hs-doko-admin.php

    r3230317 r3315238  
    104104        if ( in_array( $post_type, $allowed_slugs['post_type'], true ) || in_array( $parent_file, $allowed_slugs['page'], true ) ) {
    105105            wp_enqueue_style(
    106                 'select2',
     106                'doko-select2',
    107107                plugin_dir_url( __FILE__ ) . 'css/doko-select2.css',
    108108                array(),
     
    118118            );
    119119            wp_enqueue_style( 'jquery-ui' );
    120             wp_enqueue_style( 'select2' );
     120            wp_enqueue_style( 'doko-select2' );
    121121            wp_enqueue_style(
    122122                'hs-corecss',
     
    156156        $allowed_slugs = hs_dk_get_allowed_slug();
    157157        if ( in_array( $post_type, $allowed_slugs['post_type'], true ) || in_array( $parent_file, $allowed_slugs['page'], true ) ) {
     158            wp_enqueue_script(
     159                'hs-select2',
     160                plugin_dir_url( __FILE__ ) . 'js/hs-doko-select2.js',
     161                array('jquery'),
     162                $this->version,
     163                false
     164            );
    158165            wp_enqueue_script(
    159166                'hs-blockUI-js',
     
    189196            $asset_lists = array(
    190197                'jquery',
    191                 'select2',
     198                'hs-select2',
     199                // 'select2',
    192200                'jquery-ui-core',
    193201                'jquery-ui-accordion',
     
    195203                'jquery-ui-widget',
    196204                'wp-hooks',
    197                 'jquery-tiptip'
     205                'jquery-tiptip',
    198206            );
    199207            wp_enqueue_script(
     
    204212                false
    205213            );
    206             wp_enqueue_script(
    207                 $this->plugin_name . '-bg-admin',
    208                 plugin_dir_url( __FILE__ ) . 'js/hs-doko-bg-admin.js',
    209                 $asset_lists,
    210                 $this->version,
    211                 false
    212             );
    213             // include codemirror
    214             $cm_settings = array();
    215             $cm_settings['codeEditor'] = wp_enqueue_code_editor( array(
    216                 'type' => 'text/css',
    217             ) );
    218             wp_localize_script( 'jquery', 'cm_settings', $cm_settings );
    219             wp_enqueue_script( 'wp-theme-plugin-editor' );
    220             wp_enqueue_style( 'wp-codemirror' );
    221             wp_register_style(
    222                 'woocommerce_admin_styles',
    223                 WC()->plugin_url() . '/assets/css/admin.css',
    224                 array(),
    225                 $this->version
    226             );
    227             wp_enqueue_style( 'woocommerce_admin_styles' );
    228             wp_enqueue_style( 'jquery-ui-style' );
     214            if ( 'doko-bundles' == $post_type ) {
     215                wp_enqueue_script(
     216                    $this->plugin_name . '-bundle',
     217                    plugin_dir_url( __FILE__ ) . 'js/hs-doko-bundle.js',
     218                    $asset_lists,
     219                    $this->version,
     220                    false
     221                );
     222                wp_enqueue_script(
     223                    $this->plugin_name . '-bg-admin',
     224                    plugin_dir_url( __FILE__ ) . 'js/hs-doko-bg-admin.js',
     225                    $asset_lists,
     226                    $this->version,
     227                    false
     228                );
     229                // include codemirror
     230                $cm_settings = array();
     231                $cm_settings['codeEditor'] = wp_enqueue_code_editor( array(
     232                    'type' => 'text/css',
     233                ) );
     234                wp_localize_script( 'jquery', 'cm_settings', $cm_settings );
     235                wp_enqueue_script( 'wp-theme-plugin-editor' );
     236                wp_enqueue_style( 'wp-codemirror' );
     237                wp_register_style(
     238                    'woocommerce_admin_styles',
     239                    WC()->plugin_url() . '/assets/css/admin.css',
     240                    array(),
     241                    $this->version
     242                );
     243                wp_enqueue_style( 'woocommerce_admin_styles' );
     244                wp_enqueue_style( 'jquery-ui-style' );
     245            }
     246            if ( 'doko-bundles-rules' == $post_type ) {
     247                wp_enqueue_script(
     248                    $this->plugin_name . '-bundle-rules',
     249                    plugin_dir_url( __FILE__ ) . 'js/hs-doko-rules.js',
     250                    $asset_lists,
     251                    $this->version,
     252                    false
     253                );
     254            }
    229255            $saved_data = $this->get_data();
    230256            /**
     
    234260             */
    235261            $data = apply_filters( 'hs_dk_admin_js_object_data', array(
    236                 'pick_product_message'  => esc_html__( 'Enter your product(s) name(s)', 'doko' ),
    237                 'pick_category_message' => esc_html__( 'Enter your categorie(s) name(s)', 'doko' ),
     262                'pick_product_message'  => esc_html__( 'Enter your product(s) name(s)', 'doko-bundle-builder' ),
     263                'pick_category_message' => esc_html__( 'Enter your categorie(s) name(s)', 'doko-bundle-builder' ),
    238264            ) );
    239265            if ( $saved_data ) {
     
    261287        add_submenu_page(
    262288            'edit.php?post_type=doko-bundles',
    263             esc_html__( 'Documentation', 'doko' ),
    264             esc_html__( 'Documentation', 'doko' ),
     289            esc_html__( 'Documentation', 'doko-bundle-builder' ),
     290            esc_html__( 'Documentation', 'doko-bundle-builder' ),
    265291            'manage_woocommerce',
    266292            'doko-docs',
     
    340366    public function define_custom_post_type() {
    341367        $box_labels = array(
    342             'name'               => esc_html__( 'Bundles', 'doko' ),
    343             'singular_name'      => esc_html__( 'Bundle', 'doko' ),
    344             'add_new'            => esc_html__( 'New Bundle', 'doko' ),
    345             'add_new_item'       => esc_html__( 'New Bundle', 'doko' ),
    346             'edit_item'          => esc_html__( 'Edit Bundle', 'doko' ),
    347             'new_item'           => esc_html__( 'New Bundle', 'doko' ),
    348             'view_item'          => esc_html__( 'View Bundle', 'doko' ),
    349             'search_items'       => esc_html__( 'Search Bundle', 'doko' ),
    350             'not_found'          => esc_html__( 'No Bundle found', 'doko' ),
    351             'not_found_in_trash' => esc_html__( 'No Bundle in the trash', 'doko' ),
    352             'menu_name'          => esc_html__( 'Bundles', 'doko' ),
     368            'name'               => esc_html__( 'Bundles', 'doko-bundle-builder' ),
     369            'singular_name'      => esc_html__( 'Bundle', 'doko-bundle-builder' ),
     370            'add_new'            => esc_html__( 'New Bundle', 'doko-bundle-builder' ),
     371            'add_new_item'       => esc_html__( 'New Bundle', 'doko-bundle-builder' ),
     372            'edit_item'          => esc_html__( 'Edit Bundle', 'doko-bundle-builder' ),
     373            'new_item'           => esc_html__( 'New Bundle', 'doko-bundle-builder' ),
     374            'view_item'          => esc_html__( 'View Bundle', 'doko-bundle-builder' ),
     375            'search_items'       => esc_html__( 'Search Bundle', 'doko-bundle-builder' ),
     376            'not_found'          => esc_html__( 'No Bundle found', 'doko-bundle-builder' ),
     377            'not_found_in_trash' => esc_html__( 'No Bundle in the trash', 'doko-bundle-builder' ),
     378            'menu_name'          => esc_html__( 'Bundles', 'doko-bundle-builder' ),
    353379        );
    354380        // initialize the Box CPT metabox.
    355381        $box_args = $this->get_default_cpt_args( 'dashicons-screenoptions' );
    356382        $box_args['labels'] = $box_labels;
    357         $box_args['description'] = esc_html__( 'Bundle', 'doko' );
     383        $box_args['description'] = esc_html__( 'Bundle', 'doko-bundle-builder' );
    358384        register_post_type( 'doko-bundles', $box_args );
    359385        /**
     
    386412        add_meta_box(
    387413            'doko-box-settings',
    388             esc_html__( 'First Screen setup', 'doko' ),
     414            esc_html__( 'First Screen setup', 'doko-bundle-builder' ),
    389415            array($this, 'get_box_settings'),
    390416            'doko-bundles',
     
    419445    public function get_box_settings() {
    420446        $data = $this->get_data();
    421         echo wp_kses_post( esc_html__( 'This refers to the first navigation screen of the bundle builder : ', 'doko' ) );
     447        echo wp_kses_post( esc_html__( 'This refers to the first navigation screen of the bundle builder : ', 'doko-bundle-builder' ) );
    422448        formulus_format_fields( '<br/><br/>' );
    423449        /**
     
    428454        $table_args = apply_filters( 'doko_box_table_fields', array(
    429455            'box-description'     => array(
    430                 'label'       => esc_html__( 'Title', 'doko' ),
     456                'label'       => esc_html__( 'Title', 'doko-bundle-builder' ),
    431457                'label_class' => 'doko-table-label',
    432458                'tr_class'    => 'doko-box-description',
    433459                'description' => wp_sprintf(
    434460                    /* translators: %s: strong tag */
    435                     esc_html__( 'Title to show on top of the bundle selector.%1$1sEg:%2$2s CHOOSE YOUR BOX COLOR ', 'doko' ),
     461                    esc_html__( 'Title to show on top of the bundle selector.%1$1sEg:%2$2s CHOOSE YOUR BOX COLOR ', 'doko-bundle-builder' ),
    436462                    '<br/> <strong>',
    437463                    '</strong>'
    438464                 ),
    439                 'content'     => '<textarea id="doko-box-description" name="doko[box-description]" >' . wp_kses_post( ( isset( $data['box-description'] ) ? $data['box-description'] : esc_html__( 'CHOOSE YOUR BOX COLOR', 'doko' ) ) ) . '</textarea><input type="hidden" name="doko[bundle-title]" />',
     465                'content'     => '<textarea id="doko-box-description" name="doko[box-description]" >' . wp_kses_post( ( isset( $data['box-description'] ) ? $data['box-description'] : esc_html__( 'CHOOSE YOUR BOX COLOR', 'doko-bundle-builder' ) ) ) . '</textarea><input type="hidden" name="doko[bundle-title]" />',
    440466            ),
    441467            'box-selection-mode'  => array(
    442                 'label'       => esc_html__( 'Display according to :', 'doko' ),
     468                'label'       => esc_html__( 'Display according to :', 'doko-bundle-builder' ),
    443469                'label_class' => 'doko-table-label',
    444470                'content'     => formulus_input_fields( 'doko[box-selection-mode]', $this->get_package_selection_options() + array(
     
    451477            ),
    452478            'box-products-mode[]' => array(
    453                 'label'       => esc_html__( 'Products to display :', 'doko' ),
    454                 'label_class' => 'doko-table-label',
    455                 'description' => esc_html__( 'Define the products, your customers are allowed to pick to fill this step in the bundle.', 'doko' ),
     479                'label'       => esc_html__( 'Products to display :', 'doko-bundle-builder' ),
     480                'label_class' => 'doko-table-label',
     481                'description' => esc_html__( 'Define the products, your customers are allowed to pick to fill this step in the bundle.', 'doko-bundle-builder' ),
    456482                'content'     => formulus_input_fields( 'doko[box-products][]', $this->get_dynamic_select_options( 'products', 'box-products', hs_dk_get_data( ( isset( $data['box-products'] ) ? $data['box-products'] : array() ), true ) ) ),
    457483                'tr_class'    => 'doko-box-products-mode',
    458484            ),
    459485            'box-categories-mode' => array(
    460                 'label'       => esc_html__( 'Categories to display :', 'doko' ),
    461                 'label_class' => 'doko-table-label',
    462                 'description' => esc_html__( 'Define the products categories, your customers are allowed to pick to fill this step in the bundle.', 'doko' ),
     486                'label'       => esc_html__( 'Categories to display :', 'doko-bundle-builder' ),
     487                'label_class' => 'doko-table-label',
     488                'description' => esc_html__( 'Define the products categories, your customers are allowed to pick to fill this step in the bundle.', 'doko-bundle-builder' ),
    463489                'content'     => formulus_input_fields( 'doko[box-categories][]', $this->get_dynamic_select_options( 'categories', 'box-categories', hs_dk_get_data( ( isset( $data['box-categories'] ) ? $data['box-categories'] : array() ) ) ) ),
    464490                'tr_class'    => 'doko-box-categories-mode',
     
    467493        $table_args += array(
    468494            'enable-screen-redirect'   => array(
    469                 'label'       => esc_html__( 'Enable auto redirect to next page :', 'doko' ),
    470                 'label_class' => 'doko-table-label',
    471                 'description' => esc_html__( 'Redirect automatically to next step, if customers add a product to the box.', 'doko' ),
     495                'label'       => esc_html__( 'Enable auto redirect to next page :', 'doko-bundle-builder' ),
     496                'label_class' => 'doko-table-label',
     497                'description' => esc_html__( 'Redirect automatically to next step, if customers add a product to the box.', 'doko-bundle-builder' ),
    472498                'content'     => formulus_input_fields( 'doko[enable-screen-redirect]', array(
    473499                    'type'    => 'select',
    474500                    'options' => array(
    475                         'yes' => esc_html__( 'Yes', 'doko' ),
    476                         'no'  => esc_html__( 'No', 'doko' ),
     501                        'yes' => esc_html__( 'Yes', 'doko-bundle-builder' ),
     502                        'no'  => esc_html__( 'No', 'doko-bundle-builder' ),
    477503                    ),
    478504                ), ( isset( $data['enable-screen-redirect'] ) ? $data['enable-screen-redirect'] : 'yes' ) ),
    479505            ),
    480506            'no-products-message'      => array(
    481                 'label'       => esc_html__( 'No products message :', 'doko' ),
    482                 'label_class' => 'doko-table-label',
    483                 'description' => esc_html__( 'Message to display, if no products is added to the box.', 'doko' ),
     507                'label'       => esc_html__( 'No products message :', 'doko-bundle-builder' ),
     508                'label_class' => 'doko-table-label',
     509                'description' => esc_html__( 'Message to display, if no products is added to the box.', 'doko-bundle-builder' ),
    484510                'content'     => formulus_input_fields( 'doko[no-products-message]', array(
    485511                    'type' => 'textarea',
     
    488514            ),
    489515            'enable-bottom-navigation' => array(
    490                 'label'       => esc_html__( 'Show/Hide the bundle navigation bar :', 'doko' ),
    491                 'label_class' => 'doko-table-label',
    492                 'description' => esc_html__( 'Whether the bundle navigation bar, should always be shown once the page is loaded. By default, it will be showned only if customers add something to the box.', 'doko' ),
     516                'label'       => esc_html__( 'Show/Hide the bundle navigation bar :', 'doko-bundle-builder' ),
     517                'label_class' => 'doko-table-label',
     518                'description' => esc_html__( 'Whether the bundle navigation bar, should always be shown once the page is loaded. By default, it will be showned only if customers add something to the box.', 'doko-bundle-builder' ),
    493519                'content'     => formulus_input_fields( 'doko[enable-bottom-navigation]', array(
    494520                    'type'     => 'select',
    495521                    'options'  => array(
    496                         'yes' => __( 'Yes', 'doko' ),
    497                         'no'  => __( 'No', 'doko' ),
     522                        'yes' => __( 'Yes', 'doko-bundle-builder' ),
     523                        'no'  => __( 'No', 'doko-bundle-builder' ),
    498524                    ),
    499525                    'tr_class' => 'doko-enable-bottom-navigation',
     
    516542            'enable-child-product-display' => array(
    517543                'key'     => 'enable-child-product-display',
    518                 'label'   => esc_html__( 'Display the bundle contents into the cart and checkout page', 'doko' ),
     544                'label'   => esc_html__( 'Display the bundle contents into the cart and checkout page', 'doko-bundle-builder' ),
    519545                'name'    => 'doko[enable-child-product-display]',
    520546                'type'    => 'select',
    521547                'options' => array(
    522                     'yes' => __( 'Yes', 'doko' ),
    523                     'no'  => __( 'No', 'doko' ),
     548                    'yes' => __( 'Yes', 'doko-bundle-builder' ),
     549                    'no'  => __( 'No', 'doko-bundle-builder' ),
    524550                ),
    525551                'default' => ( isset( $data['enable-child-product-display'] ) ? $data['enable-child-product-display'] : 'no' ),
     
    527553            'last-step-title'              => array(
    528554                'key'     => 'last-step-title',
    529                 'label'   => esc_html__( 'Title to use on the latest step page', 'doko' ),
     555                'label'   => esc_html__( 'Title to use on the latest step page', 'doko-bundle-builder' ),
    530556                'name'    => 'doko[last-step-title]',
    531557                'type'    => 'textarea',
     
    535561                'key'     => 'last-step-description',
    536562                'type'    => 'textarea',
    537                 'label'   => esc_html__( 'Description to use on the latest step page after the last step title section', 'doko' ),
     563                'label'   => esc_html__( 'Description to use on the latest step page after the last step title section', 'doko-bundle-builder' ),
    538564                'name'    => 'doko[last-step-description]',
    539565                'default' => ( isset( $data['last-step-description'] ) ? $data['last-step-description'] : 'Please wait a moment while we prepare your custom bundle box' ),
     
    543569                'type'        => 'select',
    544570                'options'     => array(
    545                     'yes' => __( 'Yes', 'doko' ),
    546                     'no'  => __( 'No', 'doko' ),
     571                    'yes' => __( 'Yes', 'doko-bundle-builder' ),
     572                    'no'  => __( 'No', 'doko-bundle-builder' ),
    547573                ),
    548                 'label'       => esc_html__( 'Enable/Disable additional add to box button below the product card', 'doko' ),
    549                 'description' => esc_html__( "In some WooCommerce themes, the Add to Cart button is not displayed on bundle pages, to reduce the bounce rate on the bundle page, enable this option to fix it, by default it's set to no.", 'doko' ),
     574                'label'       => esc_html__( 'Enable/Disable additional add to box button below the product card', 'doko-bundle-builder' ),
     575                'description' => esc_html__( "In some WooCommerce themes, the Add to Cart button is not displayed on bundle pages, to reduce the bounce rate on the bundle page, enable this option to fix it, by default it's set to no.", 'doko-bundle-builder' ),
    550576                'name'        => 'doko[enable-add-to-box-button]',
    551577                'default'     => ( isset( $data['enable-add-to-box-button'] ) ? $data['enable-add-to-box-button'] : 'yes' ),
     
    598624            'custom-css',
    599625            'enable-product-description',
    600             'enable-bottom-navigation'
     626            'enable-bottom-navigation',
     627            'use-bundle-name-as-product-name'
    601628        ) );
    602629    }
     
    606633                <span class="product-data-wrapper type_box ">
    607634                    <button class="button button-primary hs-add-screen" id="add-btn-off"><?php
    608         esc_html_e( 'Add Screen ', 'doko' );
     635        esc_html_e( 'Add Screen ', 'doko-bundle-builder' );
    609636        ?></button>
    610637                   
    611638                    <span class="button expand-close doko-btn-expand">
    612639                        <a href class="expand_all"><?php
    613         esc_html_e( 'Expand', 'doko' );
     640        esc_html_e( 'Expand', 'doko-bundle-builder' );
    614641        ?></a> / <a href class="close_all"><?php
    615         esc_html_e( 'Close', 'doko' );
     642        esc_html_e( 'Close', 'doko-bundle-builder' );
    616643        ?></a>
    617644                    </span>
     
    637664        ?>
    638665                </div>
    639             </div>
     666
    640667            <input type="hidden" name="doko_nonce" value="<?php
    641668        echo esc_html( wp_create_nonce( 'doko_nonce' ) );
     
    667694        $use_qty_input = $qty_position_field = '';
    668695        $tags = array();
    669         $title_gift_message = esc_html__( 'Add a gift message', 'doko' );
    670         $desc_gift_message = esc_html__( 'To include different messages for different recipients, please contact our support.', 'doko' );
     696        $title_gift_message = esc_html__( 'Add a gift message', 'doko-bundle-builder' );
     697        $desc_gift_message = esc_html__( 'To include different messages for different recipients, please contact our support.', 'doko-bundle-builder' );
    671698        if ( $saved_data ) {
    672699            $screen_name = $saved_data['screen-name'];
     
    683710        $screens_fields = array(
    684711            'screen-name' => array(
    685                 'label'       => esc_html__( 'Screen Name :', 'doko' ),
    686                 'label_class' => 'doko-table-label',
    687                 'description' => esc_html__( 'Define a slug to easily identify this screen', 'doko' ),
     712                'label'       => esc_html__( 'Screen Name :', 'doko-bundle-builder' ),
     713                'label_class' => 'doko-table-label',
     714                'description' => esc_html__( 'Define a slug to easily identify this screen', 'doko-bundle-builder' ),
    688715                'content'     => formulus_input_fields( "doko[{$select_id}][screen-name]", array(
    689716                    'type'   => 'text',
     
    693720        );
    694721        $option_list = array(
    695             'bundle-products' => esc_html__( 'Bundle Products', 'doko' ),
    696             'upgrade-cc'      => esc_html__( 'Bundle Cart Content (PRO Version)', 'doko' ),
    697             'upgrade-card'    => esc_html__( 'Bundle Card Page (PRO Version)', 'doko' ),
    698         );
     722            'bundle-products' => esc_html__( 'Bundle Products', 'doko-bundle-builder' ),
     723            'upgrade-cc'      => esc_html__( 'Bundle Cart Content (PRO Version)', 'doko-bundle-builder' ),
     724            'upgrade-card'    => esc_html__( 'Bundle Card Page (PRO Version)', 'doko-bundle-builder' ),
     725        );
     726        $screenoptions = array('upgrade-cc', 'upgrade-card');
    699727        $oscreens_fields = array(
    700728            'choose-bundle-screen-disposition' => array(
    701                 'label'       => esc_html__( 'Choose Bundle Screen disposition :', 'doko' ),
    702                 'label_class' => 'doko-table-label',
    703                 'description' => esc_html__( 'Define the screen disposition, it supports the following disposition : ', 'doko' ) . wp_kses_post( $html ),
     729                'label'       => esc_html__( 'Choose Bundle Screen disposition :', 'doko-bundle-builder' ),
     730                'label_class' => 'doko-table-label',
     731                'description' => esc_html__( 'Define the screen disposition, it supports the following disposition : ', 'doko-bundle-builder' ) . wp_kses_post( $html ),
    704732                'content'     => formulus_input_fields( "doko[{$select_id}][screen-disposition]", array(
    705                     'type'    => 'select',
    706                     'options' => apply_filters( 'doko_bundle_screen_disposition', $option_list ),
    707                     'return'  => true,
     733                    'type'             => 'select',
     734                    'options'          => apply_filters( 'doko_bundle_screen_disposition', $option_list ),
     735                    'disabled_options' => $screenoptions,
     736                    'return'           => true,
    708737                ), ( isset( $saved_data['screen-disposition'] ) ? $saved_data['screen-disposition'] : 'bundle-products' ) ),
    709738                'tr_class'    => 'choose-bundle-screen-disposition',
    710739            ),
    711740            'display-bundle-title'             => array(
    712                 'label'       => esc_html__( 'Show / Hide Bundle Screen Title :', 'doko' ),
    713                 'label_class' => 'doko-table-label',
    714                 'description' => esc_html__( 'Whether it displays a screen title or not :', 'doko' ),
     741                'label'       => esc_html__( 'Show / Hide Bundle Screen Title :', 'doko-bundle-builder' ),
     742                'label_class' => 'doko-table-label',
     743                'description' => esc_html__( 'Whether it displays a screen title or not :', 'doko-bundle-builder' ),
    715744                'content'     => formulus_input_fields(
    716745                    "doko[{$select_id}][display-bundle-title]",
     
    719748                        'id'      => $enable_box_details_description_id,
    720749                        'options' => array(
    721                             'yes' => esc_html__( 'Show', 'doko' ),
    722                             'no'  => esc_html__( 'Hide', 'doko' ),
     750                            'yes' => esc_html__( 'Show', 'doko-bundle-builder' ),
     751                            'no'  => esc_html__( 'Hide', 'doko-bundle-builder' ),
    723752                        ),
    724753                        'return'  => true,
    725754                    ),
    726                     ( isset( $display_bundle_title ) ? $display_bundle_title : esc_html__( 'no', 'doko' ) ),
     755                    ( isset( $display_bundle_title ) ? $display_bundle_title : esc_html__( 'no', 'doko-bundle-builder' ) ),
    727756                    $enable_box_details_description_id
    728757                ),
     
    730759            ),
    731760            'bundle-screen-title'              => array(
    732                 'label'       => esc_html__( 'Bundle Screen Title :', 'doko' ),
     761                'label'       => esc_html__( 'Bundle Screen Title :', 'doko-bundle-builder' ),
    733762                'label_class' => 'doko-table-label',
    734763                'tr_class'    => 'doko-tr-section-bundle-title-' . $select_id,
    735                 'description' => esc_html__( 'Define the bundle screen title. It can be a descriptive text highlighting what your customers must do on this page :', 'doko' ) . wp_kses_post( $title_html ),
    736                 'content'     => '<textarea id="' . $box_description_editor_id . '" name="doko[' . $select_id . '][bundle-title]" >' . (( isset( $bundle_title ) ? $bundle_title : esc_html__( 'CHOOSE YOUR BOX COLOR', 'doko' ) )) . '</textarea>',
     764                'description' => esc_html__( 'Define the bundle screen title. It can be a descriptive text highlighting what your customers must do on this page :', 'doko-bundle-builder' ) . wp_kses_post( $title_html ),
     765                'content'     => '<textarea id="' . $box_description_editor_id . '" name="doko[' . $select_id . '][bundle-title]" >' . (( isset( $bundle_title ) ? $bundle_title : esc_html__( 'CHOOSE YOUR BOX COLOR', 'doko-bundle-builder' ) )) . '</textarea>',
    737766            ),
    738767            $select_name                       => array(
    739                 'label'       => esc_html__( 'Show Products on this screen based on :', 'doko' ),
     768                'label'       => esc_html__( 'Show Products on this screen based on :', 'doko-bundle-builder' ),
    740769                'label_class' => 'doko-table-label',
    741770                'content'     => formulus_input_fields( "doko[{$select_id}][options]", $this->get_package_selection_options( $select_id ), ( isset( $options ) ? $options : 'products' ) ),
     
    743772            ),
    744773            $pdts_select_name . '[]'           => array(
    745                 'label'       => esc_html__( 'Products to display :', 'doko' ),
     774                'label'       => esc_html__( 'Products to display :', 'doko-bundle-builder' ),
    746775                'label_class' => 'doko-table-label ',
    747776                'tr_class'    => 'doko-tr-section-prod-' . $select_id,
    748                 'description' => esc_html__( 'Define the products, your customers are allowed to pick to fill this step in the bundle.', 'doko' ),
     777                'description' => esc_html__( 'Define the products, your customers are allowed to pick to fill this step in the bundle.', 'doko-bundle-builder' ),
    749778                'content'     => formulus_input_fields( "doko[{$select_id}][products][]", $this->get_dynamic_select_options( 'products', $pdts_select_id, ( isset( $products_list ) ? $products_list : array() ) ) ),
    750779            ),
    751780            $ctgs_select_name . '[]'           => array(
    752                 'label'       => esc_html__( 'Categories to display :', 'doko' ),
     781                'label'       => esc_html__( 'Categories to display :', 'doko-bundle-builder' ),
    753782                'label_class' => 'doko-table-label ',
    754783                'tr_class'    => 'doko-tr-section-cat-' . $select_id,
    755                 'description' => esc_html__( 'Define the products categories, your customers are allowed to pick to fill this step in the bundle.', 'doko' ),
     784                'description' => esc_html__( 'Define the products categories, your customers are allowed to pick to fill this step in the bundle.', 'doko-bundle-builder' ),
    756785                'content'     => formulus_input_fields( "doko[{$select_id}][categories][]", $this->get_dynamic_select_options( 'categories', $ctgs_select_id, ( isset( $categories_list ) ? $categories_list : array() ) ) ),
    757786            ),
     
    796825                <p class="description">
    797826                <label for="doko-bundles-shortcode"><?php
    798         esc_attr_e( 'Copy this shortcode and paste it into a new page you\'ve created :', 'doko' );
     827        esc_attr_e( 'Copy this shortcode and paste it into a new page you\'ve created :', 'doko-bundle-builder' );
    799828        ?></label>
    800829                <span class="shortcode wp-ui-highlight">
     
    854883        global $typenow;
    855884        if ( 'doko-bundles' === $typenow ) {
    856             $title = esc_html__( 'Bundle name', 'doko' );
     885            $title = esc_html__( 'Bundle name', 'doko-bundle-builder' );
    857886        }
    858887        return $title;
     
    912941        echo esc_attr( $variation_id );
    913942        ?>"><?php
    914         esc_html_e( 'Remove', 'doko' );
     943        esc_html_e( 'Remove', 'doko-bundle-builder' );
    915944        ?></a>
    916945                    <div class="tips sort" data-tip="<?php
    917         esc_attr_e( 'Drag and drop, or click to set admin variation order', 'doko' );
     946        esc_attr_e( 'Drag and drop, or click to set admin variation order', 'doko-bundle-builder' );
    918947        ?>"></div>
    919948                    <div class="handlediv" style="width: 27px; float: right;" aria-label="<?php
    920         esc_attr_e( 'Click to toggle', 'doko' );
     949        esc_attr_e( 'Click to toggle', 'doko-bundle-builder' );
    921950        ?>"></div>
    922951                    <strong><span class="doko-section-<?php
     
    954983
    955984    public function get_columns( $defaults ) {
    956         $defaults['bundle_shortcodes'] = esc_html__( 'Bundle Shortcodes', 'doko' );
     985        $defaults['bundle_shortcodes'] = esc_html__( 'Bundle Shortcodes', 'doko-bundle-builder' );
    957986        /**
    958987         * Filters the columns of the bundles screen.
  • doko-box-builder/trunk/admin/css/doko-select2.css

    r2925566 r3315238  
    13131313    box-shadow: 0px 0px 5px #666666;
    13141314}
     1315
     1316
     1317.select2-container{box-sizing:border-box;display:inline-block;margin:0;position:relative;vertical-align:middle}.select2-container .select2-selection--single{box-sizing:border-box;cursor:pointer;display:block;height:28px;margin:0 0 -4px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--single .select2-selection__rendered{display:block;padding-left:8px;padding-right:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-selection--single .select2-selection__clear{position:relative}.select2-container[dir=rtl] .select2-selection--single .select2-selection__rendered{padding-right:8px;padding-left:20px}.select2-container .select2-selection--multiple{box-sizing:border-box;cursor:pointer;display:block;min-height:32px;user-select:none;-webkit-user-select:none}.select2-container .select2-selection--multiple .select2-selection__rendered{display:inline-block;overflow:hidden;padding-left:8px;text-overflow:ellipsis;white-space:nowrap}.select2-container .select2-search--inline{float:left;padding:0}.select2-container .select2-search--inline .select2-search__field{box-sizing:border-box;border:none;font-size:100%;margin:0;padding:0}.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-dropdown{background-color:var(--wc-form-color-background,#fff);color:var(--wc-form-color-text,#000);border:1px solid #aaa;border-radius:4px;box-sizing:border-box;display:block;position:absolute;left:-100000px;width:100%;z-index:1051}.select2-results{display:block}.select2-results__options{list-style:none;margin:0;padding:0}.select2-results__option{padding:6px;user-select:none;-webkit-user-select:none}.select2-results__option[aria-selected],.select2-results__option[data-selected]{cursor:pointer}.select2-container--open .select2-dropdown{left:0}.select2-container--open .select2-dropdown--above{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--open .select2-dropdown--below{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-search--dropdown{display:block;padding:4px}.select2-search--dropdown .select2-search__field{padding:4px;width:100%;box-sizing:border-box}.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button{-webkit-appearance:none}.select2-search--dropdown.select2-search--hide{display:none}.select2-close-mask{border:0;margin:0;padding:0;display:block;position:fixed;left:0;top:0;min-height:100%;min-width:100%;height:auto;width:auto;opacity:0;z-index:99;background-color:#fff}.select2-hidden-accessible{border:0!important;clip:rect(0 0 0 0)!important;height:1px!important;margin:-1px!important;overflow:hidden!important;padding:0!important;position:absolute!important;width:1px!important}.select2-container--default .select2-selection--single{background-color:#fff;border:1px solid #aaa;border-radius:4px}.select2-container--default .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--default .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700}.select2-container--default .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--default .select2-selection--single .select2-selection__arrow{height:26px;position:absolute;top:1px;right:1px;width:20px}.select2-container--default .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--default[dir=rtl] .select2-selection--single .select2-selection__arrow{left:1px;right:auto}.select2-container--default.select2-container--disabled .select2-selection--single{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear{display:none}.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--default .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text}.select2-container--default .select2-selection--multiple .select2-selection__rendered{box-sizing:border-box;list-style:none;margin:0;padding:0 5px;width:100%}.select2-container--default .select2-selection--multiple .select2-selection__rendered li{list-style:none;margin:5px 5px 0 0}.select2-container--default .select2-selection--multiple .select2-selection__rendered li:before{content:"";display:none}.select2-container--default .select2-selection--multiple .select2-selection__placeholder{color:#999;margin-top:5px;float:left}.select2-container--default .select2-selection--multiple .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-top:5px;margin-right:10px}.select2-container--default .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove{color:#999;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover{color:#333}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-search--inline,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice,.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__placeholder{float:right}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--default[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--default.select2-container--focus .select2-selection--multiple{border:solid #000 1px;outline:0}.select2-container--default.select2-container--disabled .select2-selection--multiple{background-color:#eee;cursor:default}.select2-container--default.select2-container--disabled .select2-selection__choice__remove{display:none}.select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--above .select2-selection--single{border-top-left-radius:0;border-top-right-radius:0}.select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple,.select2-container--default.select2-container--open.select2-container--below .select2-selection--single{border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--default .select2-search--dropdown .select2-search__field{border:1px solid #aaa}.select2-container--default .select2-search--inline .select2-search__field{background:0 0;border:none;outline:0;box-shadow:none;-webkit-appearance:textfield}.select2-container--default .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--default .select2-results__option[role=group]{padding:0}.select2-container--default .select2-results__option[aria-disabled=true]{color:#999}.select2-container--default .select2-results__option[aria-selected=true],.select2-container--default .select2-results__option[data-selected=true]{background-color:#ddd}.select2-container--default .select2-results__option .select2-results__option{padding-left:1em}.select2-container--default .select2-results__option .select2-results__option .select2-results__group{padding-left:0}.select2-container--default .select2-results__option .select2-results__option .select2-results__option{margin-left:-1em;padding-left:2em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-2em;padding-left:3em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-3em;padding-left:4em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-4em;padding-left:5em}.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option{margin-left:-5em;padding-left:6em}.select2-container--default .select2-results__option--highlighted[aria-selected],.select2-container--default .select2-results__option--highlighted[data-selected]{background-color:#0073aa;color:#fff}.select2-container--default .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic .select2-selection--single{background-color:#f7f7f7;border:1px solid #aaa;border-radius:4px;outline:0;background-image:linear-gradient(to bottom,#fff 50%,#eee 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--single:focus{border:1px solid #0073aa}.select2-container--classic .select2-selection--single .select2-selection__rendered{color:#444;line-height:28px}.select2-container--classic .select2-selection--single .select2-selection__clear{cursor:pointer;float:right;font-weight:700;margin-right:10px}.select2-container--classic .select2-selection--single .select2-selection__placeholder{color:#999}.select2-container--classic .select2-selection--single .select2-selection__arrow{background-color:#ddd;border:none;border-left:1px solid #aaa;border-top-right-radius:4px;border-bottom-right-radius:4px;height:26px;position:absolute;top:1px;right:1px;width:20px;background-image:linear-gradient(to bottom,#eee 50%,#ccc 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--single .select2-selection__arrow b{border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px;height:0;left:50%;margin-left:-4px;margin-top:-2px;position:absolute;top:50%;width:0}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__clear{float:left}.select2-container--classic[dir=rtl] .select2-selection--single .select2-selection__arrow{border:none;border-right:1px solid #aaa;border-radius:0;border-top-left-radius:4px;border-bottom-left-radius:4px;left:1px;right:auto}.select2-container--classic.select2-container--open .select2-selection--single{border:1px solid #0073aa}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow{background:0 0;border:none}.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single{border-top:none;border-top-left-radius:0;border-top-right-radius:0;background-image:linear-gradient(to bottom,#fff 0,#eee 50%);background-repeat:repeat-x}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0;background-image:linear-gradient(to bottom,#eee 50%,#fff 100%);background-repeat:repeat-x}.select2-container--classic .select2-selection--multiple{background-color:#fff;border:1px solid #aaa;border-radius:4px;cursor:text;outline:0}.select2-container--classic .select2-selection--multiple:focus{border:1px solid #0073aa}.select2-container--classic .select2-selection--multiple .select2-selection__rendered{list-style:none;margin:0;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__clear{display:none}.select2-container--classic .select2-selection--multiple .select2-selection__choice{background-color:#e4e4e4;border:1px solid #aaa;border-radius:4px;cursor:default;float:left;margin-right:5px;margin-top:5px;padding:0 5px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove{color:#888;cursor:pointer;display:inline-block;font-weight:700;margin-right:2px}.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover{color:#555}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{float:right}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice{margin-left:5px;margin-right:auto}.select2-container--classic[dir=rtl] .select2-selection--multiple .select2-selection__choice__remove{margin-left:2px;margin-right:auto}.select2-container--classic.select2-container--open .select2-selection--multiple{border:1px solid #0073aa}.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple{border-top:none;border-top-left-radius:0;border-top-right-radius:0}.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.select2-container--classic .select2-search--dropdown .select2-search__field{border:1px solid #aaa;outline:0}.select2-container--classic .select2-search--inline .select2-search__field{outline:0;box-shadow:none}.select2-container--classic .select2-dropdown{background-color:#fff;border:1px solid transparent}.select2-container--classic .select2-dropdown--above{border-bottom:none}.select2-container--classic .select2-dropdown--below{border-top:none}.select2-container--classic .select2-results>.select2-results__options{max-height:200px;overflow-y:auto}.select2-container--classic .select2-results__option[role=group]{padding:0}.select2-container--classic .select2-results__option[aria-disabled=true]{color:grey}.select2-container--classic .select2-results__option--highlighted[aria-selected],.select2-container--classic .select2-results__option--highlighted[data-selected]{background-color:#3875d7;color:#fff}.select2-container--classic .select2-results__group{cursor:default;display:block;padding:6px}.select2-container--classic.select2-container--open .select2-dropdown{border-color:#0073aa}
  • doko-box-builder/trunk/admin/js/hs-doko-admin.js

    r3230317 r3315238  
    1 (function( $ ) {
     1(function ($) {
    22    'use strict';
    33
    4     function dk_get_products( selector_name, url, placeholder, is_full_width  ) {
    5             var packageOptionMode = selector_name.data('packageMode');
    6             return selector_name.select2(
    7                 {
    8                     width : is_full_width ? '100%' : null,
    9                     multiple: true,
    10                     placeholder: placeholder,
    11                     ajax: {
    12                         url: ajaxurl,
    13                         dataType: 'json',
    14                         delay: 30,
    15                         data: function (params) {
    16                             return {
    17                                 q: params.term,
    18                                 action: url,
    19                                 operation_type: packageOptionMode,
    20                             };
    21                         },
    22                         processResults: function( data ) {
    23                             var options = [];
    24                             if ( data ) {
    25                                 data.forEach(
    26                                     ( content ) => {
    27                                         options.push(
    28                                             {
    29                                                 id: content[0],
    30                                                 text: content[1]
    31                                             }
    32                                         );
    33                                     }
    34                                 );
    35                             }
    36                             return {
    37                                 results: options
    38                             };
    39                         },
    40                         cache: true
    41                     },
    42                     minimumInputLength: 1
    43                 }
    44             );
    45     }
    46 
    47     function dk_change_option_disposition( name, product_name_selector, cat_name_selector , tags_name_selector ) {
    48         $(name).on('change', function(e){
    49             var data = $(this).val();
    50             if ( "products" == data ) {
    51                 $(product_name_selector ).show();
    52                 $(cat_name_selector).hide();
    53                 $(tags_name_selector).hide()
    54             } else if ( "categories" == data ) {
    55                 $(cat_name_selector).show();
    56                 $(product_name_selector ).hide();
    57                 $(tags_name_selector).hide();
    58             } else if ( "tags" == data ) {
    59                 $(cat_name_selector).hide();
    60                 $(product_name_selector ).hide();
    61                 $(tags_name_selector).show();
    62             }
    63         });
    64         $(name+':checked').trigger('change');
    65     }
    66 
    67 
    68     function dk_change_title_disposition( name, title_selector ) {
    69         $(name).on('change', function(e){
    70             var data = $(this).val();
    71             if ( "yes" == data ) {
    72                 $(title_selector).show();
    73             } else {
    74                 $(title_selector).hide();
    75             }
    76         });
    77 
    78         $(name + ':checked').trigger('change');
    79     }
    80 
    81 
    82     function dk_init_sortable_event() {
    83         $( 'div.woocommerce_variations' ).sortable({
    84             items:                '.woocommerce_variation',
    85             cursor:               'move',
    86             axis:                 'y',
    87             handle:               '.sort',
    88             scrollSensitivity:    40,
    89             forcePlaceholderSize: true,
    90             helper:               'original',
    91             opacity:              0.65,
    92             stop:                 function() {
    93                 var wrapper      = $( '#variable_product_options' ).find( '.woocommerce_variations' ),
    94                 current_page = parseInt( wrapper.attr( 'data-page' ), 10 ),
    95                 offset       = parseInt( ( current_page - 1 ) * 15, 10 );
    96 
    97                 $( '.woocommerce_variations .woocommerce_variation' ).each( function ( index, el ) {
    98                     $( '.variation_menu_order', el )
    99                         .val( parseInt( $( el )
    100                         .index( '.woocommerce_variations .woocommerce_variation' ), 10 ) + 1 + offset )
    101                         .trigger( 'change' );
    102                 });
    103             }
    104         });
    105         $('#accordion div.group').map(function(i) { return this.id; }).get()
    106     }
    107 
    108     window.dk_init_sortable_event = dk_init_sortable_event;
    109 
    110 
    111     $(document).ready(function(){
     4
     5    $(document).ready(function () {
     6        function dk_get_products(selector_name, url, placeholder, is_full_width) {
     7            var packageOptionMode = selector_name.data('packageMode');
     8            return selector_name.select2(
     9                {
     10                    width: is_full_width ? '100%' : null,
     11                    multiple: true,
     12                    placeholder: placeholder,
     13                    ajax: {
     14                        url: ajaxurl,
     15                        dataType: 'json',
     16                        delay: 30,
     17                        data: function (params) {
     18                            return {
     19                                q: params.term,
     20                                action: url,
     21                                operation_type: packageOptionMode,
     22                            };
     23                        },
     24                        processResults: function (data) {
     25                            var options = [];
     26                            if (data) {
     27                                data.forEach(
     28                                    (content) => {
     29                                        options.push(
     30                                            {
     31                                                id: content[0],
     32                                                text: content[1]
     33                                            }
     34                                        );
     35                                    }
     36                                );
     37                            }
     38                            return {
     39                                results: options
     40                            };
     41                        },
     42                        cache: true
     43                    },
     44                    minimumInputLength: 1
     45                }
     46            );
     47        }
     48
     49        window.dk_get_products = dk_get_products;
     50
     51
    11252        var hs_dk_bundle_screen = [
    11353            '#doko-bundle-screens',
     
    11555        ];
    11656
    117         $('select[name="doko[enable-screen-redirect]"]').on('change', function(){
    118             let changEl = $(this).val();
    119             $('tr.doko_first_screen_no_products').hide();
    120             if (changEl == "no"){
    121                 $('tr.doko_first_screen_no_products').show();
     57        hs_dk_bundle_screen = wp.hooks.applyFilters('doko_mb_btn_level', hs_dk_bundle_screen);
     58
     59        for (var screen in hs_dk_bundle_screen) {
     60            $('.type_box').insertAfter(hs_dk_bundle_screen[screen] + ' .hndle');
     61        }
     62
     63
     64        var HSGenerateRandom = function (length) {
     65            "use strict";
     66            var result = "";
     67            var characters =
     68                "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
     69            var charactersLength = characters.length;
     70            for (var i = 0; i < length; i++) {
     71                result += characters.charAt(Math.floor(Math.random() * charactersLength));
    12272            }
     73            return result;
     74        };
     75
     76        window.HSGenerateRandom = HSGenerateRandom;
     77
     78        var hs_dk_generate_fields = function (hash_code =   window.HSGenerateRandom(5), box_id) {
     79            var html = "<p data-hash='" + hash_code + "' class='hs-dk-content'>";
     80
     81            html += "<select class='hs-dk-rules' name='doko[rules][" + box_id + "][dynamic][" + hash_code + "][cl-rules]' >";
     82            for (var option_name in window.doko.rules) {
     83                html += "<option value='" + option_name + "'>" + window.doko.rules[option_name] + "</option>";
     84            }
     85            html += "</select>&nbsp;&nbsp;&nbsp; <select class='hs-dk-options' name='doko[rules][" + box_id + "][dynamic][" + hash_code + "][cl-options]'>";
     86
     87            for (var option_name in window.doko.product_operators) {
     88                html += "<option value='" + option_name + "'>" + window.doko.product_operators[option_name] + "</option>";
     89            }
     90            html += "</select>&nbsp;&nbsp;&nbsp;"
     91
     92            html += "<span class='hs-dk-values' id=" + hash_code + "><input type='text' /> <button class='button button-primary woo-usn-cl-remove-block' >Remove</button> </span></p>";
     93            return html;
     94        }
     95
     96        window.hs_dk_generate_fields = hs_dk_generate_fields;
     97
     98
     99   
     100
     101        // Meta-Boxes - Open/close
     102        $(document).on('click', '.wc-metabox h3', function (event) {
     103            // If the user clicks on some form input inside the h3, like a select list (for variations), the box should not be toggled
     104            if ($(event.target).filter(':input, option, .sort').length) {
     105                return;
     106            }
     107            $(this).next('.wc-metabox-content').stop().slideToggle();
     108        })
     109
     110
     111
     112        $('.wc-metabox.closed').each(function () {
     113            $(this).find('.wc-metabox-content').hide();
    123114        });
    124115
    125         $( 'a.expand_all' ).on( 'click', function(e) {
    126             e.preventDefault();
    127             $('div.doko-metabox > .doko-metabox-content' ).show();
    128             return false;
    129         })
    130    
    131         $( 'a.close_all' ).on( 'click', function(e) {
    132             e.preventDefault();
    133             $( 'div.doko-metabox > .doko-metabox-content' ).hide();
    134             return false;
     116        $(document).on('click', 'a.remove_variation.delete', function () {
     117            $(this).closest('div.woocommerce_variation').remove();
    135118        });
    136119
    137         $( 'a.close_all' ).trigger('click');
    138 
    139 
    140         $('select[name="doko[enable-screen-redirect]"]').trigger('change');
    141 
    142         hs_dk_bundle_screen = wp.hooks.applyFilters( 'doko_mb_btn_level', hs_dk_bundle_screen );
    143 
    144         for( var screen in hs_dk_bundle_screen ) {
    145             $( '.type_box' ).insertAfter( hs_dk_bundle_screen[screen] + ' .hndle' );
    146         }
    147 
    148         hs_dk_toggle_qty_field();
    149 
    150 
    151 
    152         var total_rule = 0;
    153 
    154         $('button.hs-add-rule').on('click dbclick', function(e){
    155             e.preventDefault();
    156             var bundleId= $('select#doko-associated_rule-bundle').val();
    157 
    158             if ( bundleId == "no" ) {
    159                 alert("Choose a bundle, before choosing a rule.");
    160                 return false;
    161             }
    162 
    163             $.blockUI({'message' : 'Preparing your bundle rule, please wait ....'});
    164             $.post(ajaxurl, {'action': 'doko_get_bundle_rule', 'bundle_id' : bundleId , 'current_index' : total_rule },
    165                 function(r){
    166                     r = JSON.parse(r);
    167                     var idField = r.args.elem_id;
    168                     $('div.woocommerce_variations').append( r.html );
    169                     dk_init_sortable_event();
    170                     dk_build_sortable_bundle( idField, r.args );
    171 
    172                     hs_dk_get_screen_product_list( bundleId, idField );
    173 
    174                     hs_dk_toggle_rule_action( bundleId, idField );
    175                     total_rule ++;
    176                     $.unblockUI();
    177 
    178 
    179 
    180 
    181 
    182                 } );
    183         });
     120
     121        $('a.expand_all').on('click', function (e) {
     122            e.preventDefault();
     123            $('div.doko-metabox > .doko-metabox-content').show();
     124            return false;
     125        })
     126
     127        $('a.close_all').on('click', function (e) {
     128            e.preventDefault();
     129            $('div.doko-metabox > .doko-metabox-content').hide();
     130            return false;
     131        });
     132
     133        $('a.close_all').trigger('click');
     134
     135        function dk_init_sortable_event() {
     136            $('div.woocommerce_variations').sortable({
     137                items: '.woocommerce_variation',
     138                cursor: 'move',
     139                axis: 'y',
     140                handle: '.sort',
     141                scrollSensitivity: 40,
     142                forcePlaceholderSize: true,
     143                helper: 'original',
     144                opacity: 0.65,
     145                stop: function () {
     146                    var wrapper = $('#variable_product_options').find('.woocommerce_variations'),
     147                        current_page = parseInt(wrapper.attr('data-page'), 10),
     148                        offset = parseInt((current_page - 1) * 15, 10);
     149
     150                    $('.woocommerce_variations .woocommerce_variation').each(function (index, el) {
     151                        $('.variation_menu_order', el)
     152                            .val(parseInt($(el)
     153                                .index('.woocommerce_variations .woocommerce_variation'), 10) + 1 + offset)
     154                            .trigger('change');
     155                    });
     156                }
     157            });
     158            $('#accordion div.group').map(function (i) { return this.id; }).get()
     159        }
     160
     161        window.dk_init_sortable_event = dk_init_sortable_event;
     162
     163
     164        function dk_change_option_disposition(name, product_name_selector, cat_name_selector, tags_name_selector) {
     165            $(name).on('change', function (e) {
     166                var data = $(this).val();
     167                if ("products" == data) {
     168                    $(product_name_selector).show();
     169                    $(cat_name_selector).hide();
     170                    $(tags_name_selector).hide()
     171                } else if ("categories" == data) {
     172                    $(cat_name_selector).show();
     173                    $(product_name_selector).hide();
     174                    $(tags_name_selector).hide();
     175                } else if ("tags" == data) {
     176                    $(cat_name_selector).hide();
     177                    $(product_name_selector).hide();
     178                    $(tags_name_selector).show();
     179                }
     180            });
     181            $(name + ':checked').trigger('change');
     182        }
     183
     184        window.dk_change_option_disposition = dk_change_option_disposition;
     185
     186
     187        function dk_change_title_disposition(name, title_selector) {
     188            $(name).on('change', function (e) {
     189                var data = $(this).val();
     190                if ("yes" == data) {
     191                    $(title_selector).show();
     192                } else {
     193                    $(title_selector).hide();
     194                }
     195            });
     196
     197            $(name + ':checked').trigger('change');
     198        }
     199
     200
     201       
     202
     203
     204
     205        function dk_build_sortable_bundle(idField, args) {
     206
     207            dk_get_products($('select#doko-box-pdts-select-id-' + idField), 'hs_dk_query_wc', doko_object.pick_product_message, true);
     208            dk_get_products($('select#doko-ctgs-select-id-' + idField), 'hs_dk_query_wc', doko_object.pick_category_message, true);
     209            dk_change_option_disposition('input[name="doko[' + idField + '][options]"]', 'tr.doko-tr-section-prod-' + idField, 'tr.doko-tr-section-cat-' + idField, 'tr.doko-multiple-tags.doko-tr-section-tag-' + idField)
     210            dk_change_title_disposition('input[name="doko[' + idField + '][display-bundle-title]"]', 'tr.doko-tr-section-bundle-title-' + idField);
     211            $('select[name="doko[' + idField + '][tags][]"]').select2()
     212
     213
     214            if ($('#' + args.box_description_editor_id).length > 0) {
     215                wp.attachEditor(document.getElementById(args.box_description_editor_id), {});
     216                $('input[name="doko[' + idField + '][screen-name]"]').on('keyup', function (e) {
     217                    $('span.doko-section-' + idField).html($(this).val())
     218                });
     219            }
     220
     221        }
     222
     223
     224        window.dk_build_sortable_bundle = dk_build_sortable_bundle;
     225
     226
     227
     228
    184229
    185230        // wp.domReady( () => {
     
    187232        // });
    188233
    189 
    190         if ( $('#doko-box-description').length > 0 ) {
    191 
    192             dk_get_products($('select[name="doko[box-products][]"]'), 'hs_dk_query_wc', doko_object.pick_product_message, true );
    193             dk_get_products($('select[name="doko[box-categories][]"]'), 'hs_dk_query_wc', doko_object.pick_category_message, true );
    194 
    195             wp.attachEditor( document.getElementById( 'doko-box-description' ));
    196 
    197             dk_change_option_disposition( 'input[name="doko[box-selection-mode]"]', 'tr.doko-box-products-mode', 'tr.doko-box-categories-mode', 'tr.doko-box-tags-mode');
    198 
    199 
    200 
    201             $('button.hs-add-screen').on('click dbclick', function(e){
    202                 e.preventDefault();     
    203                 $.blockUI({'message' : 'Adding your bundle screen content, please wait ....'})
    204                 $.post(ajaxurl, {'action': 'doko_get_admin_screen'},
    205                 function(r){
    206                     r = JSON.parse(r);
    207                     var idField = r.args.elem_id;
    208                     $('div.woocommerce_variations').append( r.html );
    209                     hs_dk_toggle_bundle_viewer( idField );
    210                     dk_init_sortable_event();
    211                     dk_build_sortable_bundle( idField, r.args );
    212                     hs_dk_toggle_pagination_per_page( idField )
    213                     hs_dk_toggle_gift_messages( idField )
    214                     hs_dk_toggle_btn_qty( idField )
    215                
    216                     $.unblockUI(); 
    217                 } );
    218             });
    219 
    220             change_product_type_tip( 'hello' )
    221 
    222             for ( var id in doko_object.ids ) {
    223                 hs_dk_toggle_bundle_viewer( doko_object.ids[id].id  )
    224                 dk_build_sortable_bundle( doko_object.ids[id].id, doko_object.ids[id].args );
    225                 hs_dk_toggle_pagination_per_page( doko_object.ids[id].id )
    226                 hs_dk_toggle_gift_messages( doko_object.ids[id].id  )
    227                 hs_dk_toggle_btn_qty( doko_object.ids[id].id  )
    228                
    229             }
    230             dk_init_sortable_event();
    231         }
    232 
    233         $('button.doko-add-rule').on('click', function(e){
    234             e.preventDefault();
    235             $(this).html('Adding ...');
    236             var queryString = window.location.search;
    237             var urlParams = new URLSearchParams(queryString);
    238             var bundle_id = urlParams.get('bundle-id');
    239             $.post(ajaxurl, {
    240                 'action': 'doko_get_dynamic_rules',
    241                 'bundle-id' : bundle_id
    242             },
    243             function(r){
    244                 r = JSON.parse(r);
    245                 $('div.doko-dynamic-rules-div').append(r.html);
    246                     $('button.doko-add-rule').html('Add Rule');
    247                 var hash_code = HSGenerateRandom(12);
    248 
    249                 $('p.doko-dynamic-rules[data-screen-id='+r.box_rule_id+']').html(
    250                     hs_dk_generate_fields(hash_code, r.box_rule_id )
    251                 );
    252 
    253                 hs_dk_reset_rule_selector( r.box_rule_id, hash_code );
    254 
    255 
    256                 $(document).on('click dbclick', 'table.doko-selector-table #'+r.box_rule_id , function (e) {
    257                     e.preventDefault();
    258                     hash_code = HSGenerateRandom(12);
    259                     $('p.doko-dynamic-rules[data-screen-id='+r.box_rule_id+']').append( hs_dk_generate_fields(hash_code, r.box_rule_id) );
    260                     hs_dk_reset_rule_selector( r.box_rule_id, hash_code );
    261                
    262                 });
    263 
    264                 $.unblockUI(); 
    265             } );
    266         });
    267 
    268 
    269         $(document).on('change', 'input[name="doko[enable-dynamic-rules]"]', function(e){
    270             e.preventDefault();
    271             if ( $(this).is(':checked') ) {
    272                 $('tr.doko-box-selection-mode').show();
    273             } else {
    274                 $('tr.doko-box-selection-mode').hide();
    275             }
    276         });
    277 
    278         $('input[name="doko[enable-dynamic-rules]"]').trigger('change');
    279 
    280         $('button.doko-save-rule').on('click', function(e){
    281             e.preventDefault();
    282             var queryString = window.location.search;
    283             var urlParams = new URLSearchParams(queryString);
    284             var bundle_id = urlParams.get('bundle-id');
    285             $.blockUI({'message' : 'Saving your dynamic rules, please wait ....'})
    286             $.post(ajaxurl, {
    287                 'action': 'doko_save_dynamic_rules',
    288                 'bundle-id' : bundle_id,
    289                 'data' : $('form').serializeJSON()
    290             },
    291             function(r){
    292                 $.unblockUI(); 
    293                 window.location.reload();
    294             } );   
    295         });
    296 
    297         if ( window.doko_saved_rules != undefined ) {
    298             var rules = window.doko_saved_rules.doko.rules;
    299             for( var rule in rules ){
    300                 for ( var hash_code in rules[rule].dynamic ) {
    301                     $('p.doko-dynamic-rules[data-screen-id='+rule+']').append( hs_dk_generate_fields(hash_code, rule ) );
    302                     hs_dk_reset_rule_selector( rule, hash_code );
    303 
    304                     $('[name="doko[rules]['+rule+'][dynamic]['+hash_code+'][cl-rules]"]').val(rules[rule].dynamic[hash_code]['cl-rules']);
    305                     $('[name="doko[rules]['+rule+'][dynamic]['+hash_code+'][cl-values]"]').val(rules[rule].dynamic[hash_code]['cl-values']);
    306                     $('[name="doko[rules]['+rule+'][dynamic]['+hash_code+'][cl-options]"]').val(rules[rule].dynamic[hash_code]['cl-options']);
    307                 }
    308             }
    309         }
    310         var fields = window.doko_fields_list;
    311         if ( undefined != fields) {
    312             var bundleId = window.doko_bundle_id;
    313             var js = JSON.parse(fields);
    314 
    315             for( var id in js ) {
    316                 hs_dk_get_screen_product_list( bundleId, js[id] );
    317                 hs_dk_toggle_rule_action( bundleId, js[id] );
    318             }
    319         }
    320 
    321         $("tr.doko-multiple-tags select").select2({"width": "100%"})
    322         $("tr.doko-box-tags-mode select").select2({"width": "100%"})
    323 
    324         $( 'a.expand_all' ).on( 'click', function(e) {
    325             e.preventDefault();
    326             $( this ).find( 'div.doko-metabox > .doko-metabox-content' ).show();
    327             return false;
    328         })
    329    
    330         $( 'a.close_all' ).on( 'click', function(e) {
    331             e.preventDefault();
    332             $( this ).find( 'div.doko-metabox > .doko-metabox-content' ).hide();
    333             return false;
    334         });
     234        $("tr.doko-multiple-tags select").select2({ "width": "100%" })
     235        $("tr.doko-box-tags-mode select").select2({ "width": "100%" })
     236
    335237    });
    336 
    337 
    338     function hs_dk_reset_rule_selector( box_id, hash_code ) {
    339         $('p.doko-dynamic-rules[data-screen-id='+box_id+'] select[name="doko[rules]['+box_id+'][dynamic]['+hash_code+'][cl-rules]"]').on('click', function(){
    340             hs_dk_get_dynamic_rule( $(this).val(), box_id, $(this).parent().closest('p.hs-dk-content').data('hash') );
    341         });
    342 
    343         $('p.doko-dynamic-rules[data-screen-id='+box_id+'] select[name="doko[rules]['+box_id+'][dynamic]['+hash_code+'][cl-rules]"]').trigger('click');
    344 
    345         $('button.doko-rule-remove-block').on('click', function() {
    346             $(this).parent().closest('p.hs-dk-content').remove();
    347         });
    348     }
    349 
    350 
    351      
    352 
    353     // Meta-Boxes - Open/close
    354     $( document ).on( 'click', '.wc-metabox h3', function( event ) {
    355         // If the user clicks on some form input inside the h3, like a select list (for variations), the box should not be toggled
    356         if ( $( event.target ).filter( ':input, option, .sort' ).length ) {
    357             return;
    358         }
    359         $( this ).next( '.wc-metabox-content' ).stop().slideToggle();
    360     })
    361 
    362 
    363 
    364     $( '.wc-metabox.closed' ).each( function() {
    365         $( this ).find( '.wc-metabox-content' ).hide();
    366     });
    367 
    368     $(document).on('click', 'a.remove_variation.delete', function(){
    369         $(this).closest('div.woocommerce_variation').remove();
    370     });
    371 
    372    
    373 
    374     function dk_build_sortable_bundle( idField, args ) {
    375 
    376             dk_get_products( $('select#doko-box-pdts-select-id-' + idField), 'hs_dk_query_wc', doko_object.pick_product_message, true );
    377             dk_get_products( $('select#doko-ctgs-select-id-' + idField), 'hs_dk_query_wc', doko_object.pick_category_message, true );
    378             dk_change_option_disposition( 'input[name="doko['+idField+'][options]"]', 'tr.doko-tr-section-prod-' + idField, 'tr.doko-tr-section-cat-' + idField , 'tr.doko-multiple-tags.doko-tr-section-tag-'+idField  )
    379             dk_change_title_disposition( 'input[name="doko['+idField+'][display-bundle-title]"]', 'tr.doko-tr-section-bundle-title-' + idField );
    380             $('select[name="doko['+idField+'][tags][]"]').select2()
    381 
    382 
    383             if ( $('#'+ args.box_description_editor_id).length > 0 ) {
    384                 wp.attachEditor( document.getElementById( args.box_description_editor_id ) , {});
    385                 $('input[name="doko['+idField+'][screen-name]"]').on('keyup', function(e) {
    386                     $('span.doko-section-'+idField ).html($(this).val())
    387                 });
    388             }
    389            
    390     }
    391 
    392 
    393     function change_product_type_tip( content ) {
    394         $( '#tiptip_holder' ).removeAttr( 'style' );
    395         $( '#tiptip_arrow' ).removeAttr( 'style' );
    396         $( '.woocommerce-product-type-tip' ).tipTip( {
    397             attribute: 'data-tip',
    398             content: content,
    399             fadeIn: 50,
    400             fadeOut: 50,
    401             delay: 200,
    402             keepAlive: true,
    403         } );
    404 
    405         $( '.woocommerce-help-tip' ).tipTip( {
    406             attribute: 'data-tip',
    407             content: content,
    408             fadeIn: 50,
    409             fadeOut: 50,
    410             delay: 200,
    411             keepAlive: true,
    412         } );
    413     }
    414 
    415 
    416     function hs_dk_get_dynamic_rule( option_name, hash_code, field_id ) {
    417         var woo_usn_field_options = $("p.doko-dynamic-rules[data-screen-id='"+hash_code+"'] select.hs-dk-options[name='doko[rules][" + hash_code + "][dynamic]["+field_id+"][cl-options]']");
    418         var woo_usn_field_values  = $("p.doko-dynamic-rules[data-screen-id='"+hash_code+"'] span#"+field_id);
    419         switch (option_name) {
    420             case 'total_products_count_on_screen':
    421             case 'products_count_on_screen':
    422                 woo_usn_field_options.empty().append(hs_generate_html_operators());
    423                 woo_usn_field_values.empty().attr('name', 'filter-by-amount').append('<input type="number" name="doko[rules][' + hash_code + '][dynamic]['+field_id+'][cl-values]"  required/>' + "&nbsp;&nbsp;&nbsp;<button class='button button-primary doko-rule-remove-block' >Remove</button>");
    424                 break;
    425 
    426             default:
    427                 break;
    428         }
    429     }
    430 
    431     var hs_dk_generate_fields = function (hash_code = HSGenerateRandom(5),box_id) {
    432         var html = "<p data-hash='" + hash_code + "' class='hs-dk-content'>";
    433 
    434         html += "<select class='hs-dk-rules' name='doko[rules]["+box_id+"][dynamic][" + hash_code + "][cl-rules]' >";
    435         for (var option_name in window.doko.rules ) {
    436             html += "<option value='" + option_name + "'>" + window.doko.rules[option_name] + "</option>";
    437         }
    438         html += "</select>&nbsp;&nbsp;&nbsp; <select class='hs-dk-options' name='doko[rules]["+box_id+"][dynamic][" + hash_code + "][cl-options]'>";
    439 
    440         for (var option_name in window.doko.product_operators ) {
    441             html += "<option value='" + option_name + "'>" + window.doko.product_operators[option_name] + "</option>";
    442         }
    443         html += "</select>&nbsp;&nbsp;&nbsp;"
    444        
    445         html +="<span class='hs-dk-values' id="+hash_code+"><input type='text' /> <button class='button button-primary woo-usn-cl-remove-block' >Remove</button> </span></p>";
    446         return html;
    447     }
    448 
    449 
    450     var HSGenerateRandom = function (length) {
    451         "use strict";
    452         var result = "";
    453         var characters =
    454           "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
    455         var charactersLength = characters.length;
    456         for (var i = 0; i < length; i++) {
    457           result += characters.charAt(Math.floor(Math.random() * charactersLength));
    458         }
    459         return result;
    460     };
    461 
    462 
    463     var hs_generate_html_operators = function ( values = window.doko.product_operators  ) {
    464         var html ;
    465         for (var option_name in values ) {
    466             html += "<option value='" + option_name + "'>" + values[option_name] + "</option>";
    467         }
    468         return html;
    469     };
    470 
    471     var hs_dk_toggle_rule_action = function( bundleId, idField ) {
    472         var elem = $('select[name="doko['+idField+'][action]"]');
    473         elem.on('change', function() {
    474             var value = $(this).val();
    475             if ( value == "limit-product-in-current-step"  || value == "limit-product-in-next-step"  ) {
    476                 $('tr.doko-limit-product-number.doko-'+idField ).show();
    477                 $('tr.doko-limit-product-amount.doko-'+idField ).hide();
    478                 $('tr.doko-go-to-screen.doko-'+idField ).hide();
    479             }
    480 
    481 
    482             if ( value == "limit-amount-in-current-step"  || value == "limit-amount-in-next-step"  ) {
    483                 $('tr.doko-limit-product-number.doko-'+idField ).hide();
    484                 $('tr.doko-limit-product-amount.doko-'+idField ).show();
    485                 $('tr.doko-go-to-screen.doko-'+idField ).hide();
    486             }
    487 
    488             if ( value == "go-to-step" ) {
    489                 $('tr.doko-limit-product-number.doko-'+idField ).hide();
    490                 $('tr.doko-limit-product-amount.doko-'+idField ).hide();
    491 
    492                 $('tr.doko-go-to-screen.doko-'+idField ).show();
    493             }
    494 
    495 
    496 
    497         });
    498         elem.trigger('change');
    499     }
    500 
    501 
    502     var hs_dk_get_screen_product_list = function( bundleId, idField ) {
    503         var elem = $('select[name="doko['+idField+'][screen-name]"]');
    504 
    505         elem.on('change', function() {
    506             var value = $(this).val();
    507             $.post(
    508                 ajaxurl,
    509                 {
    510                     bundle_id : bundleId,
    511                     screen  : value,
    512                     action : "doko_get_screen_products"
    513                 }, function(r) {
    514                     var json = JSON.parse(r);
    515                     if ( json.html ) {
    516                         $('select[name="doko['+idField+'][rule][]"]').html(json.html);
    517                         var jss = JSON.parse(window.doko_rule_list);
    518                         if ( undefined != jss[idField] ) {
    519                             var jrule = jss[idField]['rule'];
    520                             $('select[name="doko[' + idField + '][rule][]"]').val(jrule);
    521                         }
    522                         $('select[name="doko[' + idField + '][rule][]"]').select2({'width' : '100%' })
    523                     }
    524 
    525                 }
    526             );
    527         });
    528         elem.trigger('change');
    529     }
    530 
    531     function hs_dk_toggle_pagination_per_page( idField ) {
    532         $('select[name="doko['+idField+'][enable-pagination]"]').on("change", function(e){
    533             e.preventDefault();
    534             let options = $('tr.doko-tr-nb-products-per-page.doko-'+idField);
    535             if ( $(this).val() == "yes" ) {
    536                 options.show();
    537             } else {
    538                 options.hide();
    539             }
    540         })
    541         $('select[name="doko['+idField+'][enable-pagination]"]').trigger('change')
    542     }
    543 
    544 
    545     function hs_dk_toggle_gift_messages( idField ) {
    546         $('select[name="doko['+idField+'][enable-gift-message]"]').on("change", function(e){
    547             e.preventDefault();
    548             let options = $('tr.doko-tr-title-gift-message.doko-'+idField);
    549             if ( $(this).val() == "yes" ) {
    550                 options.show();
    551             } else {
    552                 options.hide();
    553             }
    554             options = $('tr.doko-tr-desc-gift-message.doko-'+idField);
    555             if ( $(this).val() == "yes" ) {
    556                 options.show();
    557             } else {
    558                 options.hide();
    559             }
    560         })
    561         $('select[name="doko['+idField+'][enable-gift-message]"]').trigger('change')
    562     }
    563 
    564 
    565     function hs_dk_toggle_btn_qty( idField ) {
    566         $('select[name="doko['+idField+'][enable-qty-input]"]').on("change", function(e){
    567             e.preventDefault();
    568             let options = $('tr.doko-idproduct-qty-field-option.doko-'+idField);
    569             if ( $(this).val() == "yes" ) {
    570                 options.show();
    571             } else {
    572                 options.hide();
    573             }
    574         })
    575         $('select[name="doko['+idField+'][enable-qty-input]"]').trigger('change')
    576     }
    577 
    578     function hs_dk_toggle_bundle_viewer( idField ) {
    579 
    580         $(document).on('change', '[name="doko['+idField+'][display-bundle-viewer]"]', function(){
    581             var show_viewer = $(this).val()
    582             if ( show_viewer == "no" ) {
    583                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.choose-bundle-screen-disposition').hide();
    584                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.display-bundle-title').hide();
    585                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-tr-section-bundle-title-' + idField ).hide();
    586                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-box-selection-mode').hide();
    587                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-multiple-tags.doko-tr-section-tag-'+idField).hide();
    588                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-tr-section-prod-'+idField).hide();
    589                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-tr-section-cat-'+idField).hide();
    590                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-enable-product-description').hide();
    591                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-enable-qty-input-label').hide();
    592                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-tr-enable-pagination').hide();   
    593 
    594                
    595                
    596 
    597             } else {
    598                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.choose-bundle-screen-disposition').show();
    599                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.display-bundle-title').show();
    600                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-enable-product-description').show();
    601                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-box-selection-mode').show();     
    602                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-tr-section-prod-'+idField).show();
    603                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-enable-qty-input-label').show();
    604                 $('table[name="formulus-input-doko-box-selection-'+idField+'"] tr.doko-tr-enable-pagination').show();   
    605 
    606             }
    607         });
    608         $('[name="doko['+idField+'][display-bundle-viewer]"]').trigger('change');
    609 
    610 
    611     }
    612 
    613 
    614     function hs_dk_toggle_qty_field ( ){
    615         $('select[name="doko[enable-qty-input]"]').on('change', function(e){
    616             e.preventDefault();
    617             let option_selected = $(this).val();
    618             if ( option_selected == "yes" ) {
    619                 $('tr.doko-qty-position-field').show();
    620             }else {
    621                 $('tr.doko-qty-position-field').hide();
    622             }
    623 
    624         });
    625 
    626         $('select[name="doko[enable-qty-input]"]').trigger('change');
    627     }
    628      
    629 })( jQuery );
    630 
    631 
    632 
    633 
     238})(jQuery);
     239
     240
     241
     242
  • doko-box-builder/trunk/admin/js/hs-doko-bg-admin.js

    r3169060 r3315238  
    6969            }
    7070
    71            
    72 
     71   
    7372            $( document ).on(
    7473                "click",
  • doko-box-builder/trunk/core/class-hs-doko-activator.php

    r3150448 r3315238  
    11<?php
    2 
     2namespace HS\Doko;
    33/**
    44 * Fired during plugin activation
  • doko-box-builder/trunk/core/class-hs-doko-deactivator.php

    r3150448 r3315238  
    11<?php
    2 
     2namespace HS\Doko;
    33/**
    44 * Fired during plugin deactivation
  • doko-box-builder/trunk/core/class-hs-doko-i18n.php

    r3150448 r3315238  
    11<?php
    2 
     2namespace HS\Doko;
    33/**
    44 * Define the internationalization functionality
  • doko-box-builder/trunk/core/class-hs-doko-loader.php

    r3150448 r3315238  
    11<?php
    2 
     2namespace HS\Doko;
    33/**
    44 * Register all actions and filters for the plugin
  • doko-box-builder/trunk/core/class-hs-doko-utils.php

    r3230317 r3315238  
    11<?php
    22
     3namespace Hs\Doko;
     4
    35/**
    46 * Get WC Products by Name.
     
    810 */
    911function hs_dk_get_wc_products(  $product_name  ) {
    10     $query_args = array(
    11         'fields'           => 'ids',
    12         'post_type'        => array('product', 'product_variation'),
    13         'post_status'      => 'publish',
    14         'meta_query'       => array(array(
     12    /**
     13     * product options :
     14     *  --- Option 1 ==> stock validity
     15     *  --- Option 2 ==> product without prices
     16     *  --- Option 3 ==> product hidden
     17     *
     18     */
     19    $product_options = [
     20        'stock' => [
    1521            'key'   => '_stock_status',
    1622            'value' => 'instock',
    17         ), array(
     23        ],
     24        'price' => [
    1825            'key'     => '_regular_price',
    1926            'value'   => '0',
    2027            'compare' => '!=',
    21         )),
     28        ],
     29    ];
     30    // Prepare the query arguments for product retrieval
     31    $query_args = [
     32        'fields'           => 'ids',
     33        'post_type'        => ['product', 'product_variation'],
     34        'post_status'      => 'publish',
     35        'meta_query'       => array_values( $product_options ),
    2236        'meta_compare_key' => 'AND',
    23         'search_columns'   => array('post_title'),
     37        'search_columns'   => ['post_title'],
    2438        'limit'            => -1,
    25     );
     39    ];
    2640    if ( $product_name ) {
    2741        $query_args['s'] = $product_name;
    2842    }
    2943    $all_query = array();
    30     $query = new WP_Query($query_args);
     44    $query = new \WP_Query($query_args);
    3145    foreach ( $query->posts as $query_key => $query_value ) {
    3246        $product = wc_get_product( $query_value );
     
    119133     */
    120134    return apply_filters( 'doko_get_products_options_type', array(
    121         'low-price'  => esc_html__( 'Price (Low to High)', 'doko' ),
    122         'high-price' => esc_html__( 'Price (High to Low)', 'doko' ),
     135        'low-price'  => esc_html__( 'Price (Low to High)', 'doko-bundle-builder' ),
     136        'high-price' => esc_html__( 'Price (High to Low)', 'doko-bundle-builder' ),
    123137    ) );
    124138}
     
    145159    $values = array(
    146160        'products'           => array(
    147             'title'            => esc_html__( 'Bundle Products', 'doko' ),
     161            'title'            => esc_html__( 'Bundle Products', 'doko-bundle-builder' ),
    148162            'preview_img_link' => plugin_dir_url( __DIR__ ) . 'admin/img/products.png',
    149163            'slug'             => 'products',
    150164        ),
    151165        'products-with-cart' => array(
    152             'title'            => esc_html__( 'Bundle Cart Content', 'doko' ),
     166            'title'            => esc_html__( 'Bundle Cart Content', 'doko-bundle-builder' ),
    153167            'preview_img_link' => plugin_dir_url( __DIR__ ) . 'admin/img/products-with-cart.png',
    154168            'slug'             => 'products-with-cart',
    155169        ),
    156170        'card-page-type'     => array(
    157             'title'            => esc_html__( 'Bundle Card Page', 'doko' ),
     171            'title'            => esc_html__( 'Bundle Card Page', 'doko-bundle-builder' ),
    158172            'preview_img_link' => plugin_dir_url( __DIR__ ) . 'admin/img/card-step.png',
    159173            'slug'             => 'card-page-type',
     
    186200            )),
    187201        );
    188         $query = new WP_Query($query_args);
     202        $query = new \WP_Query($query_args);
    189203        $products = $query->posts;
    190         echo do_shortcode( '[doko_products ids="' . implode( ',', $products ) . '"   columns="3" order="ASC" is_card_screen="' . $is_card_screen . '"]' );
     204        echo \do_shortcode( '[doko_products ids="' . implode( ',', $products ) . '"   columns="3" order="ASC" is_card_screen="' . $is_card_screen . '"]' );
    191205    }
    192206
     
    195209    function hs_dk_display_products_disposition(  $products, $is_card_screen = false  ) {
    196210        global $doko_current_package_data;
    197         echo do_shortcode( '[doko_products ids="' . implode( ',', $products ) . '"   columns="3" order="ASC" is_card_screen="' . $is_card_screen . '"]' );
     211        echo \do_shortcode( '[doko_products ids="' . implode( ',', $products ) . '"   columns="3" order="ASC" is_card_screen="' . $is_card_screen . '"]' );
    198212    }
    199213
  • doko-box-builder/trunk/core/class-hs-doko.php

    r3230317 r3315238  
    11<?php
     2
     3namespace HS\Doko;
    24
    35/**
     
    6769            $this->version = '1.0.0';
    6870        }
    69         $this->plugin_name = 'doko';
     71        $this->plugin_name = 'doko-bundle-builder';
    7072        $this->load_dependencies();
    7173        $this->set_locale();
     
    139141     */
    140142    private function define_admin_hooks() {
    141         $plugin_admin = new HS\Doko\Hs_Doko_Admin($this->get_plugin_name(), $this->get_version());
     143        $plugin_admin = new Hs_Doko_Admin($this->get_plugin_name(), $this->get_version());
    142144        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
    143145        $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
     
    170172     */
    171173    private function define_public_hooks() {
    172         $plugin_public = new HS\Doko\Hs_Doko_Public($this->get_plugin_name(), $this->get_version());
    173         $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_styles' );
    174         $this->loader->add_action( 'wp_enqueue_scripts', $plugin_public, 'enqueue_scripts' );
     174        $plugin_public = new Hs_Doko_Public($this->get_plugin_name(), $this->get_version());
     175        $this->loader->add_action(
     176            'wp_enqueue_scripts',
     177            $plugin_public,
     178            'enqueue_styles',
     179            20
     180        );
     181        $this->loader->add_action(
     182            'wp_enqueue_scripts',
     183            $plugin_public,
     184            'enqueue_scripts',
     185            20
     186        );
    175187        $this->loader->add_action( 'init', $plugin_public, 'init_shortcodes' );
    176188        $this->loader->add_action(
  • doko-box-builder/trunk/core/homescriptone-formulus.php

    r3230317 r3315238  
    11<?php
     2
     3namespace HS\Doko;
    24
    35if ( ! defined( 'ABSPATH' ) ) {
     
    4244            'min'               => '',
    4345            'max'               => '',
     46            'disabled_options'  => []
    4447        );
    4548
     
    5457        if ( $args['required'] ) {
    5558            $args['class'][] = 'validate-required';
    56             $required        = '&nbsp;<abbr class="required" title="' . esc_attr__( 'required', 'doko' ) . '">*</abbr>';
     59            $required        = '&nbsp;<abbr class="required" title="' . esc_attr__( 'required', 'doko-bundle-builder' ) . '">*</abbr>';
    5760        }
    5861
     
    163166                    foreach ( $args['options'] as $option_key => $option_text ) {
    164167
     168                        $disabled = '';
     169                        if ( isset( $args['disabled_options'] ) && ! empty( $args['disabled_options'] ) ) {
     170                            if ( in_array( $option_key, $args['disabled_options'] ) ) {
     171                                $disabled = "disabled='disabled'"; 
     172                            }
     173                        }
    165174                        $selected = '';
    166175                        if ( '' === $option_key ) {
    167176                            // If we have a blank option, select2 needs a placeholder.
    168177                            if ( empty( $args['placeholder'] ) ) {
    169                                 $args['placeholder'] = $option_text ? $option_text : esc_html__( 'Choose an option', 'doko' );
     178                                $args['placeholder'] = $option_text ? $option_text : esc_html__( 'Choose an option', 'doko-bundle-builder' );
    170179                            }
    171180                            $custom_attributes[] = 'data-allow_clear="true"';
     
    176185                        }
    177186
    178                         $options .= '<option value="' . esc_attr( $option_key ) . '" ' . selected( $value, $option_key, false ) . ' ' . $selected . ' >' . esc_attr( $option_text ) . '</option>';
     187                        $options .= '<option value="' . esc_attr( $option_key ) . '" ' . $disabled  .' ' . selected( $value, $option_key, false ) . ' ' . $selected . ' >' . esc_attr( $option_text ) . '</option>';
    179188                    }
    180189
     
    205214                ob_start();
    206215                wp_editor( $value, $id, $settings );
    207                 _WP_Editors::enqueue_scripts();
    208                 _WP_Editors::editor_js();
     216                \_WP_Editors::enqueue_scripts();
     217                \_WP_Editors::editor_js();
    209218                print_footer_scripts();
    210219                $field .= ob_get_clean();
     
    350359            'title'                   => array(),
    351360            'checked'                 => array(),
     361            'disabled'                => array(),
    352362            'placeholder'             => array(),
    353363            'rel'                     => array(),
     
    386396            'data-product-cat' => array(),
    387397            'data-product-tag' => array(),
    388             'data-bundle-content-id' => array()
     398            'data-bundle-content-id' => array(),
     399            'data-row-index' => array()
    389400
    390401        );
     
    438449
    439450
    440 function formulus_generate_repeatable_fields( $id, $options, $display_head=true ) {
     451function formulus_generate_repeatable_fields($id, $options, $key_name, $display_head = true, $include_skeleton = false)
     452{
    441453    ob_start();
    442     ?>
    443         <table class="table">
     454    if ($include_skeleton) {
     455        ?>
     456            <table class="table">
     457        <?php
     458    }
     459    if ($display_head == true) {
     460        ?>
    444461            <thead>
    445462                <tr>
    446463                    <?php
    447                         if ( isset( $options['head'] ) && $display_head ) {
    448                             foreach( $options['head'] as $thk => $thv ) {
    449                                 echo "<th name='doko[discounts][$id][$thk]' class='doko_discounts_thead'>".$thv."</th>";
    450                             }
    451                             ?>
    452                                 <th><?php _e('Options' ); ?></th>
    453                             <?php
     464                    if (isset($options['head'])) {
     465                        foreach ($options['head'] as $thk => $thv) {
     466                            echo "<th name='doko[$key_name][$id][$thk]' class='doko_discounts_thead'>" . $thv . "</th>";
    454467                        }
     468                        ?>
     469                                    <th><?php esc_textarea('Options'); ?></th>
     470                                <?php
     471                    }
    455472                    ?>
    456473                </tr>
    457474            </thead>
    458             <tbody>
    459                 <tr>
    460                     <?php
    461                     if ( isset( $options['head']) ) {
    462                         foreach( $options['head'] as $thk => $thv ) {
    463                             echo "<td>";
    464                             echo $options['body'][$thk]['content'];
    465                             echo "</td>";
    466                         }
     475        <?php
     476    }
     477    if ($include_skeleton) {
     478    ?>
     479        <tbody>
     480    <?php
     481    }
     482    ?>
     483    <tr class="doko_tr_element doko_tr_<?php echo esc_attr($id); ?>">
     484        <?php
     485            if (isset($options['head'])) {
     486                foreach ($options['head'] as $thk => $thv) {
     487                   
     488                    if ( isset( $options['body'][$thk] ) ) {
     489                        echo "<td>";
     490                        echo $options['body'][$thk]['content'];
     491                        echo "</td>";
    467492                    }
    468                     ?>
    469                     <td class="doko_discounts_options_head">
    470                         <button class="button button-primary doko-add-discounts" >+</button>
    471                         <button class="button button-secondary doko-remove-discounts" style="background-color:red; color:white;">-</button>
    472                     </td>
    473                 </tr>
     493                   
     494                }
     495            }
     496        ?>
     497        <td class="doko_<?php echo esc_attr($id); ?>_options_head">
     498            <button class="button button-secondary doko-remove-rule-row doko-remove-<?php echo esc_attr($id); ?>" style="background-color:red; color:white;">-</button>
     499        </td>
     500    </tr>
     501    <?php
     502        if ($include_skeleton) {
     503        ?>
    474504            </tbody>
    475         </table>
     505            </table>
    476506    <?php
     507        }
    477508    return ob_get_clean();
    478509}
  • doko-box-builder/trunk/core/premium-loading.php

    r3202806 r3315238  
    2020                'is_premium'          => false,
    2121                'premium_suffix'      => 'pro',
     22                'has_addons'          => true,
    2223                'has_paid_plans'      => true,
    2324                'menu'                => array(
  • doko-box-builder/trunk/hs-doko.php

    r3230317 r3315238  
    88 *
    99 * @wordpress-plugin
    10  * Plugin Name:       DokoBuilder : The Ultimate dynamic bundle builder for WooCommerce
     10 * Plugin Name:       Doko Bundle Builder : The Ultimate dynamic bundle builder for WooCommerce
    1111 * Plugin URI:        https://ultiwp.com/plugins/doko
    1212 * Description:       Increase sales by letting your customers create custom bundles.
    13  * Version:           1.8
     13 * Version:           1.9
    1414 * Author:            UltiWP
    1515 * Author URI:        https://ultiwp.com
    1616 * License:           GPL-2.0
    1717 * License URI:       http://www.gnu.org/licenses/gpl-2.0.txt
    18  * Text Domain:       doko
     18 * Text Domain:       doko-bundle-builder
    1919 * Domain Path:       /languages
    2020 * Requires at least: 6.0
     
    3535 * Rename this for your plugin and update it as you release new versions.
    3636 */
    37 define( 'DOKO_VERSION', '1.8' );
     37define( 'DOKO_VERSION', '1.9' );
    3838define( 'DOKO_DIR_PATH', plugin_dir_path( __FILE__ ) );
    3939
     
    5555function doko_run_activation() {
    5656    require_once plugin_dir_path( __FILE__ ) . 'core/class-hs-doko-activator.php';
    57     Hs_Doko_Activator::activate();
     57    HS\Doko\Hs_Doko_Activator::activate();
    5858}
    5959
     
    6464function doko_run_deactivation() {
    6565    require_once plugin_dir_path( __FILE__ ) . 'core/class-hs-doko-deactivator.php';
    66     Hs_Doko_Deactivator::deactivate();
     66    HS\Doko\Hs_Doko_Deactivator::deactivate();
    6767}
    6868
     
    8888function doko_run() {
    8989
    90     $plugin = new Hs_Doko();
     90    $plugin = new HS\Doko\Hs_Doko();
    9191    $plugin->run();
    9292}
  • doko-box-builder/trunk/languages/doko-en_US.l10n.php

    r3169060 r3315238  
    11<?php
    2 return ['project-id-version'=>'DokoBuilder : DIY Product Bundle for WooCommerce','report-msgid-bugs-to'=>'','pot-creation-date'=>'2022-08-28 11:01+0000','po-revision-date'=>'2024-10-12 03:45+0000','last-translator'=>'','language-team'=>'English (United States)','language'=>'en_US','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.2; wp-6.0.1','x-domain'=>'doko','messages'=>['Add to box'=>'Add to box','An error occurred while loading this page, please write to the site administrator.'=>'An error occurred while loading this page, please write to the site administrator.','Back'=>'Back','Bundle'=>'Bundle','Bundle name'=>'Bundle name','Bundles'=>'Bundles','Categories'=>'Categories','Categories to display :'=>'Categories','CHOOSE YOUR BOX COLOR'=>'CHOOSE YOUR BOX COLOR','Choose YOUR CARD'=>'CHOOSE YOUR CARD','Complete Box'=>'Complete Box','Define the products categories, your customers are allowed to pick to fill this step in the bundle.'=>'Define the products categories, your customers are allowed to pick to fill this step in the bundle.','Define the products, your customers are allowed to pick to fill this step in the bundle.'=>'Define the products, your customers are allowed to pick to fill this step in the bundle.','Display according to :'=>'Display according to :','Documentation'=>'Documentation','Edit Bundle'=>'Edit Bundle','Enter your categorie(s) name(s)'=>'Enter your categorie(s) name(s)','Enter your product(s) name(s)'=>'Enter your product(s) name(s)','First Screen setup'=>'First Screen setup','Increase sales by letting your customers create custom bundles.'=>'Increase sales by letting your customers create custom bundles.','Loading'=>'Loading','New Bundle'=>'New Bundle','Next'=>'Next','No Bundle found'=>'No Bundle found','No Bundle in the trash'=>'No Bundle in the trash','Price (High to Low)'=>'Price (High to Low)','Price (Low to High)'=>'Price (Low to High)','Products to display :'=>'Products to display :','Search Bundle'=>'Search Bundle','Sort by Options'=>'Sort by Options','Start selecting items to fill your box'=>'Start selecting items to fill your box','This refers to the first navigation screen of the bundle builder : '=>'This refers to the first navigation screen of the bundle builder : ','Title'=>'Title','Total :'=>'Total :','View Bundle'=>'View Bundle','Your bundle is added to the cart, you will redirect to cart in few moments'=>'Your bundle is added to the cart, you will redirect to cart in few moments']];
     2return ['project-id-version'=>'DokoBuilder : DIY Product Bundle for WooCommerce','report-msgid-bugs-to'=>'','pot-creation-date'=>'2022-08-28 11:01+0000','po-revision-date'=>'2024-10-12 03:45+0000','last-translator'=>'','language-team'=>'English (United States)','language'=>'en_US','plural-forms'=>'nplurals=2; plural=n != 1;','mime-version'=>'1.0','content-type'=>'text/plain; charset=UTF-8','content-transfer-encoding'=>'8bit','x-generator'=>'Loco https://localise.biz/','x-loco-version'=>'2.6.2; wp-6.0.1','x-domain'=>'doko-bundle-builder','messages'=>['Add to box'=>'Add to box','An error occurred while loading this page, please write to the site administrator.'=>'An error occurred while loading this page, please write to the site administrator.','Back'=>'Back','Bundle'=>'Bundle','Bundle name'=>'Bundle name','Bundles'=>'Bundles','Categories'=>'Categories','Categories to display :'=>'Categories','CHOOSE YOUR BOX COLOR'=>'CHOOSE YOUR BOX COLOR','Choose YOUR CARD'=>'CHOOSE YOUR CARD','Complete Box'=>'Complete Box','Define the products categories, your customers are allowed to pick to fill this step in the bundle.'=>'Define the products categories, your customers are allowed to pick to fill this step in the bundle.','Define the products, your customers are allowed to pick to fill this step in the bundle.'=>'Define the products, your customers are allowed to pick to fill this step in the bundle.','Display according to :'=>'Display according to :','Documentation'=>'Documentation','Edit Bundle'=>'Edit Bundle','Enter your categorie(s) name(s)'=>'Enter your categorie(s) name(s)','Enter your product(s) name(s)'=>'Enter your product(s) name(s)','First Screen setup'=>'First Screen setup','Increase sales by letting your customers create custom bundles.'=>'Increase sales by letting your customers create custom bundles.','Loading'=>'Loading','New Bundle'=>'New Bundle','Next'=>'Next','No Bundle found'=>'No Bundle found','No Bundle in the trash'=>'No Bundle in the trash','Price (High to Low)'=>'Price (High to Low)','Price (Low to High)'=>'Price (Low to High)','Products to display :'=>'Products to display :','Search Bundle'=>'Search Bundle','Sort by Options'=>'Sort by Options','Start selecting items to fill your box'=>'Start selecting items to fill your box','This refers to the first navigation screen of the bundle builder : '=>'This refers to the first navigation screen of the bundle builder : ','Title'=>'Title','Total :'=>'Total :','View Bundle'=>'View Bundle','Your bundle is added to the cart, you will redirect to cart in few moments'=>'Your bundle is added to the cart, you will redirect to cart in few moments']];
  • doko-box-builder/trunk/public/class-hs-doko-public.php

    r3230317 r3315238  
    3737     */
    3838    private $version;
    39 
    40     private $package_id;
    4139
    4240    /**
     
    7977            return;
    8078        }
     79        // desenqueue script + style.
     80        wp_dequeue_style( 'bootstrap' );
     81        wp_dequeue_style( 'bootstrap-rtl' );
    8182        wp_enqueue_style(
    8283            $this->plugin_name,
     
    139140            return;
    140141        }
     142        // desenqueue script + style.
     143        wp_dequeue_script( 'bootstrap' );
     144        wp_dequeue_script( 'bootstrap-rtl' );
    141145        $term_file = "-min.js";
    142146        if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
     
    171175            false
    172176        );
    173         $loading_message = esc_html__( 'Loading', 'doko' );
     177        $loading_message = esc_html__( 'Loading', 'doko-bundle-builder' );
    174178        /**
    175179         * Filter the data passed to the JS.
     
    178182         */
    179183        $data = apply_filters( 'doko_js_data_boxpage', array(
    180             'ajaxurl'              => admin_url( 'admin-ajax.php' ),
    181             'wc_price_args'        => array(
     184            'ajaxurl'                         => admin_url( 'admin-ajax.php' ),
     185            'wc_price_args'                   => array(
    182186                'html'                         => true,
    183187                'currency_symbol'              => get_woocommerce_currency_symbol( get_woocommerce_currency() ),
     
    188192                'price_format'                 => get_woocommerce_price_format(),
    189193            ),
    190             'next_message'         => esc_html__( 'Next', 'doko' ),
    191             'loading_message'      => $loading_message,
    192             'completed_message'    => esc_html__( 'Your bundle is added to the cart, you will redirect to cart in few moments', 'doko' ),
    193             'cart_page_url'        => wc_get_cart_url(),
    194             'limit_product_number' => esc_html__( "You can't add more than %s products into the box.", 'doko' ),
    195             'limit_product_amount' => esc_html__( 'You reached the limit of %s for this box.', 'doko' ),
    196             'can_use_pro'          => doko_fs()->can_use_premium_code(),
     194            'next_message'                    => esc_html__( 'Next', 'doko-bundle-builder' ),
     195            'loading_message'                 => $loading_message,
     196            'completed_message'               => esc_html__( 'Your bundle is added to the cart, you will redirect to cart in few moments', 'doko-bundle-builder' ),
     197            'cart_page_url'                   => wc_get_cart_url(),
     198            'limit_product_number'            => esc_html__( "The product %1s can't be added more than %2s in the bundle.", 'doko-bundle-builder' ),
     199            'limit_product_amount'            => esc_html__( 'You reached the limit of %s for this box.', 'doko-bundle-builder' ),
     200            'can_use_pro'                     => doko_fs()->can_use_premium_code(),
     201            'product_is_added_to_box_message' => esc_html__( 'Product %s is added to bundle', 'doko-bundle=builder' ),
     202            'total_qty_exceeded'              => esc_html__( 'You reached the limit of %s in the bundle.', 'doko-bundle-builder' ),
    197203        ) );
    198204        wp_add_inline_script( $this->plugin_name, ' var doko_object=' . wp_json_encode( $data ) . ';' );
     
    225231        }
    226232        add_shortcode( 'doko-bundles', array($this, 'display_shortcode') );
    227         add_shortcode( 'doko_products', 'doko_display_products' );
     233        add_shortcode( 'doko_products', 'HS\\Doko\\doko_display_products' );
    228234    }
    229235
     
    239245        $page_id = $this->get_page_id();
    240246        $post_obj = get_post( $page_id );
    241         if ( has_shortcode( $post_obj->post_content, 'doko-bundles' ) ) {
     247        if ( \has_shortcode( $post_obj->post_content, 'doko-bundles' ) ) {
    242248            $template_directory = untrailingslashit( DOKO_DIR_PATH ) . '/templates/';
    243249            if ( $name ) {
     
    335341        global $doko_current_page_data;
    336342        global $step_identifier;
    337         $is_doko_page = false;
    338343        $package_id = ( isset( $atts['id'] ) ? $atts['id'] : false );
    339344        $doko_bundle_id = $package_id;
    340         $this->package_id = $package_id;
    341345        $package_data = $this->get_data( $package_id );
    342346        $doko_package_data = $package_data;
     
    345349        }
    346350        if ( !$package_data ) {
    347             return esc_html__( 'An error occurred while loading this page, please write to the site administrator.', 'doko' );
     351            return esc_html__( 'An error occurred while loading this page, please write to the site administrator.', 'doko-bundle-builder' );
    348352        }
    349353        /**
     
    354358        $allowed_post_status = apply_filters( 'doko_bundle_status', array('publish') );
    355359        if ( !in_array( get_post_status( $package_id ), $allowed_post_status, true ) ) {
    356             return esc_html__( 'This bundle is not available to the public yet.', 'doko' );
     360            return esc_html__( 'This bundle is not available to the public yet.', 'doko-bundle-builder' );
    357361        }
    358362        $product_tags = array();
     
    375379        $doko_current_page = 'first-step';
    376380        $doko_current_page_data = $package_data;
     381        $is_doko_page = true;
    377382        $step_title = '';
    378383        if ( isset( $package_data['box-description'] ) ) {
     
    405410        echo wp_sprintf(
    406411            /* translators: %d: Step number. */
    407             esc_html__( 'Step %d', 'doko' ),
     412            esc_html__( 'Step %d', 'doko-bundle-builder' ),
    408413            1
    409414         );
     
    415420            echo wp_kses_post( $step_title );
    416421        } else {
    417             echo esc_html__( 'Packaging', 'doko' );
     422            echo esc_html__( 'Packaging', 'doko-bundle-builder' );
    418423        }
    419424        ?>
     
    442447            echo wp_sprintf(
    443448                /* translators: %d: Step number. */
    444                 esc_html__( 'Step %d', 'doko' ),
     449                esc_html__( 'Step %d', 'doko-bundle-builder' ),
    445450                esc_attr( $step_nb )
    446451             );
     
    448453                                    </div>
    449454                                    <div class="description ng-binding" ><?php
    450             ( isset( $value['screen-name'] ) ? esc_attr_e( $value['screen-name'] ) : '' );
     455            ( isset( $value['screen-name'] ) ? formulus_format_fields( $value['screen-name'] ) : '' );
    451456            ?></div>
    452457                                </a>
     
    460465        echo esc_attr( $step_nb );
    461466        ?>">
    462                         <a href="#"  class="completed woocommerce-loop-product__title">
     467                        <a href="#"  class="woocommerce-loop-product__title">
    463468                            <div class="icon">
    464469                                <span><?php
     
    467472                            </div>
    468473                            <div class="woocommerce-loop-product__title doko-label-title"><?php
    469         echo esc_html__( 'Step', 'doko' ) . esc_attr( $step_nb );
     474        echo esc_html__( 'Step', 'doko-bundle-builder' ) . esc_attr( $step_nb );
    470475        ?></div>
    471                             <div class="description ng-binding" ng-bind="settings.step4.general.step"><?php
    472         echo esc_html__( 'Done!', 'doko' );
     476                            <div class="description ng-binding" ><?php
     477        echo esc_html__( 'Done!', 'doko-bundle-builder' );
    473478        ?></div>
    474479                        </a>
     
    485490            <div class="modal doko_modal">
    486491                <div class="doko_modal_product_title"></div>
    487                 <div class="doko_modal_product_desc"></div>
     492                <div class="doko_modal_product_side" style="display: flex; justify-content: space-around;">
     493                    <div>
     494                        <div class="doko_modal_product_img"></div>
     495                    </div>
     496                    <div>
     497                        <div class="doko_modal_product_desc"></div>
     498                        <div class="doko_modal_product_price"></div>
     499                    </div>
     500                </div>
     501               
     502               
    488503            </div>
    489504            <div class="doko-box-section doko-navigation" >
     
    570585                            <div id="build-complete">
    571586                                <h4 class="doko-step-title secondary">Done!</h4>
    572                                 <h1 class="doko-step-title primary ng-binding" ng-bind="settings.step4.general.title">
     587                                <h1 class="doko-step-title primary ng-binding" >
    573588                                <?php
    574         esc_html_e( $last_step_title, 'doko' );
     589        formulus_format_fields( $last_step_title );
    575590        ?>
    576591                                </h1>
    577                                 <div class="doko-step-description ng-binding" ng-bind-html="settings.step4.general.description"><p>
     592                                <div class="doko-step-description ng-binding" ><p>
    578593                                <?php
    579         esc_html_e( $last_step_description, 'doko' );
     594        formulus_format_fields( $last_step_description );
    580595        ?>
    581596
     
    599614                                </div>
    600615
    601                         <div ng-if="model.status == 'complete'" style="margin: 40px auto 0 auto; width: 400px; max-width: 100%;" class="ng-scope doko-is-complete">
     616                        <div style="margin: 40px auto 0 auto; width: 400px; max-width: 100%;" class="ng-scope doko-is-complete">
    602617                            <button class="button wp-element-button doko-go-to-cart" type="button">
    603618                                                    <span><?php
    604         esc_html_e( 'View Cart', 'doko' );
     619        esc_html_e( 'View Cart', 'doko-bundle-builder' );
    605620        ?></span>
    606621                                            </button>
     
    608623                            <button class="button alt wp-element-button doko-restart" type="button" >
    609624                                                    <span><?php
    610         esc_html_e( ' Build Another Bundle', 'doko' );
     625        esc_html_e( ' Build Another Bundle', 'doko-bundle-builder' );
    611626        ?></span>
    612627                                            </button>
     
    647662                    <div class="hs-dk-menu-btn-content-fix">
    648663                    <ul class="doko-btn-navigation">
    649                         <li class="doko-button-rb"><button href="#total" class="doko-page-btn button button-primary doko-total-btn wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive" data-btn-type="total" style="background-color: #f5f1f1; color:black;" ><?php
    650         esc_attr_e( 'Total :', 'doko' );
     664                        <li class="doko-button-rb">
     665                            <button href="#total" rel="modal:open" class="doko-page-btn button button-primary doko-total-btn wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive doko_total_btn_elt" data-btn-type="total" style="background-color: #f5f1f1; color:black;" ><?php
     666        esc_attr_e( 'Total :', 'doko-bundle-builder' );
    651667        ?> <?php
    652668        echo wp_kses_post( wc_price( 0 ) );
    653         ?></button></li>
     669        ?></button>
     670                        </li>
    654671                        <li><button href="#prev" class="doko-page-btn button button-primary wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive" data-btn-type="prev" ><?php
    655         esc_attr_e( 'Back', 'doko' );
     672        esc_attr_e( 'Back', 'doko-bundle-builder' );
    656673        ?></button></li>
    657674                        <li><button href="#next" class="doko-page-btn button button-primary wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive"  data-btn-type="next"><?php
    658         esc_attr_e( 'Next', 'doko' );
     675        esc_attr_e( 'Next', 'doko-bundle-builder' );
    659676        ?></button></li>
    660677                        <li><button href="#complete-box" class="doko-page-btn button button-primary wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive" style="display:none;"  data-btn-type="complete-box"><?php
    661         esc_attr_e( 'Complete Box', 'doko' );
     678        esc_attr_e( 'Complete Box', 'doko-bundle-builder' );
    662679        ?></button></li>
    663680                    </ul>
     
    678695                ;
    679696            </script>
    680             <!-- <div id="doko_total_bundle_details" role="tooltip" popover>
    681                 Details
    682             </div> -->
     697            <div id="doko_total_details" class="modal">
     698              <table class="doko_total_details doko_select wc-block-cart-items wp-block-woocommerce-cart-line-items-block">
     699                <thead>
     700                    <tr>
     701                        <th></th>
     702                        <th><?php
     703        esc_html_e( 'Product Name', 'doko-bundle-builder' );
     704        ?></th>
     705                        <th class="doko_style_to_hide"><?php
     706        esc_html_e( 'Unit Price', 'doko-bundle-builder' );
     707        ?></th>
     708                        <th class="doko_style_to_hide"><?php
     709        esc_html_e( 'Quantity', 'doko-bundle-builder' );
     710        ?></th>
     711                        <th><?php
     712        esc_html_e( 'Total', 'doko-bundle-builder' );
     713        ?></th>
     714                        <th></th>
     715                    </tr>
     716                </thead>
     717                <tbody></tbody>
     718              </table>
     719              <center><a class="doko_total_details_price button button-primary doko-total-btn wp-block-button__link wp-element-button wc-block-components-product-button__button has-font-size has-small-font-size has-text-align-center wc-interactive"></a></center>
     720            </div>
    683721        <?php
    684722        wc_print_notices();
     
    757795                'container'    => $container,
    758796                'bundle_id'    => $bundle_id,
     797            );
     798            $dcontents = apply_filters(
     799                'doko_cart_contents_element',
     800                $dcontents,
     801                $product_id,
     802                $variation_id,
     803                $data
    759804            );
    760805            $is_added = WC()->cart->add_to_cart(
     
    805850                    $qty = $screen_content['product_qty'];
    806851                    $product = wc_get_product( $product_id );
    807                     if ( ! is_object( $product ) ) {
     852                    if ( !is_object( $product ) ) {
    808853                        continue;
    809854                    }
     
    822867            }
    823868        }
    824         return $cart_item;
     869        return apply_filters( 'doko_add_box_contents', $cart_item, $cart_item_key );
    825870    }
    826871
     
    870915                $price = 0;
    871916            }
    872             $btn_title_text = esc_html__( 'Add to box', 'doko' );
     917            $btn_title_text = esc_html__( 'Add to box', 'doko-bundle-builder' );
    873918            $category_ids = implode( ',', $product->get_category_ids() );
    874919            $tag_ids = implode( ',', $product->get_tag_ids() );
     
    876921            $ptype = $product->get_type();
    877922            $doko_display_variations_as_many = apply_filters( 'doko_display_variations_as_many', value: true );
    878             if ( !$doko_display_variations_as_many && !in_array( $ptype, array('simple', 'variations') ) ) {
     923            $childrens = $product->get_children();
     924            if ( !$doko_display_variations_as_many && count( $childrens ) > 0 && !in_array( $ptype, array('simple', 'variation') ) ) {
    879925            } else {
    880926                $btn_text = sprintf(
     
    891937                    $category_ids,
    892938                    $tag_ids,
    893                     ( $doko_is_card_page ? esc_html__( 'Add card to box', 'doko' ) : $btn_title_text )
     939                    ( $doko_is_card_page ? esc_html__( 'Add card to box', 'doko-bundle-builder' ) : $btn_title_text )
    894940                );
    895941            }
     
    940986                $tproduct_name = '';
    941987                if ( isset( $card_details['to'] ) && $card_details['to'] != '' ) {
    942                     $tproduct_name .= __( '<br/> To : ', 'doko' ) . $card_details['to'];
     988                    $tproduct_name .= esc_html__( '<br/> To : ', 'doko-bundle-builder' ) . $card_details['to'];
    943989                }
    944990                if ( isset( $card_details['from'] ) && $card_details['from'] != '' ) {
    945                     $tproduct_name .= __( '<br/> From : ', 'doko' ) . $card_details['from'];
     991                    $tproduct_name .= esc_html__( '<br/> From : ', 'doko-bundle-builder' ) . $card_details['from'];
    946992                }
    947993                if ( isset( $card_details['message'] ) && $card_details['message'] != '' ) {
    948                     $tproduct_name .= __( '<br/> Message : ', 'doko' ) . $card_details['message'];
     994                    $tproduct_name .= esc_html__( '<br/> Message : ', 'doko-bundle-builder' ) . $card_details['message'];
    949995                }
    950996                if ( isset( $card_details['options'] ) && $card_details['options'] != '' ) {
    951                     $tproduct_name .= __( '<br/> Options Choosed : ', 'doko' ) . $card_details['options'];
     997                    $tproduct_name .= esc_html__( '<br/> Options Choosed : ', 'doko-bundle-builder' ) . $card_details['options'];
    952998                }
    953999                $item->update_meta_data( "<a href='" . get_permalink( $card_details['product_id'] ) . "'>" . get_the_title( $card_details['product_id'] ) . '</a>', $tproduct_name );
     
    9991045        ?>
    10001046            <br>
    1001             <div class="hs-dk-box-selector" id="doko-bundle-builder">
     1047            <div class="hs-dk-box-selector" id="doko">
    10021048                <?php
    10031049        global $doko_current_package_data;
     
    10861132            if ( $stock_avail == 'yes' ) {
    10871133                wc_update_product_stock( $product, $qty, 'increase' );
    1088                 $order->add_order_note( __( 'Stock levels of product ', 'doko' ) . $product->get_formatted_name() . ' has increased of ' . $qty );
     1134                $order->add_order_note( esc_html__( 'Stock levels of product ', 'doko-bundle-builder' ) . $product->get_formatted_name() . ' has increased of ' . $qty );
    10891135            }
    10901136        }
    10911137    }
    10921138} );
     1139//todo : display in modal qty, wit description
  • doko-box-builder/trunk/public/css/hs-doko-modal.css

    r3150448 r3315238  
    44    width: 100%; height: 100%;
    55    overflow: auto;
    6     z-index: 1;
     6    z-index: 50000;
    77    padding: 20px;
    88    box-sizing: border-box;
     
    2626    position: relative;
    2727    z-index: 2;
    28     max-width: 500px;
     28    max-width: 900px;
    2929    box-sizing: border-box;
    3030    width: 90%;
  • doko-box-builder/trunk/public/css/hs-doko-public.css

    r3230317 r3315238  
    378378}
    379379@media (max-width: 767px) and (orientation: landscape){
    380 
     380   
    381381
    382382    .hs-dk-btn-text{
     
    386386
    387387@media (max-width: 767px) {
     388    .doko_style_to_hide{
     389        display: none;
     390    }
     391
     392   
     393    ul.doko-box-contents{
     394        overflow-x: unset !important;
     395        padding-bottom: 0px !important;
     396    }
     397
    388398    .hs-dk-menu-box{
    389399        /*display: inherit;*/
    390         flex-direction: column-reverse;
     400        background-color: white;
     401        flex-direction: column;
    391402        justify-content: center;
    392403    }
     
    519530    background: white;
    520531    border-top: 1px solid #ccc;
    521     z-index: 999;
    522532    transition: all .25s cubic-bezier(.25,.46,.45,.94);
     533    z-index: 12;
    523534}
    524535.hs-dk-menu-box{
     
    536547    cursor: pointer;
    537548}
    538 .hs-dk-menu-btn-content-fix{
    539     display: flex;
    540 }
     549
    541550.hs-dk-menu-btn-container{
    542551    padding: 0 10px;
     
    563572
    564573
    565 .doko-footer-navigation, .doko-btn-navigation, .doko-box-container,  .doko-box-contents{
     574.doko-footer-navigation, .doko-btn-navigation, .doko-box-container{
    566575    display: inline-flex !important;
    567576    list-style: none !important;
     
    577586}
    578587
    579 .hs-dk-menu-box-img-fix{
     588/* .hs-dk-menu-box-img-fix{
    580589    display: block;
    581590    height: 0px;
    582591}
     592     */
     593
     594
     595    ul.doko-box-container, ul.doko-box-contents, ul.doko-card-page {
     596        margin: unset;
     597    }
    583598
    584599@media only screen and (max-width: 767px) {
    585600    .hs-dk-menu-box-img-fix{
    586         display: none;
    587     }
     601        display: flex;
     602        max-height: 300px; /* adjust as needed */
     603        overflow-y: auto;
     604        -webkit-overflow-scrolling: touch; /* for smooth iOS scrolling */
     605    }
     606    .hs-dk-menu-btn-content-fix{
     607        display: flex;
     608    }
     609
    588610}
    589611
     
    790812    }
    791813
    792     .steps .step a.completed .icon {
     814    .steps .step a.completed .icon , .steps .step a.active_tab_link .icon {
    793815    border-color: #000;
    794816    }
     
    820842    }
    821843
    822     .woocommerce-loop-product__title.completed {
     844    .woocommerce-loop-product__title.completed , .woocommerce-loop-product__title.active_tab_link{
    823845    color:#774400 !important;
    824846    }
    825847
    826     .steps .step a.completed .icon {
     848    .steps .step a.completed .icon, .steps .step a.active_tab_link .icon {
    827849    border-color: #774400;
    828850    }
    829851
    830     @media (max-width: 480px) {
    831     #doko-giftbox-progress-bar .steps .step a .description {
    832         display: none;
    833         }
    834     }
     852        /* @media (max-width: 480px) {
     853        #doko-giftbox-progress-bar .steps .step a .description {
     854            display: none;
     855            }
     856        } */
    835857
    836858
     
    9911013    visibility: visible;}
    9921014
    993     .doko_wrapper_btn_variations, .doko_variable_prices{
     1015    .doko_wrapper_btn_variations{
    9941016        display: none;
    9951017    }
     1018
     1019    img.doko-modal-img {
     1020        width: 200px;
     1021    }
     1022
     1023/* Tooltip Styling */
     1024.tooltip {
     1025    display: none;
     1026    position: absolute;
     1027    bottom: 120%; /* Places it above the button */
     1028    background-color: #333;
     1029    color: white;
     1030    padding: 8px 12px;
     1031    border-radius: 5px;
     1032    white-space: nowrap;
     1033    box-shadow: 0px 5px 15px rgba(0, 0, 0, 0.3);
     1034    z-index: 1000;
     1035}
     1036
     1037/* Tooltip Arrow */
     1038.tooltip-arrow {
     1039    position: absolute;
     1040    top: 100%;
     1041    left: 50%;
     1042    transform: translateX(-50%);
     1043    width: 0;
     1044    height: 0;
     1045    border-left: 8px solid transparent;
     1046    border-right: 8px solid transparent;
     1047    border-top: 8px solid #333;
     1048}
     1049
     1050/* ul.doko-box-contents {
     1051    max-width: 70%;
     1052    overflow-x: auto;
     1053    scrollbar-width: thin;
     1054    padding: 17px;
     1055    justify-content: flex-end;
     1056    align-items: center;
     1057    align-content: center;
     1058    flex-wrap: nowrap;
     1059} */
     1060
     1061ul.doko-box-contents {
     1062    width: 600px; /* Restrict width */
     1063    overflow-x: auto; /* Enable horizontal scrolling */
     1064    scrollbar-width: auto; /* Thin scrollbar */
     1065    padding: 17px;
     1066    justify-content: flex-start; /* Ensure items align from the start */
     1067    align-items: center;
     1068    flex-wrap: nowrap; /* Prevent wrapping */
     1069    white-space: nowrap; /* Prevent text breaking into new lines */
     1070    scroll-behavior: smooth;
     1071}
     1072
     1073/* Ensure the list items do not wrap and stay in a single row */
     1074.doko-box-contents li {
     1075    flex-shrink: 0; /* Prevents items from shrinking */
     1076}
     1077
     1078.doko-box-contents {
     1079    display: inline-flex !important;
     1080    list-style: none !important;
     1081}
     1082
     1083/* Custom Scrollbar (for WebKit browsers) */
     1084ul.doko-box-contents::-webkit-scrollbar {
     1085    height: 6px; /* Thin scrollbar */
     1086}
     1087
     1088ul.doko-box-contents::-webkit-scrollbar-thumb {
     1089    background-color: #888; /* Scrollbar color */
     1090    border-radius: 3px;
     1091}
     1092
     1093ul.doko-box-contents::-webkit-scrollbar-track {
     1094    background: #f1f1f1; /* Scroll track background */
     1095}
     1096
     1097button.doko-page-btn {
     1098    white-space: nowrap; /* Prevents text from wrapping */
     1099    overflow: hidden; /* Prevents text from spilling out */
     1100    text-overflow: ellipsis; /* Adds "..." if the text overflows */
     1101    display: inline-block; /* Ensures button behaves like a block */
     1102    max-width: 100%; /* Ensures it doesn't overflow the parent */
     1103}
     1104
     1105a.doko-remove {
     1106    cursor: pointer !important;
     1107}
     1108
     1109
     1110/* .hs-dk-menu-fix {
     1111    height: 74px;
     1112} */
     1113
     1114img.doko-modal-img-preview {
     1115    width: 50px;
     1116}
     1117
     1118.doko_total_details {
     1119  width: 100%;
     1120  border-collapse: collapse;
     1121}
     1122
     1123.doko_total_details td,
     1124.doko_total_details th {
     1125  border: 1px solid #ccc;
     1126  padding: 8px;
     1127  text-align: left;
     1128}
     1129
     1130.doko_total_details tr:nth-child(even) {
     1131  background-color: #f9f9f9;
     1132}
     1133
     1134
     1135.doko_total_details {
     1136  position: relative; /* or 'absolute' or 'fixed' depending on layout */
     1137  z-index: 120;
     1138  background: white; /* Ensure it doesn’t look transparent */
     1139}
  • doko-box-builder/trunk/public/js/hs-doko-public-min.js

    r3230317 r3315238  
    1 !function(o){"use strict";let t;window.doko={},window.doko.total_price=0,window.doko.box_container="",window.doko.box_contents={},window.doko.rules={},window.doko.screens={},window.doko.box_card={},window.doko.gift_messages={};let d={action:"doko-get-box-display"};o(document).ready((function(){if(window.doko_bundle_id=o('input[name="doko-bundle-page-id"]').val(),window.doko_step_decoded=JSON.parse(window.doko_step_identifier),o("select.hs-dk-categories").on("change",(function(t){t.preventDefault();let e=o(this).data("bundleContentId");d={action:"doko-get-box-display",operation_type:"categories",filter_type:o('div[data-bundle-content-id="'+e+'"] select.hs-dk-options').val(),list_ids:o('div[data-bundle-content-id="'+e+'"] select.hs-dk-categories').val(),bundleContentId:e,bundleId:o(this).data("bundleId"),current_page:window.doko.current_page},o.post(doko_object.ajaxurl,d).done((function(t){o('div[data-bundle-content-id="'+e+'"]').closest(".hs-dk-products-to-add-to-box").html(t),l(),p()}))})),o("select.hs-dk-categories").trigger("change"),o('textarea[name="hs-dk-gift-message-box"]').on("keyup",(function(t){let d=o(this).data("bundleScreenName");doko.gift_messages[d]=o(this).val()})),o(document).innerWidth()<=767){var e=o(".storefront-handheld-footer-bar").height();o("div.hs-dk-menu-fix").css("bottom",e+"px")}o(window).resize((function(){if(o(document).innerWidth()<=767){var t=o(".storefront-handheld-footer-bar").height();o("div.hs-dk-menu-fix").css("bottom",t+"px")}})),o("a.doko-add-to-box").unbind(),o(document).on("click","a.doko-add-to-box",(function(d){d.preventDefault();var e=c("doko",12),n=window.doko.current_page,i=o(this).data("imageUrl"),l=o(this).data("productId"),p=(o(this).data("productPrice"),o(this).data("quantity")),u=o(this).data("productVariationParentId"),_=o('input[name="doko-bundle-page-id"]').val(),k={},h=o(this).data("cardMode");window.doko.cardMode=h;var b=o(this).parents("div.hs-dk-bundle-page"),m=o(b).data();k=o(this).data();var v=o(this).parent().find("span.formulus-input-wrapper").find("input.doko-bundle-qty");v&&(null==o(v).val()?(k.quantity=1,p=1):(k.quantity=o(v).val(),p=o(v).val())),p=parseInt(p),k.current_page=n,k.bundle_id=_;var g=o(this).data("productName");k.unique_id=e,wp.hooks.doAction("doko_before_calculate_add_to_box",l,k,window.doko.current_page,m),k.variation_id=u,wp.hooks.doAction("doko_after_calculate_add_to_box",l,k,window.doko.current_page,m);var w=k.options_is_checked;if(w&&(l="p"+l),"no"==h){if(o("table.doko-box-contents").length>0&&1!=n){var f;let d=parseFloat(k.productPrice);if(null!=k.options&&k.options.length>0&&w)for(var x in k.options)null!=k.options[x].amount&&(d+=k.options[x].amount);f=r(p,g,d,l),0==o('table.doko-box-contents tbody tr[data-product-id="'+l+'"]').length?(o("table.doko-box-contents tbody").append(f),o("ul.box-images").append(function(o,t=!0,d){var e="";return t||(e="doko-reset-icone-remove"),"<li class='"+e+"' data-product-id='"+d.productId+"'><i ' style='cursor: pointer;' aria-hidden='true'></i></div><div class='selected-box' ><img class='box-color' src='"+o+"'></div></li>"}(i,!1,k))):(t=o('ul.doko-box-contents li[data-product-id="'+l+'"] div.doko-qty-exposant').html(),f=r(t,g,d,l),o('table.doko-box-contents tr[data-product-id="'+l+'"]').replaceWith(f))}o("div.hs-dk-menu-fix").show(),a(e)}else o("div.hs-dk-menu-fix").hide(),o("img.hs-dk-card-image").attr("src",i),o("div.hs-dk-product-card-panel").show(),o("div.hs-dk-product-panel").hide(),window.doko.box_card.product_id=l;s()})),o("a.hs-dk-change-card").on("click",(function(){o("div.hs-dk-product-card-panel").hide(),o("div.hs-dk-product-panel").show()})),o("input.hs-dk-input-container-to").on("change",(function(){window.doko.box_card.to=o(this).val()})),o("input.hs-dk-input-container-to").trigger("change"),o("input.hs-dk-input-container-from").on("change",(function(){window.doko.box_card.from=o(this).val()})),o("input.hs-dk-input-container-from").trigger("change"),o("#message-box").on("change",(function(){window.doko.box_card.message=o(this).val()})),o("#message-box").trigger("change"),o('div.hs-dk-card-details [name="doko-note-option"]').on("change",(function(){window.doko.box_card.options=o(this).val()})),o('div.hs-dk-card-details [name="doko-note-option"]').change(),o("input#hs-dk-custom").on("keyup",(function(t){var d=o(this).val().toLowerCase();o("div.hs-dk-products-to-add-to-box h2.woocommerce-loop-product__title").length>0&&o("div.hs-dk-products-to-add-to-box h2.woocommerce-loop-product__title").each((function(t,e){var n=o(this).text().toLowerCase();o(this).closest(".status-publish")[-1!==n.indexOf(d)?"show":"hide"]()}))})),o("div.hs-dk-bundle-page").hide(),o('div.hs-dk-bundle-page[data-page-id="1"]').show(),o("div.hs-dk-menu-fix").hide(),null!=doko_bundle_data&&"yes"==doko_bundle_data["enable-bottom-navigation"]&&o("div.hs-dk-menu-fix").show(),o("div.hs-dk-product-card-panel").hide();var n=1;function a(t,d=!1){var e=JSON.parse(doko_step_identifier)[window.doko.current_page];o("table.doko-box-contents").length>0&&o("table.doko-box-contents tr[data-product-id]").each((function(){o(this).children("td:nth(4)").children("a.doko-remove").unbind(),o(this).children("td:nth(4)").children("a.doko-remove").on("click",(function(){var t=o(this).parent().parent().data("productId"),d=parseInt(o('table.doko-box-contents tr[data-product-id="'+t+'"]').data("productQty")),n=parseFloat(o('table.doko-box-contents tr[data-product-id="'+t+'"]').data("productPrice"));wp.hooks.doAction("doko_before_delete_product_from_box",t,d,n),delete window.doko.box_contents[t],delete window.doko.screens[e][t],s(),o(this).parent().closest("tr").remove(),o('ul.box-images li[data-product-id="'+t+'"]').remove(),o('ul.doko-box-contents li[data-product-id="'+t+'"]').remove(),o('table.doko-box-contents tr[data-product-id="'+t+'"]').remove(),wp.hooks.doAction("doko_after_delete_product_from_box",t,d,n)}))})),o(document).on("click",'li[data-hash-code="'+t+'"] div.doko-right-sup-exposant',(function(){var t=o(this).closest("li").data("productPrice"),d=o(this).closest("li").data("productQty"),n=o(this).closest("li").data("productId");o(this).closest("li").remove(),wp.hooks.doAction("doko_before_delete_product_from_box",n,d,t),delete window.doko.box_contents[n],delete window.doko.screens[e][n],s(),o('ul.box-images li[data-product-id="'+n+'"]').remove(),o('ul.doko-box-contents li[data-product-id="'+n+'"]').remove(),o('table.doko-box-contents tr[data-product-id="'+n+'"]').remove(),wp.hooks.doAction("doko_after_delete_product_from_box",n,d,t)})),d&&o('li[data-hash-code="'+t+'"] div.doko-right-sup-exposant').trigger("click")}function i(o,t=!0){var d,e=doko_object.wc_price_args,n={decimal_sep:e.decimal_separator,currency_position:e.currency_position,currency_symbol:e.currency_symbol,trim_zeros:e.currency_format_trim_zeros,num_decimals:e.currency_format_num_decimals,html:!0};if(n.num_decimals>0){var a=Math.round(o%1*100)/100;d=parseInt(o)+a}else d=parseInt(o);if(o=o.toString().replace(".",n.decimal_sep),t){var i=n.html?'<span class="woocommerce-Price-currencySymbol">'+n.currency_symbol+"</span>":n.currency_symbol;"left"===n.currency_position?d=i+d:"right"===n.currency_position?d+=i:"left_space"===n.currency_position?d=i+" "+d:"right_space"===n.currency_position&&(d=d+" "+i),d=n.html?'<span class="woocommerce-Price-amount amount">'+d+"</span>":d}return d}function r(o,t,d,e){var n='<tr data-product-id="'+e+'" data-product-qty="'+o+'" data-product-price="'+d+'">';return n+="<td>"+t+"</td><td>"+o+"</td><td>"+d+"</td><td>"+d*o+"</td>",n+='<td> <a class="doko-remove" ><i class="fa fa-times" aria-hidden="true"></i></a></td>',n+="</tr>"}function c(o="",t=13){const d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=d.length;let n=o;for(let o=0;o<t;o++)n+=d.charAt(Math.floor(Math.random()*e));return n}function s(){var t=window.doko.screens,d=0;for(var e in t){var n=t[e];if(void 0!==n.qty&&void 0!==n.amount)d+=n.qty*n.amount;else for(var a in n){var r=n[a];void 0!==r.qty&&void 0!==r.amount&&(d+=r.qty*r.amount)}}d=wp.hooks.applyFilters("doko_total_price",d,t),window.doko.total_price=d,o("button.doko-total-btn").html("Total : "+i(d,!0))}function l(){o("a.doko-load-more-content-page-action").unbind(),o("a.doko-load-more-content-page-action").on("click",(function(t){t.preventDefault(),o(this).html("Loading ...");let d=0,e={bundleId:window.doko_bundle_id,bundleContentId:o(this).data("bundleContentId")},n=o(this).data("bundleContentId"),a=o('input[data-bundle-content-id="'+n+'"][name="doko_current_position"]').val();a&&(d=doko_bundle_data[n]["nb-products-per-page"]),e.action="doko-get-products-infinite-loading",e.current_position=parseInt(a)+1,e.filter_type=o('div[data-bundle-content-id="'+window.doko_step_decoded[doko.current_page]+'"] select.hs-dk-options').val(),e.list_ids=o('div[data-bundle-content-id="'+window.doko_step_decoded[doko.current_page]+'"] select.hs-dk-categories').val(),o.post(doko_object.ajaxurl,e).done((function(t){o("a.doko-load-more-content-page-action").html("Load more"),o('input[data-bundle-content-id="'+n+'"][name="doko_current_position"]').remove(),o('input[data-bundle-content-id="'+n+'"][name="doko_operation_type"]').remove();c("doko_part",10);o("ul.hs-doko-loop.products").append(t),a=o('input[data-bundle-content-id="'+n+'"][name="doko_current_position"]').val();let e=parseInt(a)+parseInt(d);o("div.woocommerce-no-products-found").length>0?(o("a.doko-load-more-content-page-action").remove(),o("div.woocommerce-no-products-found").remove()):o('input[name="doko_current_position"]').val(e),p()}))}))}function p(){o("div.doko_infoButton").on("click",(function(t){t.preventDefault();var d=o(this).parent().parent().find(".doko-add-to-box").data();o("div.doko_modal div.doko_modal_product_title").empty(),o("div.doko_modal div.doko_modal_product_title").append("<h2>"+d.productName+"</h2>"),o("div.doko_modal div.doko_modal_product_desc").empty(),o("div.doko_modal div.doko_modal_product_desc").append(o(this).data("productDescription")),o("div.doko_modal").modal()}))}window.doko.current_page=n,o("div#doko-giftbox-progress-bar div.step a").removeClass("completed"),o('div#doko-giftbox-progress-bar div.step[data-step-id="'+n+'"] a').addClass("completed"),o('button.doko-page-btn[data-btn-type="next"]').on("click",(function(){if(n+1>o("div.hs-dk-bundle-page").length)return!1;if(wp.hooks.doAction("doko_before_click_navigate_to_page",n),null!=doko_bundle_data&&wp.hooks.applyFilters("doko_restrict_first_page",!0,n)&&""==window.doko.box_container)return alert(doko_bundle_data["no-products-message"]),!1;o("div.hs-dk-bundle-page").length==n+1&&o("div.hs-dk-menu-box").hide(),n++,o("div.hs-dk-bundle-page").hide(),o('div.hs-dk-bundle-page[data-page-id="'+n+'"]').show(),o("div#doko-giftbox-progress-bar div.step a").removeClass("completed"),o('div#doko-giftbox-progress-bar div.step[data-step-id="'+n+'"] a').addClass("completed"),window.doko.current_page=n,wp.hooks.doAction("doko_after_click_navigate_to_page",n);let t=JSON.parse(doko_step_identifier);l((t[n],window.doko_bundle_id,window.doko.current_page,o('div[data-bundle-content-id="'+t[n]+'"] input[name="doko_current_position"]').val()))})),o('button.doko-page-btn[data-btn-type="prev"]').on("click",(function(){if(n-1<1)return!1;wp.hooks.doAction("doko_before_click_navigate_to_page",n),o("div.hs-dk-bundle-page").hide(),n--,o('div.hs-dk-bundle-page[data-page-id="'+n+'"]').show(),o("div#doko-giftbox-progress-bar div.step a").removeClass("completed"),o('div#doko-giftbox-progress-bar div.step[data-step-id="'+n+'"] a').addClass("completed"),window.doko.current_page=n,wp.hooks.doAction("doko_after_click_navigate_to_page",n)})),o("button.doko-restart").on("click",(function(){window.location.reload()})),o("button.doko-go-to-cart").on("click",(function(){window.location.href=doko_object.cart_page_url})),p(),window.hs_dk_init_delete_box_action=a,window.hs_dk_recalculate_total=s,window.hs_dk_get_wc_price=i,o(document).on("change keydown click","input.doko-bundle-qty",(function(){let t=o(this).val(),d=o(this).data("productId"),e=(o(this).data("productName"),o(this).data("productPrice")),n=doko.current_page,a=o(this).data("productUrl"),i=(doko_step_identifier[n],JSON.parse(doko_step_identifier)[n]);if(null!=doko.box_contents[d]){var r=o("ul.doko-box-contents");hs_dk_add_li_to_box({productId:d,imageUrl:a,productPrice:e,quantity:t},r,!1,!0,!0),doko.box_contents[d].product_qty=parseInt(t),doko.screens[i][d].qty=parseInt(t)}s()}))}))}(jQuery);
     1!function(o){"use strict";let t;window.doko={},window.doko.total_price=0,window.doko.box_container="",window.doko.box_contents={},window.doko.rules={},window.doko.screens={},window.doko.box_card={},window.doko.gift_messages={},window.doko.opt_management={};let d={action:"doko-get-box-display"};o(document).ready((function(){if(window.doko_bundle_id=o('input[name="doko-bundle-page-id"]').val(),window.doko_step_decoded=JSON.parse(window.doko_step_identifier),o("select.hs-dk-categories").on("change",(function(t){t.preventDefault();let e=o(this).data("bundleContentId");d={action:"doko-get-box-display",operation_type:"categories",filter_type:o('div[data-bundle-content-id="'+e+'"] select.hs-dk-options').val(),list_ids:o('div[data-bundle-content-id="'+e+'"] select.hs-dk-categories').val(),bundleContentId:e,bundleId:o(this).data("bundleId"),current_page:window.doko.current_page},o.post(doko_object.ajaxurl,d).done((function(t){o('div[data-bundle-content-id="'+e+'"]').closest(".hs-dk-products-to-add-to-box").html(t),p(),u(),_()}))})),o("select.hs-dk-categories").trigger("change"),o('textarea[name="hs-dk-gift-message-box"]').on("keyup",(function(t){let d=o(this).data("bundleScreenName");doko.gift_messages[d]=o(this).val()})),o(document).innerWidth()<=767&&o(document).innerWidth()<=767&&o(".storefront-handheld-footer-bar")){var e=o(".storefront-handheld-footer-bar").height();o("div.hs-dk-menu-fix").css("bottom",2*parseFloat(e)+"px")}o(window).resize((function(){if(o(document).innerWidth()<=767){if(o(".storefront-handheld-footer-bar")){var t=o(".storefront-handheld-footer-bar").height();o("div.hs-dk-menu-fix").css("bottom",2*parseFloat(t)+"px")}}else o("div.hs-dk-menu-fix").css("bottom","0px")})),o("a.doko-add-to-box").unbind(),o(document).on("click","a.doko-add-to-box",(function(d){d.preventDefault();var e=c("doko",12),a=window.doko.current_page,n=o(this).data("imageUrl"),s=o(this).data("productId"),p=(o(this).data("productPrice"),o(this).data("quantity")),u=o(this).data("productVariationParentId"),_=o('input[name="doko-bundle-page-id"]').val(),k={},h=o(this).data("cardMode");window.doko.cardMode=h;var m=o(this).parents("div.hs-dk-bundle-page"),b=o(m).data();k=o(this).data();var v=o(this).parent().find("span.formulus-input-wrapper").find("input.doko-bundle-qty");v&&(null==o(v).val()?(k.quantity=1,p=1):(k.quantity=o(v).val(),p=o(v).val())),p=parseInt(p),k.current_page=a,k.bundle_id=_;var g=o(this).data("productName");k.unique_id=e,wp.hooks.doAction("doko_before_calculate_add_to_box",s,k,window.doko.current_page,b),k.variation_id=u,wp.hooks.doAction("doko_after_calculate_add_to_box",s,k,window.doko.current_page,b);var f=k.options_is_checked;if(f&&(s="p"+s),"no"==h){if(o("table.doko-box-contents").length>0&&1!=a){var w;let d=parseFloat(k.productPrice);if(null!=k.options&&k.options.length>0&&f)for(var x in k.options)null!=k.options[x].amount&&(d+=k.options[x].amount);w=r(p,g,d,s),0==o('table.doko-box-contents tbody tr[data-product-id="'+s+'"]').length?(o("table.doko-box-contents tbody").append(w),o("ul.box-images").append(function(o,t=!0,d){var e="";return t||(e="doko-reset-icone-remove"),"<li class='"+e+"' data-product-id='"+d.productId+"'><i ' style='cursor: pointer;' aria-hidden='true'></i></div><div class='selected-box' ><img class='box-color' src='"+o+"'></div></li>"}(n,!1,k))):(t=o('ul.doko-box-contents li[data-product-id="'+s+'"] div.doko-qty-exposant').html(),w=r(t,g,d,s),o('table.doko-box-contents tr[data-product-id="'+s+'"]').replaceWith(w))}o("div.hs-dk-menu-fix").show(),i(e)}else o("div.hs-dk-menu-fix").hide(),o("img.hs-dk-card-image").attr("src",n),o("div.hs-dk-product-card-panel").show(),o("div.hs-dk-product-panel").hide(),window.doko.box_card.product_id=s;l()})),o("a.hs-dk-change-card").on("click",(function(){o("div.hs-dk-product-card-panel").hide(),o("div.hs-dk-product-panel").show()})),o("input.hs-dk-input-container-to").on("change",(function(){window.doko.box_card.to=o(this).val()})),o("input.hs-dk-input-container-to").trigger("change"),o("input.hs-dk-input-container-from").on("change",(function(){window.doko.box_card.from=o(this).val()})),o("input.hs-dk-input-container-from").trigger("change"),o("#message-box").on("change",(function(){window.doko.box_card.message=o(this).val()})),o("#message-box").trigger("change"),o('div.hs-dk-card-details [name="doko-note-option"]').on("change",(function(){window.doko.box_card.options=o(this).val()})),o('div.hs-dk-card-details [name="doko-note-option"]').change(),o("input#hs-dk-custom").on("keyup",(function(t){var d=o(this).val().toLowerCase();o("div.hs-dk-products-to-add-to-box h2.woocommerce-loop-product__title").length>0&&o("div.hs-dk-products-to-add-to-box h2.woocommerce-loop-product__title").each((function(t,e){var a=o(this).text().toLowerCase();o(this).closest(".status-publish")[-1!==a.indexOf(d)?"show":"hide"]()}))})),_(),o("div.hs-dk-bundle-page").hide(),o('div.hs-dk-bundle-page[data-page-id="1"]').show(),o("div.hs-dk-menu-fix").hide(),null!=doko_bundle_data&&"yes"==doko_bundle_data["enable-bottom-navigation"]&&o("div.hs-dk-menu-fix").show(),o("div.hs-dk-product-card-panel").hide();var a=1;function i(t,d=!1){var e=JSON.parse(doko_step_identifier)[window.doko.current_page];o("table.doko-box-contents").length>0&&o("table.doko-box-contents tr[data-product-id]").each((function(){o(this).children("td:nth(4)").children("a.doko-remove").unbind(),o(this).children("td:nth(4)").children("a.doko-remove").on("click",(function(){var t=o(this).parent().parent().data("productId"),d=parseInt(o('table.doko-box-contents tr[data-product-id="'+t+'"]').data("productQty")),a=parseFloat(o('table.doko-box-contents tr[data-product-id="'+t+'"]').data("productPrice"));wp.hooks.doAction("doko_before_delete_product_from_box",t,d,a),delete window.doko.box_contents[t],delete window.doko.screens[e][t],l(),o(this).parent().closest("tr").remove(),o('ul.box-images li[data-product-id="'+t+'"]').remove(),o('ul.doko-box-contents li[data-product-id="'+t+'"]').remove(),o('table.doko-box-contents tr[data-product-id="'+t+'"]').remove(),wp.hooks.doAction("doko_after_delete_product_from_box",t,d,a)}))})),o(document).on("click",'li[data-hash-code="'+t+'"] div.doko-right-sup-exposant',(function(){var t=o(this).closest("li").data("productPrice"),d=o(this).closest("li").data("productQty"),a=o(this).closest("li").data("productId");o(this).closest("li").remove(),wp.hooks.doAction("doko_before_delete_product_from_box",a,d,t),delete window.doko.box_contents[a],delete window.doko.screens[e][a],l(),o('ul.box-images li[data-product-id="'+a+'"]').remove(),o('ul.doko-box-contents li[data-product-id="'+a+'"]').remove(),o('table.doko-box-contents tr[data-product-id="'+a+'"]').remove(),wp.hooks.doAction("doko_after_delete_product_from_box",a,d,t)})),d&&o('li[data-hash-code="'+t+'"] div.doko-right-sup-exposant').trigger("click")}function n(o,t=!0){var d,e=doko_object.wc_price_args,a={decimal_sep:e.decimal_separator,currency_position:e.currency_position,currency_symbol:e.currency_symbol,trim_zeros:e.currency_format_trim_zeros,num_decimals:e.currency_format_num_decimals,html:!0};if(a.num_decimals>0){var i=Math.round(o%1*100)/100;d=parseInt(o)+i}else d=parseInt(o);if(o=o.toString().replace(".",a.decimal_sep),t){var n=a.html?'<span class="woocommerce-Price-currencySymbol">'+a.currency_symbol+"</span>":a.currency_symbol;"left"===a.currency_position?d=n+d:"right"===a.currency_position?d+=n:"left_space"===a.currency_position?d=n+" "+d:"right_space"===a.currency_position&&(d=d+" "+n),d=a.html?'<span class="woocommerce-Price-amount amount">'+d+"</span>":d}return d}function r(o,t,d,e){var a='<tr data-product-id="'+e+'" data-product-qty="'+o+'" data-product-price="'+d+'">';return a+="<td>"+t+'</td><td class="doko_style_to_hide">'+o+'</td><td class="doko_style_to_hide">'+d+"</td><td>"+d*o+"</td>",a+='<td> <a class="doko-remove" ><i class="fa fa-times" aria-hidden="true"></i></a></td>',a+="</tr>"}function c(o="",t=13){const d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e=d.length;let a=o;for(let o=0;o<t;o++)a+=d.charAt(Math.floor(Math.random()*e));return a}function s(){var o=window.doko.screens,t=0;for(var d in o){var e=o[d];if(void 0!==e.qty&&void 0!==e.amount)t+=e.qty*e.amount;else for(var a in e){var i=e[a];void 0!==i.qty&&void 0!==i.amount&&(t+=i.qty*i.amount)}}return t=wp.hooks.applyFilters("doko_total_price",t,o),window.doko.total_price=t,t}function l(){let t=s();o("button.doko-total-btn").html("Total : "+n(t,!0)+" ⓘ "),o(".doko_total_details_price").html("Total : "+n(doko.total_price,!0))}function p(){o("a.doko-load-more-content-page-action").unbind(),o("a.doko-load-more-content-page-action").on("click",(function(t){t.preventDefault(),o(this).html("Loading ...");let d=0,e={bundleId:window.doko_bundle_id,bundleContentId:o(this).data("bundleContentId")},a=o(this).data("bundleContentId"),i=o('input[data-bundle-content-id="'+a+'"][name="doko_current_position"]').val();i&&(d=doko_bundle_data[a]["nb-products-per-page"]),e.action="doko-get-products-infinite-loading",e.current_position=parseInt(i)+1,e.filter_type=o('div[data-bundle-content-id="'+window.doko_step_decoded[doko.current_page]+'"] select.hs-dk-options').val(),e.list_ids=o('div[data-bundle-content-id="'+window.doko_step_decoded[doko.current_page]+'"] select.hs-dk-categories').val(),o.post(doko_object.ajaxurl,e).done((function(t){o("a.doko-load-more-content-page-action").html("Load more"),o('input[data-bundle-content-id="'+a+'"][name="doko_current_position"]').remove(),o('input[data-bundle-content-id="'+a+'"][name="doko_operation_type"]').remove();c("doko_part",10);o("ul.hs-doko-loop.products").append(t),i=o('input[data-bundle-content-id="'+a+'"][name="doko_current_position"]').val();let e=parseInt(i)+parseInt(d);o("div.woocommerce-no-products-found").length>0?(o("a.doko-load-more-content-page-action").remove(),o("div.woocommerce-no-products-found").remove()):o('input[name="doko_current_position"]').val(e),u(),_()}))}))}function u(){o("div.doko_infoButton").on("click",(function(t){t.preventDefault();var d=o(this).parent().parent().find(".doko-add-to-box").data(),e=o(this).parent().parent().find(".doko-add-to-box").clone();o("div.doko_modal div.doko_modal_product_title").empty(),o("div.doko_modal div.doko_modal_product_title").append("<h2>"+d.productName+"</h2>"),o("div.doko_modal div.doko_modal_product_img").empty(),o("div.doko_modal div.doko_modal_product_img").append('<img src="'+d.imageUrl+'" alt="doko-image" class="doko-modal-img" />'),o("div.doko_modal div.doko_modal_product_desc").empty(),o("div.doko_modal div.doko_modal_product_desc").append(o(this).data("productDescription")),o("div.doko_modal div.doko_modal_product_price").empty(),o("div.doko_modal div.doko_modal_product_price").append("<p class='doko-price-section'>"+d.productPrice+" "+d.siteCurrency+"</p>"),o("div.doko_modal div.doko_modal_product_price").append(e),o("div.doko_modal").modal()}))}function _(){o("select.doko-add-to-box-variable").on("change",(function(t){var d=o(this).val();o(this).parent().find("div.doko_wrapper_btn_variations").hide(),o(this).prevAll().find("span.price span.doko_variable_prices").hide(),o(this).parent().find('div.doko_wrapper_btn_variations[data-product-id="'+d+'"]').show(),o(this).parent().find('div.doko_wrapper_btn_variations[data-product-id="'+d+'"] a').show(),o(this).prevAll().find('span.price span.doko_variable_prices[data-product-id="'+d+'"]').show(),""!=d&&d||o(this).prevAll().find("span.doko_old_price").show()})),o("select.doko-add-to-box-variable").trigger("change")}window.doko.current_page=a,o("div#doko-giftbox-progress-bar div.step a").removeClass("active_tab_link"),o('div#doko-giftbox-progress-bar div.step[data-step-id="'+a+'"] a').addClass("active_tab_link"),o('button.doko-page-btn[data-btn-type="next"]').on("click",(function(){if(a+1>o("div.hs-dk-bundle-page").length)return!1;if(wp.hooks.doAction("doko_before_click_navigate_to_page",a),null!=doko_bundle_data&&wp.hooks.applyFilters("doko_restrict_first_page",!0,a)&&""==window.doko.box_container)return alert(doko_bundle_data["no-products-message"]),!1;o("div.hs-dk-bundle-page").length==a+1&&o("div.hs-dk-menu-box").hide(),a++,o("div.hs-dk-bundle-page").hide(),o('div.hs-dk-bundle-page[data-page-id="'+a+'"]').show(),o("div#doko-giftbox-progress-bar div.step a").removeClass("active_tab_link"),o('div#doko-giftbox-progress-bar div.step[data-step-id="'+a+'"] a').addClass("active_tab_link"),window.doko.current_page=a,wp.hooks.doAction("doko_after_click_navigate_to_page",a);const t=document.querySelector(".doko-box-section");if(t){const o=t.getBoundingClientRect().top+window.pageYOffset;window.scrollTo({top:o,behavior:"smooth"})}let d=JSON.parse(doko_step_identifier);p((d[a],window.doko_bundle_id,window.doko.current_page,o('div[data-bundle-content-id="'+d[a]+'"] input[name="doko_current_position"]').val()))})),o('button.doko-page-btn[data-btn-type="prev"]').on("click",(function(){if(a-1<1)return!1;wp.hooks.doAction("doko_before_click_navigate_to_page",a),o("div.hs-dk-bundle-page").hide(),a--,o('div.hs-dk-bundle-page[data-page-id="'+a+'"]').show(),o("div#doko-giftbox-progress-bar div.step a").removeClass("active_tab_link"),o('div#doko-giftbox-progress-bar div.step[data-step-id="'+a+'"] a').addClass("active_tab_link"),window.doko.current_page=a,wp.hooks.doAction("doko_after_click_navigate_to_page",a)})),o("button.doko-restart").on("click",(function(){window.location.reload()})),o("button.doko-go-to-cart").on("click",(function(){window.location.href=doko_object.cart_page_url})),u(),window.hs_dk_init_delete_box_action=i,window.hs_dk_recalculate_total=s,window.hs_dk_recalculate_total_html=l,window.hs_dk_get_wc_price=n,o(document).on("change keydown click","input.doko-bundle-qty",(function(){let t=o(this).val(),d=o(this).data("productId"),e=(o(this).data("productName"),o(this).data("productPrice")),a=doko.current_page,i=o(this).data("productUrl"),n=JSON.parse(doko_step_identifier)[a];if(null!=doko.box_contents[d]){var r=o("ul.doko-box-contents");hs_dk_add_li_to_box({productId:d,imageUrl:i,productPrice:e,quantity:t},r,!1,!0,!0),doko.box_contents[d].product_qty=parseInt(t),doko.screens[n][d].qty=parseInt(t)}l()})),o("button.doko_total_btn_elt").on("click",(function(){o("div#doko_total_details").modal(),function(){let t=o.modal.getCurrent();var d=JSON.parse(doko_step_identifier)[window.doko.current_page];o(t.$elm[0]).on("click","a.doko-remove",(function(){var t=o(this).parent().parent().data("productId"),e=parseInt(o('table.doko_total_details tr[data-product-id="'+t+'"]').data("productQty")),a=parseFloat(o('table.doko_total_details tr[data-product-id="'+t+'"]').data("productPrice"));wp.hooks.doAction("doko_before_delete_product_from_box",t,e,a),delete window.doko.box_contents[t],delete window.doko.screens[d][t],l(),o(this).parent().closest("tr").remove(),o('ul.box-images li[data-product-id="'+t+'"]').remove(),o('ul.doko-box-contents li[data-product-id="'+t+'"]').remove(),o('table.doko-box-contents tr[data-product-id="'+t+'"]').remove(),wp.hooks.doAction("doko_after_delete_product_from_box",t,e,a)}))}()})),window.hs_dk_rebuild_total_modal=function(){let t=window.doko.screens,d=o("table.doko_select tbody"),e="";for(var a in e=wp.hooks.applyFilters("doko_before_creating_total_details_modal",e),t){let d=t[a];if("first-step"==a){let t=o('a[data-product-id="'+d.product_id+'"]').data();null!=t&&(e+="<tr class='cart_item' data-product-id='"+d.product_id+"' data-product-qty='"+d.qty+"' data-product-price='"+t.productPrice+"' data-product-currency='"+t.siteCurrency+"'><td><img src='"+t.imageUrl+"' class='doko-modal-img-preview' /></td><td>"+t.productName+"</td><td class='doko_style_to_hide'>"+t.productPrice+" "+t.siteCurrency+"</td><td class='doko_style_to_hide'>"+d.qty+"</td><td>"+d.qty*t.productPrice+" "+t.siteCurrency+"</td><td></td></tr>")}else for(var i in d){let t=d[i],a=o('a[data-product-id="'+t.product_id+'"]').data();null!=a&&(e+="<tr class='cart_item' data-product-id='"+t.product_id+"' data-product-qty='"+t.qty+"' data-product-price='"+a.productPrice+"' data-product-currency='"+a.siteCurrency+"'><td><img src='"+a.imageUrl+"' class='doko-modal-img-preview' /></td><td>"+a.productName+"</td><td class='doko_style_to_hide'>"+a.productPrice+" "+a.siteCurrency+"</td><td class='doko_style_to_hide'>"+t.qty+"</td><td>"+t.qty*a.productPrice+" "+a.siteCurrency+'</td><td><a class="doko-remove"><i class="fa fa-times" aria-hidden="true"></i></a></td></tr>')}}e=wp.hooks.applyFilters("doko_after_creating_total_details_modal",e),d.html(e)}}))}(jQuery);
  • doko-box-builder/trunk/public/js/hs-doko-public.js

    r3230317 r3315238  
    44    window.doko               = {};
    55    window.doko.total_price   = 0;
     6    window.doko.total_qty    = 0;
    67    window.doko.box_container = "";
    78    window.doko.box_contents  = {};
    89    window.doko.rules         = {};
     10    window.doko.total_rules   = {}
    911    window.doko.screens       = {};
    1012    window.doko.box_card      = {};
    11     window.doko.gift_messages = {}
     13    window.doko.gift_messages = {};
     14    window.doko.opt_management = {};
     15    window.doko.history    = [];
    1216    let qty;
    1317    let data_to_send = {
     
    5660
    5761            if ( $( document ).innerWidth() <= 767 ) {
    58                 var woocommerce_storefront_footer = $( '.storefront-handheld-footer-bar' ).height();
    59                 $( 'div.hs-dk-menu-fix' ).css( 'bottom', woocommerce_storefront_footer + 'px' )
     62                if ( $( document ).innerWidth() <= 767 ) {
     63                    if ( $( '.storefront-handheld-footer-bar' ) ){
     64                        var woocommerce_storefront_footer = $( '.storefront-handheld-footer-bar' ).height();
     65                        $( 'div.hs-dk-menu-fix' ).css( 'bottom', parseFloat(woocommerce_storefront_footer) *  2 + 'px' )
     66                    }
     67                }
    6068            }
    6169
    6270            $( window ).resize(
    6371                function () {
     72                    console.log('is resized');
    6473                    if ( $( document ).innerWidth() <= 767 ) {
    65                         var woocommerce_storefront_footer = $( '.storefront-handheld-footer-bar' ).height();
    66                         $( 'div.hs-dk-menu-fix' ).css( 'bottom', woocommerce_storefront_footer + 'px' )
    67                     }
    68 
     74                        if ( $( '.storefront-handheld-footer-bar' ) ){
     75                            var woocommerce_storefront_footer = $( '.storefront-handheld-footer-bar' ).height();
     76                            $( 'div.hs-dk-menu-fix' ).css( 'bottom', parseFloat(woocommerce_storefront_footer) * 2 + 'px' )
     77                        }
     78                    } else {
     79                        $( 'div.hs-dk-menu-fix' ).css('bottom', '0px');
     80                    }
    6981                }
    7082            );
     
    88100            var current_page         = 1;
    89101            window.doko.current_page = current_page;
    90             $( 'div#doko-giftbox-progress-bar div.step a' ).removeClass( 'completed' );
    91             $( 'div#doko-giftbox-progress-bar div.step[data-step-id="' + current_page + '"] a' ).addClass( 'completed' );
     102            $( 'div#doko-giftbox-progress-bar div.step a' ).removeClass( 'active_tab_link' );
     103            $( 'div#doko-giftbox-progress-bar div.step[data-step-id="' + current_page + '"] a' ).addClass( 'active_tab_link' );
    92104            $( 'button.doko-page-btn[data-btn-type="next"]' ).on(
    93105                'click',
     
    115127                    $( 'div.hs-dk-bundle-page' ).hide();
    116128                    $( 'div.hs-dk-bundle-page[data-page-id="' + current_page + '"]' ).show()
    117                     $( 'div#doko-giftbox-progress-bar div.step a' ).removeClass( 'completed' );
    118                     $( 'div#doko-giftbox-progress-bar div.step[data-step-id="' + current_page + '"] a' ).addClass( 'completed' );
     129                    $( 'div#doko-giftbox-progress-bar div.step a' ).removeClass( 'active_tab_link' );
     130                    $( 'div#doko-giftbox-progress-bar div.step[data-step-id="' + current_page + '"] a' ).addClass( 'active_tab_link' );
    119131                    window.doko.current_page = current_page;
    120132                    wp.hooks.doAction( 'doko_after_click_navigate_to_page', current_page );
     133
     134                    const element = document.querySelector('.doko-box-section');
     135
     136                    if (element) {
     137                        const top = element.getBoundingClientRect().top + window.pageYOffset;
     138                        window.scrollTo({
     139                            top: top,
     140                            behavior: 'smooth' // or 'auto' for instant scroll
     141                        });
     142                    }
    121143
    122144                    let doko_step_decoded = JSON.parse( doko_step_identifier );
     
    141163                    current_page--;
    142164                    $( 'div.hs-dk-bundle-page[data-page-id="' + current_page + '"]' ).show()
    143                     $( 'div#doko-giftbox-progress-bar div.step a' ).removeClass( 'completed' );
    144                     $( 'div#doko-giftbox-progress-bar div.step[data-step-id="' + current_page + '"] a' ).addClass( 'completed' );
     165                    $( 'div#doko-giftbox-progress-bar div.step a' ).removeClass( 'active_tab_link' );
     166                    $( 'div#doko-giftbox-progress-bar div.step[data-step-id="' + current_page + '"] a' ).addClass( 'active_tab_link' );
    145167                    window.doko.current_page = current_page;
    146168
     
    185207                                    delete window.doko.screens[screenId][product_id];
    186208
    187                                     recalculate_total();
     209                                    recalculate_total_html();
    188210
    189211                                    $( this ).parent().closest( 'tr' ).remove()
     
    210232                        delete window.doko.box_contents[product_id];
    211233                        delete window.doko.screens[screenId][product_id];
    212                         recalculate_total();
     234                        recalculate_total_html();
    213235                        $( 'ul.box-images li[data-product-id="' + product_id + '"]' ).remove();
    214236                        $( 'ul.doko-box-contents li[data-product-id="' + product_id + '"]' ).remove();
     
    226248            window.hs_dk_init_delete_box_action = hs_dk_init_delete_box_action;
    227249            window.hs_dk_recalculate_total      = recalculate_total;
     250            window.hs_dk_recalculate_total_html      = recalculate_total_html;
    228251
    229252            /**
     
    273296            function hs_dk_build_box_contents( product_qty, product_name, product_price, product_id ) {
    274297                var html = '<tr data-product-id="' + product_id + '" data-product-qty="' + product_qty + '" data-product-price="' + product_price + '">'
    275                 html    += '<td>' + product_name + '</td><td>' + product_qty + '</td><td>' + product_price + '</td><td>' + product_price * product_qty + '</td>'
     298                html    += '<td>' + product_name + '</td><td class="doko_style_to_hide">' + product_qty + '</td><td class="doko_style_to_hide">' + product_price + '</td><td>' + product_price * product_qty + '</td>'
    276299                html    += '<td> <a class="doko-remove" ><i class="fa fa-times" aria-hidden="true"></i></a></td>'
    277300                html    += '</tr>'
     
    320343                    let purl         = $( this ).data( 'productUrl' )
    321344
    322                     let curpaid = doko_step_identifier[current_page]
    323 
    324345                    let dkscrt = JSON.parse( doko_step_identifier );
    325346
     
    347368                    }
    348369
    349                     recalculate_total();
     370                    recalculate_total_html();
    350371
    351372                }
    352373            );
     374
     375            function hs_dk_rebuild_li_product_lines( productData, product_img_url, product_quantity, product_name, sprice, product_id ) {
     376                       
     377                let box_contents_html = hs_dk_build_box_contents( product_quantity, product_name, sprice, product_id );
     378   
     379                if ($( 'table.doko-box-contents tbody tr[data-product-id="' + product_id + '"]' ).length == 0) {
     380                    $( 'table.doko-box-contents tbody' ).append( box_contents_html );
     381                    $( 'ul.box-images' ).append( hs_dk_build_img_block( product_img_url, false, productData ) );
     382                } else {
     383                    qty               = $( 'ul.doko-box-contents li[data-product-id="' + product_id + '"] div.doko-qty-exposant' ).html();
     384                    box_contents_html = hs_dk_build_box_contents( qty, product_name, sprice, product_id );
     385                    $( 'table.doko-box-contents tr[data-product-id="' + product_id + '"]' ).replaceWith( box_contents_html )
     386                }
     387
     388            }
     389
     390            window.hs_dk_rebuild_li_product_lines = hs_dk_rebuild_li_product_lines;
    353391
    354392            function hs_dk_init_add_to_box( args = false ) {
     
    359397                    function (e) {
    360398                        e.preventDefault();
     399
     400                        if ( $(this).hasClass('disabled') ) {
     401                            return;
     402                        }
     403
    361404                        var unique_id           = hs_generateUniqueId( 'doko', 12 );
    362405                        var dk_current_page     = window.doko.current_page;
     
    393436
    394437                        product_quantity = parseInt( product_quantity );
     438                        console.log( 'product_quantity', product_quantity );
    395439
    396440                        productData.current_page = dk_current_page;
    397441                        productData.bundle_id    = bundle_id;
    398442                        var product_name         = $( this ).data( 'productName' )
     443                        productData.productName  = product_name;
    399444
    400445                        productData.unique_id = unique_id;
     
    424469                                    }
    425470                                }
    426                                
    427                                
    428 
    429                                 box_contents_html = hs_dk_build_box_contents( product_quantity, product_name, sprice, product_id );
    430                    
    431                                 if ($( 'table.doko-box-contents tbody tr[data-product-id="' + product_id + '"]' ).length == 0) {
    432                                     $( 'table.doko-box-contents tbody' ).append( box_contents_html );
    433                                     $( 'ul.box-images' ).append( hs_dk_build_img_block( product_img_url, false, productData ) );
    434                                 } else {
    435                                     qty               = $( 'ul.doko-box-contents li[data-product-id="' + product_id + '"] div.doko-qty-exposant' ).html();
    436                                     box_contents_html = hs_dk_build_box_contents( qty, product_name, sprice, product_id );
    437                                     $( 'table.doko-box-contents tr[data-product-id="' + product_id + '"]' ).replaceWith( box_contents_html )
    438                                 }
     471
     472                                hs_dk_rebuild_li_product_lines( productData, product_img_url, product_quantity, product_name, sprice, product_id );
    439473
    440474                            }
     
    451485                        }
    452486
    453                         recalculate_total();
     487                        recalculate_total_html();
    454488                    }
    455489                );
     
    496530
    497531            }
     532
     533
    498534
    499535            function recalculate_total() {
     
    517553               
    518554                window.doko.total_price = total;
    519 
    520                 $( 'button.doko-total-btn' ).html( 'Total : ' + hs_dk_get_wc_price( total, true ) );
     555                return total;
     556
     557            }
     558
     559            function recalculate_total_html() {
     560                let total = recalculate_total();
     561                $( 'button.doko-total-btn' ).html( 'Total : ' + hs_dk_get_wc_price( total, true ) + " ⓘ " );
     562                $('.doko_total_details_price').html('Total : '+ hs_dk_get_wc_price( doko.total_price, true ) );
    521563            }
    522564
     
    547589                        }
    548590                        let curbId = $(this).data('bundleContentId');
    549                         console.log($( 'input[data-bundle-content-id="'+curbId+'"][name="doko_current_position"]' ).val())
     591
    550592                        let cposition      = $( 'input[data-bundle-content-id="'+curbId+'"][name="doko_current_position"]' ).val();
    551                         console.log(curbId)
     593
    552594                        if ( cposition ) {
    553595                            nb_of_post_per_page = doko_bundle_data[curbId]['nb-products-per-page'];
     
    605647            }
    606648
     649            function hs_dk_delete_elmt_modal() {
     650                let modyl = $.modal.getCurrent();
     651                var jsonId = JSON.parse(doko_step_identifier);
     652                var current_screen = window.doko.current_page;
     653                var screenId = jsonId[current_screen];
     654
     655                // Use event delegation to ensure newly added elements are also affected
     656                $(modyl.$elm[0]).on("click", "a.doko-remove", function () {
     657                    var product_id = $(this).parent().parent().data("productId");
     658                    var productQty = parseInt($('table.doko_total_details tr[data-product-id="' + product_id + '"]').data("productQty"));
     659                    var price = parseFloat($('table.doko_total_details tr[data-product-id="' + product_id + '"]').data("productPrice"));
     660
     661                    wp.hooks.doAction("doko_before_delete_product_from_box", product_id, productQty, price);
     662
     663                    // Remove product from data
     664                    delete window.doko.box_contents[product_id];
     665                    delete window.doko.screens[screenId][product_id];
     666
     667                    recalculate_total_html();
     668
     669                    // Remove product elements from UI
     670                    $(this).parent().closest("tr").remove();
     671                    $('ul.box-images li[data-product-id="' + product_id + '"]').remove();
     672                    $('ul.doko-box-contents li[data-product-id="' + product_id + '"]').remove();
     673                    $('table.doko-box-contents tr[data-product-id="' + product_id + '"]').remove();
     674
     675                    wp.hooks.doAction("doko_after_delete_product_from_box", product_id, productQty, price);
     676                });
     677
     678            }
     679
    607680
    608681            function hs_dk_init_info_click(){
     
    610683                    e.preventDefault();
    611684                    var productId = $(this).parent().parent().find(".doko-add-to-box").data();
     685                    var btn       = $(this).parent().parent().find(".doko-add-to-box").clone();
    612686                    $('div.doko_modal div.doko_modal_product_title').empty();
    613687                    $('div.doko_modal div.doko_modal_product_title').append( '<h2>' + productId['productName'] + '</h2>' );
     688                    $('div.doko_modal div.doko_modal_product_img').empty();
     689                    $('div.doko_modal div.doko_modal_product_img').append( '<img src="' + productId['imageUrl'] + '" alt="doko-image" class="doko-modal-img" />' );
    614690                    $('div.doko_modal div.doko_modal_product_desc').empty();
    615691                    $('div.doko_modal div.doko_modal_product_desc').append(  $(this).data('productDescription') )
     692                    $('div.doko_modal div.doko_modal_product_price').empty();
     693                    $('div.doko_modal div.doko_modal_product_price').append(  "<p class='doko-price-section'>" + productId['productPrice'] + " "+ productId['siteCurrency'] + "</p>" );
     694                    $('div.doko_modal div.doko_modal_product_price').append(  btn );
    616695                    $('div.doko_modal').modal();
    617696                });
     
    621700                $('select.doko-add-to-box-variable').on('change', function(e){
    622701                    var selected_value = $(this).val();
    623                     $('div.doko_wrapper_btn_variations').hide();
    624                     console.log($(this).prev().find('span.doko_variable_prices'));
    625                     $(this).prev().find('span.doko_variable_prices').hide();
    626                     $('div.doko_wrapper_btn_variations[data-product-id="'+selected_value+'"]').show();
    627                     $(this).prev().find('span.doko_variable_prices[data-product-id="'+selected_value+'"]').show();
    628    
     702                    $(this).parent().find('div.doko_wrapper_btn_variations').hide();
     703                    $(this).prevAll().find('span.price span.doko_variable_prices').hide();
     704                    $(this).parent().find('div.doko_wrapper_btn_variations[data-product-id="'+selected_value+'"]').show();
     705                    $(this).parent().find('div.doko_wrapper_btn_variations[data-product-id="'+selected_value+'"] a').show();
     706                    $(this).prevAll().find('span.price span.doko_variable_prices[data-product-id="'+selected_value+'"]').show();
    629707                    if ( selected_value == "" || !selected_value ) {
    630                         $('span.doko_old_price').show();
     708                        $(this).prevAll().find('span.doko_old_price').show();
    631709                    }
    632710                })
    633    
     711
    634712                $('select.doko-add-to-box-variable').trigger('change');
    635713            }
    636714
     715            $('button.doko_total_btn_elt').on('click', function(){
     716                $('div#doko_total_details').modal()
     717                hs_dk_delete_elmt_modal();
     718            });
     719
     720            function hs_dk_rebuild_total_modal(){
     721                let ds = window.doko.screens;
     722                let uld = $('table.doko_select tbody');
     723
     724                let tli = "";
     725                tli = wp.hooks.applyFilters('doko_before_creating_total_details_modal', tli );
     726                for( var d in ds ) {
     727                    let elop = ds[d];
     728                    if ( d == "first-step" ){
     729                        let product = $('a[data-product-id="'+elop.product_id+'"]').data();
     730                        if ( undefined != product ) {
     731                            tli += "<tr class='cart_item' data-product-id='"+elop.product_id+"' data-product-qty='"+elop.qty+"' data-product-price='"+product.productPrice+"' data-product-currency='"+product.siteCurrency+"'>"+
     732                                "<td><img src='"+product.imageUrl+ "' class='doko-modal-img-preview' /></td>" +
     733                                "<td>"+product.productName+"</td>" +
     734                                "<td class='doko_style_to_hide'>"+product.productPrice+" "+product.siteCurrency+"</td>" +
     735                                "<td class='doko_style_to_hide'>"+elop.qty+"</td>" +
     736                                "<td>"+(elop.qty * product.productPrice)+" "+product.siteCurrency+"</td>" +
     737                                '<td></td>'+
     738                                "</tr>";
     739                        }
     740                    } else {
     741                        for( var pp in elop ) {
     742                            let selop = elop[pp];
     743                            let product = $('a[data-product-id="'+selop.product_id+'"]').data();
     744                            if ( undefined != product ) {
     745                                tli += "<tr class='cart_item' data-product-id='"+selop.product_id+"' data-product-qty='"+selop.qty+"' data-product-price='"+product.productPrice+"' data-product-currency='"+product.siteCurrency+"'>"+
     746                                    "<td><img src='"+product.imageUrl+ "' class='doko-modal-img-preview' /></td>" +
     747                                    "<td>"+product.productName+"</td>" +
     748                                    "<td class='doko_style_to_hide'>"+product.productPrice+" "+product.siteCurrency+"</td>" +
     749                                    "<td class='doko_style_to_hide'>"+selop.qty+"</td>" +
     750                                    "<td>"+(selop.qty * product.productPrice)+ " "+product.siteCurrency+"</td>" +
     751                                    '<td><a class="doko-remove"><i class="fa fa-times" aria-hidden="true"></i></a></td>'+
     752                                    "</tr>";
     753                            }
     754                        }
     755                    }
     756                }
     757                tli = wp.hooks.applyFilters('doko_after_creating_total_details_modal', tli );
     758                uld.html(tli);
     759            }
     760
     761            window.hs_dk_rebuild_total_modal = hs_dk_rebuild_total_modal;
     762
     763
     764
     765
    637766        }
    638767
  • doko-box-builder/trunk/public/js/hs-doko-utils-min.js

    r3230317 r3315238  
    1 function check_in_list(o,d){return d.indexOf(o)>-1}!function(o){"use strict";o(document).ready((function(){function d(d,t,i=!0,e=!0,n=!1){var a=d.quantity,s=d.productId,r=d.productPrice,c=d.imageUrl,p=d.unique_id;d.options_is_checked&&(s="p"+s);var l="";if(e||(l="doko-reset-icone-remove"),n)o(t).find('li[data-product-id="'+s+'"]').length>0&&(o(t).find('li[data-product-id="'+s+'"] div.doko-qty-exposant').html(a),o(t).find('li[data-product-id="'+s+'"]').attr("data-product-qty",a).attr("data-hash-code",p),o("table.doko-box-contents tr[data-product-id='"+s+"']  td:nth-child(2)").html(a));else if(i){o(t).empty();var _="<li class='"+l+"' data-product-qty='"+a+"' data-product-price='"+r+"' data-product-id='"+s+"' data-hash-code='"+p+"'><i style='cursor: pointer;' aria-hidden='true'></i><div class='selected-box' ><img class='box-color' src='"+c+"'></div> ",u=!1;wp.hooks.applyFilters("doko_is_dynamic_screen",u,window.doko.current_page)&&(_+="<div class='doko-right-sup-exposant'>x</div>  <div class='doko-qty-exposant'>"+a+"</div>"),_+="</li>",o(t).append(_).css("display","flex").css("list-style-type","none"),o(t).find("li img").css("height","initial").css("top","10%").css("position","absolute").css("width","initial").css("height","40px"),window.doko.rules={}}else if(o(t).find('li[data-product-id="'+s+'"]').length>0){var k=o(t).find('li[data-product-id="'+s+'"]').attr("data-product-qty");a=parseInt(k)+1,o(t).find('li[data-product-id="'+s+'"] div.doko-qty-exposant').html(a),o(t).find('li[data-product-id="'+s+'"]').attr("data-product-qty",a).attr("data-hash-code",p)}else{_="<li class='"+l+"' data-product-qty="+a+" data-product-price="+r+" data-product-id="+s+" data-hash-code="+p+"><i ' style='cursor: pointer;' aria-hidden='true'></i></div><div class='selected-box' ><img class='box-color' src='"+c+"'></div> ",u=!1;wp.hooks.applyFilters("doko_is_dynamic_screen",u,window.doko.current_page)&&(_+="<div class='doko-right-sup-exposant'>x</div>  <div class='doko-qty-exposant'>"+a+"</div>"),_+="</li>",o(t).append(_).css("display","flex").css("list-style-type","none"),o(t).find("li img").css("height","initial").css("top","10%").css("position","absolute").css("width","initial").css("height","40px")}}o("div.doko-spinner-loading").show(),o("div.doko-spinner-complete").hide(),o("div.doko-is-complete").hide(),o("div.doko-spinner-error").hide(),wp.hooks.addFilter("doko_is_dynamic_screen","doko",(function(o,d){return parseInt(d)!=parseInt(1)}),10,2),wp.hooks.addAction("doko_after_calculate_add_to_box","doko",(function(t,i,e){var n=i.productId,a=i.quantity,s=i.productPrice,r=i.unique_id,c=i.variation_id,p=i.options,l=i.options_is_checked,_=JSON.parse(doko_step_identifier);if(1==e){if(wp.hooks.applyFilters("doko_execute_rule_on_page",!0,e)&&null!=doko_bundle_data){var u=wp.hooks.applyFilters("doko_enable_first_page_redirect",doko_bundle_data["enable-screen-redirect"],e);window.doko.box_container={product_id:n,product_qty:a,product_price:s,unique_id:r,variation_id:c,options:p};let l=s;for(var k in p)null!=p[k].amount&&(l+=p[k].amount);window.doko.screens["first-step"]={qty:i.quantity,amount:wp.hooks.applyFilters("doko_bundle_product_price",l,t,i,e),options:p},d(i,w=o("ul.doko-box-container"),!0,!0),"yes"==u&&o('ul.doko-btn-navigation button.doko-page-btn[data-btn-type="next"]').trigger("click")}}else if(wp.hooks.applyFilters("doko_execute_rule_on_page",!0,e)){var w=o("ul.doko-box-contents");wp.hooks.applyFilters("doko_add_product_to_navigation",!0,e)&&d(i,w,!1,!0),l&&(n="p"+n);var h=_[e];if("no"==window.doko.cardMode){let o=s;for(var k in p)null!=p[k].amount&&(o+=p[k].amount);null==window.doko.screens[h]&&(window.doko.screens[h]={}),window.doko.screens[h].hasOwnProperty(n)||(window.doko.screens[h][n]={qty:0,amount:wp.hooks.applyFilters("doko_bundle_product_price",o,t,i,e),options:p}),window.doko.screens[h][n].qty+=a,window.doko.box_contents.hasOwnProperty(n)?window.doko.box_contents[n].product_qty+=a:window.doko.box_contents[n]={product_id:i.productId,product_qty:a,product_price:s,unique_id:r,variation_id:c,options:p}}}wp.hooks.doAction("doko_execute_rule",e,n,a,s,r,c,t,i)}),30,3),wp.hooks.addAction("doko_delete_product_from_box","doko",(function(d){o("div.hs-dk-bundle-page").filter(":visible").data().pageId>1&&delete window.doko.box_contents[d]})),wp.hooks.addAction("doko_after_click_navigate_to_page","doko",(function(d){if(d==o("div.hs-dk-bundle-page").length){var t={container:window.doko.box_container,contents:window.doko.box_contents,total_price:window.doko.total_price,card_details:window.doko.box_card,gift_message:window.doko.gift_messages};o.post(doko_object.ajaxurl,{action:"doko_wc_add_to_cart",contents:t,bundle_id:o("div[data-bundle-id]").data("bundleId")},(function(d){var t=JSON.parse(d);t.doko_is_added_to_cart?(o("div.doko-spinner-loading").hide(),o("div.doko-spinner-complete").show(),o("div.doko-is-complete").show()):(o("div.doko-spinner-loading").hide(),o("div.doko-spinner-error").show(),o("div.doko-is-complete").show(),o("button.doko-go-to-cart").hide()),o("div#build-complete").append(t.doko_html_response_adc)}))}})),window.hs_dk_add_li_to_box=d}))}(jQuery),window.hs_dk_check_in_list=check_in_list;
     1!function(o){"use strict";o(document).ready((function(){function d(d,t,i=!0,e=!0,a=!1){var n=d.quantity,r=d.productId,s=d.productPrice,c=d.imageUrl,p=d.unique_id;d.options_is_checked&&(r="p"+r);var _="";if(e||(_="doko-reset-icone-remove"),a)o(t).find('li[data-product-id="'+r+'"]').length>0&&(o(t).find('li[data-product-id="'+r+'"] div.doko-qty-exposant').html(n),o(t).find('li[data-product-id="'+r+'"]').attr("data-product-qty",n).attr("data-hash-code",p),o("table.doko-box-contents tr[data-product-id='"+r+"']  td:nth-child(2)").html(n));else if(i){o(t).empty();var l="<li class='"+_+"' data-product-qty='"+n+"' data-product-price='"+s+"' data-product-id='"+r+"' data-hash-code='"+p+"'><i style='cursor: pointer;' aria-hidden='true'></i><div class='selected-box' ><img class='box-color' src='"+c+"'></div> ",u=!1;wp.hooks.applyFilters("doko_is_dynamic_screen",u,window.doko.current_page)&&(l+="<div class='doko-right-sup-exposant'>x</div>  <div class='doko-qty-exposant'>"+n+"</div>"),l+="</li>",o(t).append(l),o(t).find("li img").css("width","40px"),window.doko.rules=[]}else if(o(t).find('li[data-product-id="'+r+'"]').length>0){var k=o(t).find('li[data-product-id="'+r+'"]').attr("data-product-qty");n=parseInt(k)+1,o(t).find('li[data-product-id="'+r+'"] div.doko-qty-exposant').html(n),o(t).find('li[data-product-id="'+r+'"]').attr("data-product-qty",n).attr("data-hash-code",p)}else{l="<li class='"+_+"' data-product-qty="+n+" data-product-price="+s+" data-product-id="+r+" data-hash-code="+p+"><i ' style='cursor: pointer;' aria-hidden='true'></i></div><div class='selected-box' ><img class='box-color' src='"+c+"'></div> ",u=!1;wp.hooks.applyFilters("doko_is_dynamic_screen",u,window.doko.current_page)&&(l+="<div class='doko-right-sup-exposant'>x</div>  <div class='doko-qty-exposant'>"+n+"</div>"),l+="</li>",o(t).append(l),o(t).find("li img").css("width","40px")}}function t(){var d={container:window.doko.box_container,contents:window.doko.box_contents,total_price:window.doko.total_price,card_details:window.doko.box_card,gift_message:window.doko.gift_messages};null!=window.doko.discounts_applied&&(d.discounts_applied=window.doko.discounts_applied),o.post(doko_object.ajaxurl,{action:"doko_wc_add_to_cart",contents:d,bundle_id:o("div[data-bundle-id]").data("bundleId")},(function(d){var t=JSON.parse(d);t.doko_is_added_to_cart?(o("div.doko-spinner-loading").hide(),o("div.doko-spinner-complete").show(),o("div.doko-is-complete").show()):(o("div.doko-spinner-loading").hide(),o("div.doko-spinner-error").show(),o("div.doko-is-complete").show(),o("button.doko-go-to-cart").hide()),o("div#build-complete").append(t.doko_html_response_adc)}))}o("div.doko-spinner-loading").show(),o("div.doko-spinner-complete").hide(),o("div.doko-is-complete").hide(),o("div.doko-spinner-error").hide(),wp.hooks.addFilter("doko_is_dynamic_screen","doko",(function(o,d){return parseInt(d)!=parseInt(1)}),10,2),wp.hooks.addAction("doko_after_calculate_add_to_box","doko",(function(o,d,t){var i=d.productName;let e=doko_object.product_is_added_to_box_message;e=e.replace("%s",i),Snackbar.show({actionText:"Close",pos:"bottom-center",duration:1e4,text:e})}),20,3),wp.hooks.addAction("doko_after_calculate_add_to_box","doko",(function(t,i,e){var a=i.productId,n=i.quantity,r=i.productPrice,s=i.unique_id,c=i.variation_id,p=i.options,_=i.options_is_checked,l=JSON.parse(doko_step_identifier);if(1==e){if(wp.hooks.applyFilters("doko_execute_rule_on_page",!0,e)&&null!=doko_bundle_data){var u=wp.hooks.applyFilters("doko_enable_first_page_redirect",doko_bundle_data["enable-screen-redirect"],e);window.doko.box_container={product_id:a,product_qty:n,product_price:r,unique_id:s,variation_id:c,options:p};let _=r;for(var k in p)null!=p[k].amount&&(_+=p[k].amount);window.doko.screens["first-step"]={product_id:a,qty:i.quantity,amount:wp.hooks.applyFilters("doko_bundle_product_price",_,t,i,e),options:p},d(i,w=o("ul.doko-box-container"),!0,!0),"yes"==u&&o('ul.doko-btn-navigation button.doko-page-btn[data-btn-type="next"]').trigger("click")}}else if(wp.hooks.applyFilters("doko_execute_rule_on_page",!0,e)){var w=o("ul.doko-box-contents");wp.hooks.applyFilters("doko_add_product_to_navigation",!0,e)&&d(i,w,!1,!0),_&&(a="p"+a);var h=l[e];if("no"==window.doko.cardMode){let o=r;for(var k in p)null!=p[k].amount&&(o+=p[k].amount);null==window.doko.screens[h]&&(window.doko.screens[h]={}),window.doko.screens[h].hasOwnProperty(a)||(window.doko.screens[h][a]={product_id:a,qty:0,amount:wp.hooks.applyFilters("doko_bundle_product_price",o,t,i,e),options:p}),window.doko.screens[h][a].qty+=n,window.doko.box_contents.hasOwnProperty(a)?window.doko.box_contents[a].product_qty+=n:window.doko.box_contents[a]={product_id:i.productId,product_qty:n,product_price:r,unique_id:s,variation_id:c,options:p}}}wp.hooks.doAction("doko_execute_rule",e,a,n,r,s,c,t,i)}),30,3),wp.hooks.addAction("doko_after_calculate_add_to_box","doko",(function(o,d,t){hs_dk_rebuild_total_modal()}),50,3),wp.hooks.addAction("doko_delete_product_from_box","doko",(function(d){o("div.hs-dk-bundle-page").filter(":visible").data().pageId>1&&delete window.doko.box_contents[d]})),wp.hooks.addAction("doko_after_delete_product_from_box","doko",(function(o){hs_dk_rebuild_total_modal()})),wp.hooks.addAction("doko_after_click_navigate_to_page","doko",(function(d){d==o("div.hs-dk-bundle-page").length&&t()})),window.hs_dk_add_li_to_box=d,window.hs_dk_add_to_cart_wc=t}))}(jQuery);
  • doko-box-builder/trunk/public/js/hs-doko-utils.js

    r3230317 r3315238  
    2424                2
    2525            );
     26
     27            // display toast for saying a new product have been added to bundle gift box.
     28            wp.hooks.addAction(
     29                'doko_after_calculate_add_to_box',
     30                'doko',
     31                function ( product, productData, current_page ) {
     32                    var pname           = productData['productName'];
     33                    let text = doko_object.product_is_added_to_box_message;
     34                    text = text.replace('%s', pname );
     35                    Snackbar.show( { actionText: 'Close', pos: 'bottom-center', duration: 10000, text: text } );
     36                },
     37                20,
     38                3
     39            );
     40
     41
    2642
    2743            // Trigger event to go to the next page.
     
    3854                    var o_options_is_checked       = productData['options_is_checked'];
    3955                    var step_identifier = JSON.parse( doko_step_identifier );
    40                    
     56
     57                    // store into the history the product added to the box.
     58                    if ( productData.current_page > 1 ) {
     59                        const historyData  = productData;
     60                        window.doko.history.unshift( historyData );
     61                    }
     62
     63
     64
    4165                    if ( current_page == 1 ) {
    4266                        if ( wp.hooks.applyFilters( 'doko_execute_rule_on_page' , true , current_page ) ) {
     
    6690
    6791                                window.doko.screens['first-step'] = {
     92                                    product_id : pid,
    6893                                    qty : productData['quantity'],
    6994                                    amount : wp.hooks.applyFilters('doko_bundle_product_price', sprice, product, productData, current_page ),
     
    107132                                if ( ! window.doko.screens[sidentifier].hasOwnProperty( pid ) ) {
    108133                                    window.doko.screens[sidentifier][pid] = {
     134                                        product_id : pid,
    109135                                        qty : 0,
    110136                                        amount : wp.hooks.applyFilters('doko_bundle_product_price', sprice, product, productData, current_page ),
     
    134160                    wp.hooks.doAction( 'doko_execute_rule', current_page, pid, pqty, pprice, puid, pvid, product, productData );
    135161                },
    136                 30,
     162                10,
     163                3
     164            );
     165
     166            wp.hooks.addAction(
     167                'doko_after_calculate_add_to_box',
     168                'doko',
     169                function ( product, productData, current_page ) {
     170                    window.hs_dk_recalculate_total_html();
     171                    hs_dk_rebuild_total_modal();
     172                    },
     173                50,
    137174                3
    138175            );
     
    150187
    151188            wp.hooks.addAction(
     189                'doko_after_delete_product_from_box',
     190                'doko',
     191                function ( product_id ) {
     192                    hs_dk_rebuild_total_modal();
     193                }
     194            );
     195
     196            wp.hooks.addAction(
    152197                'doko_after_click_navigate_to_page',
    153198                'doko',
    154199                function ( current_page ) {
    155200                    if ( current_page == $( 'div.hs-dk-bundle-page' ).length ) {
    156                         var doko_products = {
    157                             'container' : window.doko.box_container,
    158                             'contents' : window.doko.box_contents,
    159                             'total_price' : window.doko.total_price,
    160                             'card_details' : window.doko.box_card,
    161                             'gift_message' : window.doko.gift_messages
    162                         }
    163                         $.post(
    164                             doko_object.ajaxurl,
    165                             {
    166                                 action : "doko_wc_add_to_cart",
    167                                 contents : doko_products,
    168                                 bundle_id : $( 'div[data-bundle-id]' ).data( 'bundleId' ),
    169 
    170                             },
    171                             function ( response ) {
    172                                 var json_resp = JSON.parse( response );
    173                                 if ( json_resp.doko_is_added_to_cart ) {
    174                                     $( 'div.doko-spinner-loading' ).hide();
    175                                     $( 'div.doko-spinner-complete' ).show();
    176                                     $( 'div.doko-is-complete' ).show()
    177                                 } else {
    178                                     $( 'div.doko-spinner-loading' ).hide();
    179                                     $( 'div.doko-spinner-error' ).show();
    180                                     $( 'div.doko-is-complete' ).show();
    181                                     $( 'button.doko-go-to-cart' ).hide();
    182                                     // Snackbar.show( { actionText: 'Thanks!', pos: 'bottom-center', duration: 30000, text: "This bundle can't be added to the cart, an error occured, please write us to our support with the link of the page."} );
    183                                 }
    184                                 $('div#build-complete').append(json_resp.doko_html_response_adc)
    185                             }
    186                         )
    187                     }
    188                 }
    189             );
     201                        hs_dk_add_to_cart_wc();
     202                    }
     203                }
     204            );
     205
     206
     207
     208            function hs_dk_update_bottom_nav( product_id, qty ) {
     209                $('ul.doko-box-contents li[data-product-id="' + product_id + '"]').find('div.doko-qty-exposant').html( qty );
     210                $('ul.doko-box-contents li[data-product-id="' + product_id + '"]').attr('data-product-qty', qty );
     211            }
     212
     213            function hs_dk_update_card_mode_details( product_id, qty ) {
     214                $('table.doko-box-contents tr[data-product-id="'+product_id+'"]:eq(2)').html(qty);
     215                $('table.doko-box-contents tr[data-product-id="'+product_id+'"]:eq(2)').attr('data-product-qty', qty );
     216            }
     217
     218            window.hs_dk_update_bottom_nav = hs_dk_update_bottom_nav;
     219            window.hs_dk_update_card_mode_details = hs_dk_update_card_mode_details;
     220
     221            function hs_dk_get_table_row_to_box( product_data, ) {
     222                var qty             = product_data['quantity'];
     223                var product_id      = product_data['productId'];
     224                var product_price   = product_data['productPrice'];     
     225                var product_img_url = product_data['imageUrl'];
     226                var hash_code       = product_data['unique_id'];
     227                var o_options_is_checked       = product_data['options_is_checked'];
     228                if ( o_options_is_checked ) {
     229                    product_id = "p"+product_id
     230                }
     231                var html = `<tr data-product-id="${product_id}" data-product-qty="${qty}" data-product-price="${product_price}" data-hash-code="${hash_code}">
     232                    <td>${product_data['productName']}</td>
     233                    <td class="doko_style_to_hide">${qty}</td>
     234                    <td class="doko_style_to_hide">${product_price}</td>
     235                    <td>${product_price}</td>
     236                    <td><a class="doko-remove"><i class="fa fa-times" aria-hidden="true"></i></a></td>
     237                </tr>`;
     238                return html;
     239            }
     240            window.hs_dk_get_table_row_to_box = hs_dk_get_table_row_to_box;
     241
     242
     243                    // responsible for the box contents.
     244
    190245
    191246            function hs_dk_add_li_to_box( product_data, parent_sibling, remove=true, is_bottom=true, updateMode=false  ) {
     
    224279                    }
    225280                    html             += "</li>";
    226                     $( parent_sibling ).append( html ).css( 'display','flex' ).css( 'list-style-type', 'none' )
    227                     $( parent_sibling ).find( 'li img' ).css( 'height','initial' ).css( 'top','10%' ).css( 'position','absolute' ).css( 'width','initial' ).css( 'height','40px' )
    228                     window.doko.rules = {}
     281                    $( parent_sibling ).append( html )
     282                    $( parent_sibling ).find( 'li img' ).css( 'width','40px' )
     283                    // window.doko.rules = []
    229284                } else {
    230285                    // responsible for the box contents.
     
    243298                        }
    244299                        html += "</li>";
    245                         $( parent_sibling ).append( html ).css( 'display','flex' ).css( 'list-style-type', 'none' )
    246                         $( parent_sibling ).find( 'li img' ).css( 'height','initial' ).css( 'top','10%' ).css( 'position','absolute' ).css( 'width','initial' ).css( 'height','40px' )
     300                        $( parent_sibling ).append( html )
     301                        $( parent_sibling ).find( 'li img' ).css( 'width','40px' )
    247302                    }
    248303                }
     
    251306
    252307            window.hs_dk_add_li_to_box = hs_dk_add_li_to_box;
     308
     309
     310            /**
     311             * create a cart into woocommerce.
     312             */
     313            function hs_dk_add_to_cart_wc() {
     314                var doko_products = {
     315                    'container' : window.doko.box_container,
     316                    'contents' : window.doko.box_contents,
     317                    'total_price' : window.doko.total_price,
     318                    'card_details' : window.doko.box_card,
     319                    'gift_message' : window.doko.gift_messages
     320                }
     321                if ( undefined !=  window.doko.discounts_applied  ) {
     322                    doko_products.discounts_applied = window.doko.discounts_applied;
     323                }
     324                $.post(
     325                    doko_object.ajaxurl,
     326                    {
     327                        action : "doko_wc_add_to_cart",
     328                        contents : doko_products,
     329                        bundle_id : $( 'div[data-bundle-id]' ).data( 'bundleId' ),
     330
     331                    },
     332                    function ( response ) {
     333                        var json_resp = JSON.parse( response );
     334                        if ( json_resp.doko_is_added_to_cart ) {
     335                            $( 'div.doko-spinner-loading' ).hide();
     336                            $( 'div.doko-spinner-complete' ).show();
     337                            $( 'div.doko-is-complete' ).show()
     338                        } else {
     339                            $( 'div.doko-spinner-loading' ).hide();
     340                            $( 'div.doko-spinner-error' ).show();
     341                            $( 'div.doko-is-complete' ).show();
     342                            $( 'button.doko-go-to-cart' ).hide();
     343                            // Snackbar.show( { actionText: 'Thanks!', pos: 'bottom-center', duration: 30000, text: "This bundle can't be added to the cart, an error occured, please write us to our support with the link of the page."} );
     344                        }
     345                        $('div#build-complete').append(json_resp.doko_html_response_adc)
     346                    }
     347                )
     348            }
     349
     350            window.hs_dk_add_to_cart_wc = hs_dk_add_to_cart_wc;
    253351        }
    254352    );
     
    256354})( jQuery );
    257355
    258 function check_in_list( value, array ) {
    259     return array.indexOf( value ) > -1;
    260 }
    261 
    262 window.hs_dk_check_in_list = check_in_list;
  • doko-box-builder/trunk/templates/single-product/doko-products.php

    r3230317 r3315238  
    5757        global $product;
    5858        $product_type = $product->get_type();
    59         if ( $doko_display_variations_as_many && !in_array( $product_type, array('simple', 'variation') ) ) {
    60             $childrens = $product->get_children();
    61             $childrens = array_unique( $childrens );
     59        $childrens = $product->get_children();
     60        $childrens = array_unique( $childrens );
     61        if ( $doko_display_variations_as_many && count( $childrens ) > 0 && !in_array( $product_type, array('simple', 'variations') ) ) {
    6262            if ( count( $childrens ) > 0 ) {
    6363                foreach ( $childrens as $variation ) {
     
    6565                    // prevent product out of stock to be added to the bundle.
    6666                    if ( !$product->is_in_stock() || apply_filters( 'doko_skip_product_in_shortcode_loop', false, $product->get_id() ) ) {
    67                         continue;
    68                     }
    69                     // prevent product without price to used.
    70                     if ( $product->get_price() == '' ) {
    7167                        continue;
    7268                    }
     
    8076            // prevent product out of stock to be added to the bundle.
    8177            if ( !$product->is_in_stock() || apply_filters( 'doko_skip_product_in_shortcode_loop', false, $product->get_id() ) ) {
    82                 continue;
    83             }
    84             // prevent product without price to used.
    85             if ( $product->get_price() == '' ) {
    8678                continue;
    8779            }
Note: See TracChangeset for help on using the changeset viewer.