Plugin Directory

Changeset 3115683


Ignore:
Timestamp:
07/10/2024 02:46:07 PM (9 months ago)
Author:
visidea
Message:

2.0.0

Location:
visidea
Files:
216 added
11 edited

Legend:

Unmodified
Added
Removed
  • visidea/trunk/includes/class-visidea.php

    r2885745 r3115683  
    147147    $this->loader->add_action('wp_enqueue_scripts', $plugin_public, 'enqueue_scripts');
    148148
    149     $this->loader->add_action('woocommerce_before_single_product', $plugin_public, 'callback_product_viewed');
    150     $this->loader->add_action('woocommerce_add_to_cart', $plugin_public,'callback_product_added_cart', 10, 6);
    151     $this->loader->add_action('woocommerce_thankyou', $plugin_public, 'callback_order_placed', 10, 1);
     149    // $this->loader->add_action('woocommerce_before_single_product', $plugin_public, 'callback_product_viewed');
     150    // $this->loader->add_action('woocommerce_add_to_cart', $plugin_public,'callback_product_added_cart', 10, 6);
     151    // $this->loader->add_action('woocommerce_thankyou', $plugin_public, 'callback_order_placed', 10, 1);
    152152    // $this->loader->add_action('wp_head', $plugin_public, 'callback_head', 10);
    153     $this->loader->add_action('wp_head', $plugin_public, 'callback_home_viewed', 20);
    154     $this->loader->add_action('wp_head', $plugin_public, 'callback_recommends_shop_cart', 20, 1);
     153    // $this->loader->add_action('wp_head', $plugin_public, 'callback_home_viewed', 20);
     154    // $this->loader->add_action('wp_head', $plugin_public, 'callback_recommends_shop_cart', 20, 1);
     155
     156    $this->loader->add_filter('the_content', $plugin_public, 'callback_the_content', 20);
     157
     158    $this->loader->add_action('wp_body_open', $plugin_public, 'insert_search_tag', 20, 1);
    155159
    156160  }
  • visidea/trunk/public/class-visidea-public.php

    r2916308 r3115683  
    3232
    3333  /**
     34   * The database of Visidea.
     35   *
     36   * @since    2.0.0
     37   * @access   private
     38   * @var      string    $database    The database.
     39   */
     40  private $database;
     41
     42  /**
     43   * The public_token of Visidea.
     44   *
     45   * @since    2.0.0
     46   * @access   private
     47   * @var      string    $public_token    The public_token.
     48   */
     49  private $public_token;
     50
     51  /**
    3452   * Initialize the class and set its properties.
    3553   *
     
    4361    $this->version = $version;
    4462
     63    // Get options
     64    $options = get_option('visidea_plugin_options');
     65    $this->database = str_replace('.','_',$options['database']);
     66    $this->public_token = $options['public_token'];
     67
    4568  }
    4669
     
    5275  public function enqueue_styles() {
    5376
    54     wp_register_style('visidea_slick', plugin_dir_url( __FILE__ ) . 'css/slick.css', array(), $this->version, 'all');
    55     wp_register_style('visidea_slick_theme', plugin_dir_url( __FILE__ ) . 'css/slick-theme.css', array(), $this->version, 'all');
    56     wp_register_style('visidea_vs', 'https://cdn.visidea.ai/visual-search/css/main.css', array(), $this->version, 'all');
    57 
    58     wp_enqueue_style('visidea_slick');
    59     wp_enqueue_style('visidea_slick_theme');
    60     wp_enqueue_style('visidea_vs');
    61      
    6277  }
    6378
     
    6984  public function enqueue_scripts() {
    7085
    71     wp_register_script('visidea_slick', plugin_dir_url( __FILE__ ) . 'js/slick.min.js', array('jquery'), $this->version, true);
    72     wp_register_script('visidea_api_client', 'https://cdn.visidea.ai/js-api-client/dist/visidea-api-client.min.js', array('jquery'), $this->version, true);
    73     wp_register_script('visidea_client', plugin_dir_url( __FILE__ ) . 'js/visidea-client.js', array('jquery'), $this->version, true);
     86    // Load library from the CDN
     87    wp_register_script('visidea_plugin', 'https://cdn.visidea.ai/js-visidea/js-visidea-3.0.0.min.js', array(), $this->version, array('in_footer' => true, 'strategy' => 'defer'));
     88    wp_enqueue_script('visidea_plugin');
    7489
    75     wp_enqueue_script('visidea_slick');
    76     wp_enqueue_script('visidea_api_client');
    77     wp_enqueue_script('visidea_client');
    78 
    79     // Initialize VisideaWoocommerce object
    80     $options = get_option('visidea_plugin_options');
    81     $visidea_public_token = $options['public_token'];
    82     $visidea_database = str_replace('.','_',$options['database']);
    83     wp_add_inline_script('visidea_client', "
    84       var vs_timer_start = window.setInterval(function(){
    85         if (typeof VisideaWoocommerce === 'function') {
    86             window.clearInterval(vs_timer_start);
    87             window.visideaWoocommerce = new VisideaWoocommerce('".esc_js($visidea_database)."','".esc_js($visidea_public_token)."');
    88           }
    89       }, 100);
     90    // Initialize visidea
     91    wp_add_inline_script('visidea_plugin', "
     92      window.onload = function() {
     93          visidea('".esc_js($this->database)."','".esc_js($this->public_token)."');
     94      };
    9095    ");
    9196
     
    9398
    9499  /**
    95    * Action to execute when an order is placed.
    96    * Append to the interaction file (filename defined in activator)
    97    * the string user_id;purchase;item_id for each item in the
    98    * placed order.
     100   * Display the tags in the HTML.
    99101   *
    100102   * @since 1.0.0
    101    * @param int $order_id identificator of the placed order
    102103   */
    103   public function callback_order_placed($order_id) {
    104 
    105     // the order and the customer_id
    106     // $query = new WC_Order_Query( array(
    107     //   'limit' => -1,
    108     //   'orderby' => 'date',
    109     //   'order' => 'DESC',
    110     // ));
    111     // var_dump($order_id);
    112     $order = new WC_Order( $order_id );
    113     // $order = get_order($order_id);
    114     // var_dump($order);
    115     $data  = $order->get_data();
    116     $customer_id = $order->get_customer_id();
    117     // var_dump($customer_id);
    118     // $customer_id = $this->vs_get_customer_id($order[0]->get_billing_email());
    119 
    120     if ($customer_id > 0) {
    121       echo "<script>
    122       var vs_timer_order = window.setInterval(function(){
    123         if (window.visideaWoocommerce != undefined) {
    124             window.clearInterval(vs_timer_order);
    125             visideaWoocommerce.mergeUser('".esc_js($customer_id)."');
    126         }
    127       }, 100);
    128       </script>"; 
    129     } else {
    130       // Loop through order items and write them in the opened file
    131       $product_ids = array();
    132       foreach ($order->get_items() as $item_id => $item) {
    133         // Get product handle
    134         $product = $item->get_product();
    135 
    136         // Get the product ID
    137         if (is_object($product))
    138           $product_id = $product->get_id();
    139         else
    140           $product_id = 0;
    141         if ($product_id > 0) {
    142           $product_ids[] = $product_id;
    143         }
    144       }
    145       if (count($product_ids))
    146         echo "<script>
    147           var vs_timer_order = window.setInterval(function(){
    148             if (window.visideaWoocommerce != undefined) {
    149                 window.clearInterval(vs_timer_order);
    150                 visideaWoocommerce.interaction('purchase', 'purchase', '".esc_js(get_current_user_id())."', ".esc_js(json_encode($product_ids)).");
    151             }
    152           }, 100);
    153         </script>";
    154 
     104  public function callback_the_content($content) {
     105    $user_id = get_current_user_id();
     106    if (is_front_page()) {
     107      $return = '<div class="visidea-recommendations" page="home" user_id="'.esc_attr($user_id).'"></div>';
    155108    }
    156 
    157   }
    158 
    159 
    160   /**
    161    * Function that retrieve the customer_id from an e-mail.
    162    *
    163    * @since 1.3.2
    164    * @param string $email email of the customer
    165    */
    166   function vs_get_customer_id($email) {
    167     global $wpdb;
    168     $sql = "SELECT customer_id FROM {$wpdb->prefix}wc_customer_lookup WHERE email = '$email'";
    169     $customer = $wpdb->get_results($sql, OBJECT);
    170     return $customer[0]->customer_id;
    171   }
    172 
    173 
    174   /**
    175    *    Action to be performed when a product is addedd to a
    176    *    user's cart. Append the string item_id;cart;user_id
    177    *    to the file specified in the activator.
    178    *
    179    *    @since 1.0.0
    180    *    @param int      $cart_item_key          cart id
    181    *    @param int      $product_id             product id
    182    *    @param int      $quantity
    183    *    @param int      $variation_id           variation of product id
    184    *    @param int      $variation
    185    *    @param ?        $cart_item_data
    186    */
    187   public function callback_product_added_cart($cart_item_key, $product_id, $quantity,
    188     $variation_id, $variation, $cart_item_data ) {
    189 
    190     if (!wp_doing_ajax()) {
    191       $user_id = get_current_user_id();
    192 
    193       // Get handle to Visidea API
    194       $options = get_option('visidea_plugin_options');
    195       $visidea_public_token = $options['public_token'];
    196       $visidea_database = $options['database'];
    197  
    198       $item_array = [$product_id];
    199  
    200       // Use VisideaWoocommerce to send purchase messages
    201       echo "<script>
    202       var vs_timer_cart = window.setInterval(function(){
    203         if (window.visideaWoocommerce != undefined) {
    204             window.clearInterval(vs_timer_cart);
    205             visideaWoocommerce.interaction('cart', 'cart', '".esc_js($user_id)."', ".esc_js(json_encode($item_array)).");
    206         }
    207       }, 100);
    208       </script>";
     109    if (is_product()) {
     110      global $product;
     111      $product_id = $product->get_id();
     112      $return = '<div class="visidea-recommendations" page="product" user_id="'.esc_attr($user_id).'" item_id="'.esc_attr($product_id).'"></div>
     113                 <meta class="visidea-interaction" type="item" user_id="'.esc_attr($user_id).'" item_id="'.esc_attr($product_id).'" />';
    209114    }
    210 
    211   }
    212 
    213   public function callback_home_viewed() {
    214       if (is_front_page()) {
    215           $user_id = get_current_user_id();
    216 
    217           // echo 'after content';
    218           $options = get_option('visidea_plugin_options');
    219           $visidea_public_token = $options['public_token'];
    220           $visidea_database = $options['database'];
    221 
    222           // Show recommendations
    223           echo "<script>
    224           var vs_timer_home = window.setInterval(function(){
    225             if (window.visideaWoocommerce != undefined) {
    226                 window.clearInterval(vs_timer_home);
    227                 visideaWoocommerce.recommend('home');
    228             }
    229           }, 100);
    230           </script>";
    231       }
     115    if (is_cart()) {
     116      $return = '<div class="visidea-recommendations" page="cart" user_id="'.esc_attr($user_id).'"></div>';
     117    }
     118    if (is_order_received_page()) {
     119      $return = '<div class="visidea-recommendations" page="order" user_id="'.esc_attr($user_id).'"></div>';
     120    }
     121    return $content.$return;
    232122  }
    233123
    234124  /**
    235    *  Action to be performed when a product page is loaded.
    236    *  Append to the file defined in the activator
    237    *  the string product_id;view;user_id. Since there's no way
    238    *  to perform this action _only the first time_ it's viewed,
    239    *  it will be repeated every time the user views a product page.
     125   * Insert the search tag in the HTML.
     126   *
     127   * @since 2.0.0
    240128   */
    241   public function callback_product_viewed() {
    242     global $product;
    243     $product_id = $product->get_id();
     129  public function insert_search_tag() {
    244130    $user_id = get_current_user_id();
    245 
    246     // Get handle to Visidea API
    247     $options = get_option('visidea_plugin_options');
    248     $visidea_public_token = $options['public_token'];
    249     $visidea_database = $options['database'];
    250 
    251     $item_array = [$product_id];
    252     // Use VisideaWoocommerce to send product view messages
    253     echo "<script>
    254     var vs_timer_product_1 = window.setInterval(function(){
    255       if (window.visideaWoocommerce != undefined) {
    256           window.clearInterval(vs_timer_product_1);
    257           visideaWoocommerce.interaction('product', 'view', '".esc_js($user_id)."', ".esc_js(json_encode($item_array)).");
    258       }
    259     }, 100);
    260     </script>";
    261 
    262     // Show recommendations
    263     echo "<script>
    264     var vs_timer_product_2 = window.setInterval(function(){
    265       if (window.visideaWoocommerce != undefined) {
    266           window.clearInterval(vs_timer_product_2);
    267           visideaWoocommerce.recommend('product');
    268       }
    269     }, 100);
    270     </script>";
    271 }
    272 
    273   public function callback_recommends_shop_cart() {
    274     if (is_cart()) {
    275 
    276       $user_id = get_current_user_id();
    277 
    278       // Use VisideaWoocommerce to send cart messages
    279       echo "<script>
    280       var vs_timer_cart_1 = window.setInterval(function(){
    281         if (window.visideaWoocommerce != undefined) {
    282             window.clearInterval(vs_timer_cart_1);
    283             visideaWoocommerce.interaction('cart', 'cart', '".esc_js($user_id)."','');
    284         }
    285       }, 100);
    286       </script>";
    287  
    288       // Show recommendations
    289       echo "<script>
    290       var vs_timer_cart_2 = window.setInterval(function(){
    291         if (window.visideaWoocommerce != undefined) {
    292             window.clearInterval(vs_timer_cart_2);
    293             visideaWoocommerce.recommend('cart');
    294         }
    295       }, 100);
    296       </script>";
    297     }
     131    echo '<div class="visidea-search-bar" user_id="'.$user_id.'"></div>';
    298132  }
    299133
  • visidea/trunk/readme.txt

    r3036832 r3115683  
    44Tags: visual search, visual recommendations, visual, recommendations, recommendation, search, photo, woocommerce, e-commerce, analytics, marketing, automation
    55Requires at least: 4.7
    6 Tested up to: 6.2
     6Tested up to: 6.6
    77Requires PHP: 7.0
    8 Stable tag: 1.2.16
     8Stable tag: 2.0.0
    99License: GPLv3
    1010License URI: https://www.gnu.org/licenses/gpl-3.0.html
    1111
    12 Visidea is the Visual Search and Product Recommendations plugin for WooCommerce. Visidea improves UX and increases the revenues of your website.
     12Visidea is the Visual Search, Search Bar and Product Recommendations plugin for WooCommerce. Visidea improves UX and increases the revenues of your website.
    1313
    1414== Description ==
    1515
    16 ### Visidea: the Visual Search and Product Recommendations plugin for Wordpress + WooCommerce
     16### Visidea: the Visual Search, Search Bar and Product Recommendations plugin for Wordpress + WooCommerce
     17
     18- :rocket: **Supercharge Conversions**: Increase your WooCommerce conversion rate by up to 30% with our AI-powered search and discovery plugin.
     19- :handbag: **Effortless Shopping**: Visual Search, Semantic Search, and smart Product Recommendations make finding what they need a breeze for your customers.
     20- :airplane: **Delightful Experience**: Lightning-fast search, image search options, advanced category filtering, and intuitive product filters keep users happy.
     21- :violin: **Seamless Integration**: Works flawlessly with your theme for a smooth user experience.
     22- :dart: **Upgrade Today, See Results Now**: Transform your WordPress site into a conversion machine with our powerful Artificial Intelligence solution.
    1723
    1824[youtube https://www.youtube.com/watch?v=YUfZQmBE7Uc]
    1925
    20 Do you want to personalize your e-commerce UX like Netflix?
    21 
    22 With our Visual Search and Product Recommendations plugin, you can move your website to the next level of hyper-personalisation.
    23 
    24 ### Visual search & visual discovery
    25 
    26 A complete solution for the visual search and visual discovery that improve the customer journey and inspire your customers.
    27 
    28 Shoppers are searching for your products, with camera search you can delight them.
    29 
    30 Our visual search and visual discovery solution allows your customers to search your website items simply by snapping a photo from their device, or by uploading a picture from their computer.
    31 
    32 Possibilities are endless: imagine your customer walking at the fashion week and looking at an outfit she adores. She can snap a photo and search your website for the products that best match.
    33 
    34 Uploading a screenshot of their favorite influencer and finding similar products is now possible with our visual search and visual discovery solution.
    35 
    36 ### Visual recommendations
    37 
    38 Our visual recommendation platform automates your item tagging showing the most similar products to the ones your customers are browsing.
    39 
    40 Our visual recommendation engine recognizes your items’ images and displays automatically the most similar products. Customers can choose from the original item and similar alternatives.
    41 
    42 ### Product recommendations
    43 
    44 Our recommendation engine as a service optimizes sales of your e-commerce website.
    45 
    46 Maximize ROI and user engagement with product recommendations.
    47 
    48 Suggestions let users find more valuable products to buy and this will increase average cart value (ACV), customer lifetime value (CLV), and consequently optimize return on investment (ROI).
    49 
    50 The user interaction and user experience will benefit from a great improvement because every customer will get unique recommendations about products, categories, and brands they like most.
    51 
    52 ### FEATURES
    53 
    54 Visidea has different features that adapt to your marketing needs!
    55 
    56 * Connect your e-commerce websites.
    57 * Setup visual search.
    58 * Setup visual recommendation carousels.
    59 * Setup product recommendation carousels.
    60 * Various recommendation engine algorithms.
    61 * Collaborative filtering.
    62 * Content-based.
    63 * Image-based.
    64 
    65 More features are under development and will be available soon.
     26### Visual Search
     27
     28- :camera: **Visual Search**: Allow your e-commerce customers to search for products by images.
     29- :iphone: **Mobile first**: Improve your customers journey and inspire them by snapping a photo from their mobile device or computer.
     30- :pushpin: **Dynamic Bounding Boxes**: Detect products in photos with our AI algorithm, showcasing them with bounding boxes and allowing customers to refine the search with intuitive drag and drop.
     31- :paperclip: **Intelligent Product Filters**: Enable shoppers to effortlessly navigate through your catalog with our intuitive default and customizable filters.
     32
     33### Search Bar
     34
     35- :books: **Semantic Search**: Allow your e-commerce customers to search with Artificial Intelligence powered Semantic Textual Search.
     36- :microscope: **Typo-Tolerance & Synonyms**: Enhance search accuracy with recognition of typos and synonyms.
     37- :mahjong: **Auto Translation**: Allow customers to query your website content in any natural language, with our AI finding the right result.
     38- :paperclip: **Intelligent Product Filters**: Enable shoppers to effortlessly navigate through your catalog with our intuitive default and customizable filters.
     39
     40### Product Recommendations
     41
     42- :high_heel: **Product Recommendations**: Visidea suggests products in real time based on customer preferences, enhancing user experience.
     43- :pencil2: **Customizable Widgets**: Display recommendations anywhere on your website and customize the look and feel, colors, and fonts to align with your brand identity.
     44- :crystal_ball: **Multiple Strategies**: Optimize each carousel with a variety of algorithms including collaborative filtering, visual similarity, popular items, and navigation history.
     45- :mega: **Automatic Up-sells and Cross-sells**: Our AI-managed Recommendations system handles all up-sells and cross-sells seamlessly.
     46
     47### Other features
     48
     49- :bar_chart: **Real-Time Analytics**: Gain valuable insights into user behavior and geolocation data.
     50- :balloon: **Respect Your Theme Design**: Ensure seamless integration with your existing design aesthetic.
     51- :dollar: **Multi-language and Multi-currency Support**: Reach a global audience with support for over 30 languages and currencies.
    6652
    6753### PRICING
     
    7763### Compatible with:
    7864
    79 - Wordpress version 6.2
    80 - Woocommerce version 7.6
     65- Wordpress version 6.6
     66- Woocommerce version 9.0
    8167
    8268== Frequently Asked Questions ==
     
    11197== Changelog ==
    11298
     99= 2.0.0 2024-07-09 =
     100Semantic Search, new UX
     101
    113102= 1.2.16 2024-02-16 =
    114103Screenshots changed
     
    246235
    2472361. Visual Search
    248 2. Product Recommendations
    249 3. Advanced dashboard
    250 4. User friendly backend
     2372. AI Search Bar
     2383. Product Recommendations
     2394. Advanced filters
    2512405. Cusomizable widget
    252 6. Easy integration
    253 7. Mobile friendly
     2416. Mobile friendly
     2427. Easy integration
     2438. Advanced dashboard
  • visidea/trunk/visidea.php

    r3036832 r3115683  
    44 * Plugin Name: Visidea
    55 * Plugin URI: https://visidea.ai
    6  * Description: Visidea is the visual search and visual recommendation plugin for WooCommerce. Visidea improves UX and increases the revenues of your website.
    7  * Version: 1.2.14
     6 * Description: Visidea is the search and recommendations plugin for WooCommerce. Visidea improves UX and increases the revenues of your website.
     7 * Version: 2.0.0
    88 * Author: Inferendo
    99 * Author URI: https://visidea.ai
     
    2727 * Current Visidea version.
    2828 */
    29 define('VISIDEA_VERSION', '1.2.16');
     29define('VISIDEA_VERSION', '2.0.0');
    3030
    3131/**
     
    9696add_action( 'visidea_export_interactions_job', 'visidea_export_interactions_job' );
    9797
     98function visidea_recommendation_shortcode($atts) {
     99    // Shortcode attributes with default values
     100    // Example:
     101    // [visidea_recommendation algo="user"]
     102    $atts = shortcode_atts(
     103        array(
     104            'algo' => '',
     105        ),
     106        $atts,
     107        'visidea_recommendation'
     108    );
     109
     110    // Get the current user ID (returns 0 if not logged in)
     111    $user_id = get_current_user_id();
     112
     113    // Get the current product ID (only if on a single product page)
     114    $product_id = '';
     115    if (is_product()) {
     116        global $product;
     117        $product_id = $product->get_id();
     118    }
     119
     120    // Return the HTML output
     121    return '<div class="visidea-recommendation" algo="' . esc_attr($atts['algo']) . '" user_id="' . esc_attr($user_id) . '" item_id="' . esc_attr($product_id) . '"></div>';
     122}
     123add_shortcode( 'visidea_recommendation', 'visidea_recommendation_shortcode' );
     124
    98125run_visidea();
Note: See TracChangeset for help on using the changeset viewer.