Plugin Directory

Changeset 2942948


Ignore:
Timestamp:
07/25/2023 08:22:19 AM (3 years ago)
Author:
soft8soft
Message:

New version 4.4.0

Location:
verge3d/trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • verge3d/trunk/js/woo_product.js

    r2825703 r2942948  
    3636}
    3737
     38/**
     39 * Get components of the composite product
     40 */
     41function v3d_woo_form_get_components(formData) {
     42    if (window.v3d_woo_composite) {
     43        const components = window.v3d_woo_composite.api.get_composite_configuration();
     44        for (const id in components) {
     45            const component = components[id];
     46            for (const key in component) {
     47                if (key == 'selection_meta')
     48                    for (let i = 0; i < component[key].length; i++) {
     49                        const meta_key = component[key][i].meta_key.toLowerCase();
     50                        const meta_value = component[key][i].meta_value;
     51                        formData.append(`components[${id}][attributes][${meta_key}]`, meta_value);
     52                    }
     53                else
     54                    formData.append(`components[${id}][${key}]`, component[key]);
     55            }
     56        }
     57    }
     58}
     59
    3860function v3d_woo_get_product_info(callback) {
    3961    v3d_woo_product_info_cb = callback;
     
    5072    v3d_woo_form_get_variation_id(formData);
    5173    v3d_woo_form_get_attributes(formData);
     74    v3d_woo_form_get_components(formData);
    5275
    5376    var req = new XMLHttpRequest();
     
    80103    v3d_woo_request_product_info();
    81104}
     105window.v3d_on_product_update = v3d_on_product_update;
    82106
    83107window.addEventListener('load', function() {
  • verge3d/trunk/readme.txt

    r2883285 r2942948  
    55Tested up to: 6.0.1
    66Requires PHP: 7.0
    7 Stable tag: 4.3.0
     7Stable tag: 4.4.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1414Verge3D is the most artist-friendly toolkit for creating interactive WebGL-based and immersive AR/VR experiences. Among the features of this framework are top-class graphics, integration with your favorite modeling suites, efficient web-friendly format for loading assets, seamless integration with WordPress and WooCommerce plugin. Interactivity is enabled with Puzzles, an intuitive and easy-to-learn visual scripting environment.
    1515
    16 Verge3D can be used to create product configurators, 3D presentations, online stores, e-learning apps, 3D portfolios, browser games and more.
     16Verge3D can be used to create product configurators, 3D presentations, online stores, e-learning apps, 3D portfolios, browser games, and more.
    1717
    1818You can try this plugin live using this [sandbox website](https://sandbox.soft8soft.com/) or follow the quick-start guide [here](https://www.soft8soft.com/making-3d-product-configurator-for-woocommerce/).
     
    3232= Use familiar tools =
    3333
    34 We designed Verge3D to be closely integrated with your favorite tools. You can create your 3D content in 3ds Max or Blender, and export straight to a web page. You can also preview your scene in the browser using the Sneak Peek feature.
     34We designed Verge3D to be closely integrated with your favorite tools. You can create your 3D content in Blender, 3ds Max, or Maya, and export straight to a web page. You can also preview your scene in the browser using the Sneak Peek feature.
    3535
    3636But, of course, aside from the 3D part, there is also web! With Verge3D, you can completely forget about building HTML/CSS layouts and JavaScript coding by
     
    62621. 3D product customizer with WooCommerce integration
    63632. Scooter - interactive configurator with 1000000+ combinations
    64 3. Verge3D features direct export from Blender or 3ds Max
     643. Verge3D features direct export from Blender, 3ds Max, or Maya
    65654. Used by NASA and other companies and organizations throughout the world
    66665. Interactive WebGL-based online shop
     
    6969== Changelog ==
    7070
     71= 4.4 =
     72* Verge3D widget for Elementor.
     73* Support WooCommerce Composite Products extension.
     74
     75= 4.3 =
     76* Verge3D 4.3 version bump.
     77
    7178= 4.2 =
    72 * Support 3D items in WooCommerce product gallery
    73 * Fix identation in Gutenberg editor
    74 * Fix app layout on mobiles
     79* Support 3D items in WooCommerce product gallery.
     80* Fix indentation in Gutenberg editor.
     81* Fix app layout on mobiles.
    7582
    7683= 4.1 =
  • verge3d/trunk/verge3d.php

    r2883285 r2942948  
    44Plugin URI: https://www.soft8soft.com/verge3d
    55Description: Verge3D is the most artist-friendly toolkit for creating interactive web-based experiences. It can be used to create product configurators, 3D presentations, online stores, e-learning apps, 3D portfolios, browser games and more.
    6 Version: 4.3.0
     6Version: 4.4.0
    77Author: Soft8Soft LLC
    88Author URI: https://www.soft8soft.com
     
    13541354add_action('admin_enqueue_scripts', 'load_wp_media_files');
    13551355
     1356function v3d_register_elementor_widget($widgets_manager) {
     1357    require_once(__DIR__ . '/elementor_widget.php');
     1358    $widgets_manager->register(new \V3D_Elementor_Widget());
     1359}
     1360add_action('elementor/widgets/register', 'v3d_register_elementor_widget');
     1361
     1362
     1363/**
     1364 * Global utility functions
     1365 **/
    13561366
    13571367function v3d_inline_custom_styles() {
  • verge3d/trunk/woo_product.php

    r2825703 r2942948  
    33function v3d_load_woo_scripts() {
    44    global $post;
    5     wp_enqueue_script('v3d_admin', plugin_dir_url( __FILE__ ) . 'js/woo_product.js');
     5    wp_enqueue_script('v3d_woo_product', plugin_dir_url( __FILE__ ) . 'js/woo_product.js');
    66
    77    $switch_on_update = get_post_meta(get_the_ID(), 'v3d_app_show_gallery', true) &&
    88          get_post_meta(get_the_ID(), 'v3d_app_switch_on_update', true);
    99
    10     wp_localize_script('v3d_admin', 'v3d_ajax_object',
     10    wp_localize_script('v3d_woo_product', 'v3d_ajax_object',
    1111        array(
    1212            'ajax_url' => admin_url('admin-ajax.php'),
    1313            'switch_on_update' => $switch_on_update
    1414        ));
    15 
    1615}
    1716add_action('wp_enqueue_scripts', 'v3d_load_woo_scripts');
     17
     18
     19function v3d_bootstap_woo_product_composite($dependencies) {
     20    wp_register_script('v3d_woo_product_composite', plugin_dir_url(__FILE__) . 'js/woo_product_composite.js');
     21    $dependencies[] = 'v3d_woo_product_composite';
     22    return $dependencies;
     23}
     24
     25function v3d_plugins_loaded() {
     26    global $woocommerce_composite_products;
     27    add_filter('woocommerce_composite_script_dependencies', 'v3d_bootstap_woo_product_composite');
     28}
     29add_action('plugins_loaded', 'v3d_plugins_loaded');
    1830
    1931
     
    2234function v3d_product_tab($tabs) {
    2335    $tabs['verge3d'] = array(
    24         'label'  => __('Verge3D', 'verge3d'),
     36        'label'  => __('Verge3D', 'verge3d'),
    2537        'target' => 'v3d_product_options',
    2638        'class'  => array('show_if_verge3d'),
     
    224236
    225237        $response['weight'] = floatval($product->get_weight());
    226 
    227238        $response['length'] = floatval($product->get_length());
    228239        $response['width'] = floatval($product->get_width());
     
    250261                if (!empty($variation->get_weight()))
    251262                    $response['weight'] = floatval($variation->get_weight());
    252 
    253263                if (!empty($variation->get_length()))
    254264                    $response['length'] = floatval($variation->get_length());
     
    291301            }
    292302
     303        } else if ($product->is_type('composite')) {
     304
     305            $response['components'] = array();
     306
     307            if (!empty($_REQUEST['components'])) {
     308                foreach ($_REQUEST['components'] as $comp_id => $comp) {
     309
     310                    $comp_response = array();
     311
     312                    $comp_response['title'] = $comp['title'];
     313                    $comp_response['id'] = $comp_id;
     314
     315                    $comp_response['type'] = $comp['product_type'];
     316                    $comp_response['quantity'] = intval($comp['quantity']);
     317
     318                    $child = wc_get_product($comp['product_id']);
     319
     320                    if (!empty($child)) {
     321                        $comp_response['name'] = $comp['selection_title'];
     322                        $comp_response['sku'] = $child->get_sku();
     323                        $comp_response['weight'] = floatval($child->get_weight());
     324                        $comp_response['length'] = floatval($child->get_length());
     325                        $comp_response['width'] = floatval($child->get_width());
     326                        $comp_response['height'] = floatval($child->get_height());
     327                        $comp_response['attributes'] = v3d_product_get_attributes($child);
     328                    } else {
     329                        $comp_response['name'] = '';
     330                        $comp_response['sku'] = '';
     331                        $comp_response['weight'] = 0;
     332                        $comp_response['length'] = 0;
     333                        $comp_response['width'] = 0;
     334                        $comp_response['height'] = 0;
     335                        $comp_response['attributes'] = [];
     336                    }
     337
     338                    if ($comp['product_type'] == 'variable') {
     339                        if (!empty($comp['variation_id'])) {
     340                            $variation = wc_get_product($comp['variation_id']);
     341
     342                            $comp_response['name'] = $variation->get_name();
     343
     344                            if (!empty($variation->get_sku()))
     345                                $comp_response['sku'] = $variation->get_sku();
     346
     347                            if (!empty($variation->get_weight()))
     348                                $comp_response['weight'] = floatval($variation->get_weight());
     349                            if (!empty($variation->get_length()))
     350                                $comp_response['length'] = floatval($variation->get_length());
     351                            if (!empty($variation->get_width()))
     352                                $comp_response['width'] = floatval($variation->get_width());
     353                            if (!empty($variation->get_height()))
     354                                $comp_response['height'] = floatval($variation->get_height());
     355
     356                            foreach ($comp['attributes'] as $attr_key => $attr_value) {
     357                                $comp_response['attributes'][$attr_key] = $attr_value;
     358                            }
     359                        } else {
     360                            // nothing selected, reset all attributes to empty strings
     361                            foreach ($comp_response['attributes'] as $attr_key => $attr_value) {
     362                                $comp_response['attributes'][$attr_key] = '';
     363                            }
     364                        }
     365                    }
     366
     367                    // make empty array an object to be properly handled by JSON encode
     368                    if (empty($comp_response['attributes']))
     369                        $comp_response['attributes'] = (object)array();
     370
     371                    array_push($response['components'], $comp_response);
     372                }
     373            }
    293374        }
     375
     376        // make empty array an object to be properly handled by JSON encode
     377        if (empty($response['attributes']))
     378            $response['attributes'] = (object)array();
    294379
    295380    } else {
     
    302387add_action('wp_ajax_v3d_woo_get_product_info', 'v3d_get_product_info');
    303388add_action('wp_ajax_nopriv_v3d_woo_get_product_info', 'v3d_get_product_info');
     389
Note: See TracChangeset for help on using the changeset viewer.