Plugin Directory

Changeset 3307394


Ignore:
Timestamp:
06/06/2025 07:14:46 AM (10 months ago)
Author:
wisernotify
Message:

Updating trunk to version 1.4

Location:
wiser-review/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • wiser-review/trunk/readme.txt

    r3297021 r3307394  
    66Tested up to: 6.8
    77Requires PHP: 7.4
    8 Stable tag: 1.2
     8Stable tag: 1.4
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
  • wiser-review/trunk/wiser-review.php

    r3306881 r3307394  
    44 * Plugin URI: https://wisernotify.com
    55 * Description: Wiser Review module helps you collect and display product reviews, star ratings, and nudges. It also automates review requests via email to boost custom engagement and conversions.
    6  * Version: 1.0
     6 * Version: 1.4
    77 * Author: Wiser Notify
    88 * Requires Plugins: woocommerce
     
    112112}
    113113add_action( 'woocommerce_after_single_product_summary', 'wiserrw_show_product_review' );
     114// fix for the kadence theme
     115add_action( 'kadence_after_short_description_block', 'wiserrw_show_product_review' );
     116
    114117
    115118/**
     
    159162}
    160163add_action( 'woocommerce_single_product_summary', 'wiserrw_show_rating_count', 5 );
     164// fix for the kadence theme
     165add_action( 'woocommerce_after_add_to_cart_button', 'wiserrw_show_rating_count' );
    161166
    162167/**
     
    246251add_shortcode( 'wiserrw_product_nudges', 'wiserrw_product_nudges' );
    247252
     253add_action( 'admin_init', 'test_wiser' );
     254function test_wiser() {
     255    if( isset( $_GET['test_wiser'] ) ) {
     256        $wiserrw_api_settings = get_option( 'wiserrw_api_settings' );
     257        $api_key = $wiserrw_api_settings['wiserrw_api_key'];
     258        $api_data = wiserrw_validate_api( $api_key );
     259        $date_from = strtotime( '-7 days' );
     260        $all_orders = wc_get_orders(
     261            array(
     262                'status'        => array( 'completed', 'processing' ),
     263                'date_created'  => '>' . gmdate( 'Y-m-d H:i:s', $date_from ),
     264                'limit'         => -1,
     265            )
     266        );
     267        //var_dump($all_orders);
     268    }
     269}
    248270/**
    249271 * Send WooCommercer Order Data.
     
    315337}
    316338add_action( 'woocommerce_order_status_completed', 'wiserrw_woocommerce_order_status_completed' );
    317 // Remove the old hook to avoid duplicate calls
    318 // add_action( 'woocommerce_thankyou', 'wiserrw_woocommerce_order_status_completed' );
    319339
    320340/**
     
    344364                break;
    345365            case '7_days':
     366                $date_from = strtotime( '-7 days' );
     367                break;
    346368            default:
    347369                $date_from = strtotime( '-7 days' );
     
    356378        );
    357379    } else {
     380        $start_date = new WC_DateTime($from_date);
     381        $end_date   = new WC_DateTime($to_date);
    358382        $all_orders = wc_get_orders(
    359383            array(
    360384                'status'        => array( 'completed', 'processing' ),
    361                 'date_created'  => $from_date . '...' . $to_date,
     385                'date_created'  => gmdate( $start_date . '...' . $end_date ),
    362386                'limit'         => -1,
    363387            )
    364388        );
    365389    }
    366 
    367390    $total = count( $all_orders );
    368391    $chunk_ids = array_slice( $all_orders, $offset, $limit );
    369 
    370392    $upload_dir = wp_upload_dir();
    371393    $filename = 'orders-export-progress.csv';
     
    376398
    377399    if ( $is_first_chunk ) {
    378         fputcsv( $fp, array( 'First Name', 'Last Name', 'Phone', 'Email', 'Product Title', 'Product URL', 'Product Image URL', 'Product ID', 'Reviewer Image URL', 'Order Date' ) );
    379     }
    380 
    381     foreach ( $chunk_ids as $order_id ) {
    382         $order = wc_get_order( $order_id );
     400        fputcsv( $fp, array('Order Id', 'First Name', 'Last Name', 'Phone', 'Email', 'Product Title', 'Product URL', 'Product Image URL', 'Product ID', 'Reviewer Image URL', 'Order Date' ) );
     401    }
     402
     403    foreach ( $chunk_ids as $order) {
     404        $order_id = $order->get_id();
     405       
    383406        $user_id = $order->get_user_id();
    384407        /* Product Details */
     
    386409        foreach ( $items as $item ) {
    387410            $product       = $item->get_product();
     411            if (!$product) {
     412                continue;
     413            }
     414           
    388415            $product_id    = $item->get_product_id();
    389416            $product_price = $product->get_price();
     
    393420            $image_url = $image[0];
    394421            $reviewer_url = get_avatar_url( $user_id );
    395             $product_data['id'] = $product_id;
    396             $product_data['pn'] = $product_name;
    397             $product_data['name'] = $product_name;
    398             $product_data['prc'] = $product_price;
    399             $product_data['pu'] = $url;
    400             $product_data['piu'] = $image_url;
    401 
     422            $products_str[] = $product->get_name() . "|" . $image_url;
     423   
    402424            fputcsv(
    403425                $fp,
    404426                array(
     427                    $order_id,
    405428                    $order->get_billing_first_name(),
    406429                    $order->get_billing_last_name(),
     
    470493                break;
    471494            case '7_days':
     495                $date_from = strtotime( '-1 days' );
     496                break;
    472497            default:
    473498                $date_from = strtotime( '-7 days' );
     
    482507        );
    483508    } else {
     509        $start_date = new WC_DateTime($from_date);
     510        $end_date   = new WC_DateTime($to_date);
    484511        $all_orders = wc_get_orders(
    485512            array(
    486513                'status'        => array( 'completed', 'processing' ),
    487                 'date_created'  => $from_date . '...' . $to_date,
     514                'date_created'  => gmdate( $start_date . '...' . $end_date ),
    488515                'limit'         => -1,
    489516            )
     
    505532        }
    506533
    507         foreach ( $chunk_ids as $order_id ) {
    508             $order = wc_get_order( $order_id );
     534        foreach ( $chunk_ids as $order ) {
     535            $order_id = $order->get_id();
    509536
    510537            /* Order Details */
     
    604631                break;
    605632            case '7_days':
     633                $date_from = strtotime( '-7 days' );
     634                break;
    606635            default:
    607636                $date_from = strtotime( '-7 days' );
     
    616645        );
    617646    } else {
     647        $start_date = new WC_DateTime($from_date);
     648        $end_date   = new WC_DateTime($to_date);
    618649        $all_orders = wc_get_orders(
    619650            array(
    620651                'status'        => array( 'completed', 'processing' ),
    621                 'date_created'  => $from_date . '...' . $to_date,
     652                'date_created'  => gmdate( $start_date . '...' . $end_date ),
    622653                'limit'         => -1,
    623654            )
Note: See TracChangeset for help on using the changeset viewer.