Plugin Directory

Changeset 2173650


Ignore:
Timestamp:
10/15/2019 11:53:16 AM (6 years ago)
Author:
dragosmicu
Message:

Fixed pre-version bugs.

Location:
wootomation/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wootomation/trunk/includes/class-sales.php

    r2172583 r2173650  
    9494    public static function get_most_frequent($data){
    9595
    96         if( !isset( $data ) ) return false;
     96        if( empty( $data ) ) return false;
    9797
    9898        // combine all arrays
  • wootomation/trunk/readme.txt

    r2172588 r2173650  
    1 === Other people also bought ===
    2 Tags: woocommerce,ecommerce,automation,ai,ml
     1=== Wootomation - Machine Learning AI ===
     2Tags: woocommerce,ecommerce,automation,artificial-intelligence,machine-learning,ai,ml
    33Requires at least: 4.9
    44Tested up to: 5.2.3
     
    77License URI: https://www.gnu.org/licenses/gpl-2.0.html
    88
    9 Wootomation allows to add "Other people also bought..." feature to your WooCommerce site. Increase your sales with the help of Machine Learning AI.
     9Wootomation allows to add "People who bought these, also bought..." feature to your WooCommerce site. Increase your sales with the help of Machine Learning AI.
    1010
    1111== Description ==
     
    2424
    2525== Frequently Asked Questions ==
    26 How does it work?
     26= How does it work? =
    2727
    2828The machine-learning artificial intelligence analyses all the sales in a smart way, it learns from them, and then is able to predict the most relevant products to your customers, thus increasing sales. With each purchase going forward, it keeps learning and gets better and better.
     29
     30== Screenshots ==
     31
     321. Storefront example
     332. Storefront example
  • wootomation/trunk/wootomation.php

    r2172583 r2173650  
    77 * Author: Dragos Micu
    88 * Author URI: https://www.dragosmicu.co.uk/
     9 * Text Domain: Wootomation
     10 * WC tested up to 3.7.1
    911 */
    1012
     
    162164            $suggestions = Wootomation_AI::predict($associator, $products_in_cart);
    163165
    164             $sorted_data = Wootomation_Sales::get_most_frequent($suggestions);
    165             $number_of_suggestions = count( $sorted_data );
     166            if( $suggestions ){
     167                $sorted_data = Wootomation_Sales::get_most_frequent($suggestions);
     168                $number_of_suggestions = count( $sorted_data );
     169            } else {
     170                $sorted_data = array();
     171                $number_of_suggestions = 0;
     172            }
    166173
    167174            if( $number_of_suggestions < 3 ){
    168175                $needed_sugestions = 3 - $number_of_suggestions;
     176                if( $needed_sugestions > count($products_in_cart) ){
     177                    $needed_sugestions = count($products_in_cart);
     178                }
    169179
    170180                for ($i=0; $i < $needed_sugestions; $i++) {
     
    174184                    $secondary_data = Wootomation_Sales::get_most_frequent($suggestions);
    175185
    176                     foreach ($secondary_data as $each_data) {
    177                         if( !in_array($each_data, $products_in_cart) ){
    178                             array_push($sorted_data, $each_data);
     186                    if( $secondary_data ){
     187                        foreach ($secondary_data as $each_data) {
     188                            if( !in_array($each_data, $products_in_cart) ){
     189                                array_push($sorted_data, $each_data);
     190                            }
    179191                        }
    180192                    }
Note: See TracChangeset for help on using the changeset viewer.