Changeset 3307394
- Timestamp:
- 06/06/2025 07:14:46 AM (10 months ago)
- Location:
- wiser-review/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (1 diff)
-
wiser-review.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wiser-review/trunk/readme.txt
r3297021 r3307394 6 6 Tested up to: 6.8 7 7 Requires PHP: 7.4 8 Stable tag: 1. 28 Stable tag: 1.4 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html -
wiser-review/trunk/wiser-review.php
r3306881 r3307394 4 4 * Plugin URI: https://wisernotify.com 5 5 * 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. 06 * Version: 1.4 7 7 * Author: Wiser Notify 8 8 * Requires Plugins: woocommerce … … 112 112 } 113 113 add_action( 'woocommerce_after_single_product_summary', 'wiserrw_show_product_review' ); 114 // fix for the kadence theme 115 add_action( 'kadence_after_short_description_block', 'wiserrw_show_product_review' ); 116 114 117 115 118 /** … … 159 162 } 160 163 add_action( 'woocommerce_single_product_summary', 'wiserrw_show_rating_count', 5 ); 164 // fix for the kadence theme 165 add_action( 'woocommerce_after_add_to_cart_button', 'wiserrw_show_rating_count' ); 161 166 162 167 /** … … 246 251 add_shortcode( 'wiserrw_product_nudges', 'wiserrw_product_nudges' ); 247 252 253 add_action( 'admin_init', 'test_wiser' ); 254 function 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 } 248 270 /** 249 271 * Send WooCommercer Order Data. … … 315 337 } 316 338 add_action( 'woocommerce_order_status_completed', 'wiserrw_woocommerce_order_status_completed' ); 317 // Remove the old hook to avoid duplicate calls318 // add_action( 'woocommerce_thankyou', 'wiserrw_woocommerce_order_status_completed' );319 339 320 340 /** … … 344 364 break; 345 365 case '7_days': 366 $date_from = strtotime( '-7 days' ); 367 break; 346 368 default: 347 369 $date_from = strtotime( '-7 days' ); … … 356 378 ); 357 379 } else { 380 $start_date = new WC_DateTime($from_date); 381 $end_date = new WC_DateTime($to_date); 358 382 $all_orders = wc_get_orders( 359 383 array( 360 384 'status' => array( 'completed', 'processing' ), 361 'date_created' => $from_date . '...' . $to_date,385 'date_created' => gmdate( $start_date . '...' . $end_date ), 362 386 'limit' => -1, 363 387 ) 364 388 ); 365 389 } 366 367 390 $total = count( $all_orders ); 368 391 $chunk_ids = array_slice( $all_orders, $offset, $limit ); 369 370 392 $upload_dir = wp_upload_dir(); 371 393 $filename = 'orders-export-progress.csv'; … … 376 398 377 399 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 383 406 $user_id = $order->get_user_id(); 384 407 /* Product Details */ … … 386 409 foreach ( $items as $item ) { 387 410 $product = $item->get_product(); 411 if (!$product) { 412 continue; 413 } 414 388 415 $product_id = $item->get_product_id(); 389 416 $product_price = $product->get_price(); … … 393 420 $image_url = $image[0]; 394 421 $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 402 424 fputcsv( 403 425 $fp, 404 426 array( 427 $order_id, 405 428 $order->get_billing_first_name(), 406 429 $order->get_billing_last_name(), … … 470 493 break; 471 494 case '7_days': 495 $date_from = strtotime( '-1 days' ); 496 break; 472 497 default: 473 498 $date_from = strtotime( '-7 days' ); … … 482 507 ); 483 508 } else { 509 $start_date = new WC_DateTime($from_date); 510 $end_date = new WC_DateTime($to_date); 484 511 $all_orders = wc_get_orders( 485 512 array( 486 513 'status' => array( 'completed', 'processing' ), 487 'date_created' => $from_date . '...' . $to_date,514 'date_created' => gmdate( $start_date . '...' . $end_date ), 488 515 'limit' => -1, 489 516 ) … … 505 532 } 506 533 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(); 509 536 510 537 /* Order Details */ … … 604 631 break; 605 632 case '7_days': 633 $date_from = strtotime( '-7 days' ); 634 break; 606 635 default: 607 636 $date_from = strtotime( '-7 days' ); … … 616 645 ); 617 646 } else { 647 $start_date = new WC_DateTime($from_date); 648 $end_date = new WC_DateTime($to_date); 618 649 $all_orders = wc_get_orders( 619 650 array( 620 651 'status' => array( 'completed', 'processing' ), 621 'date_created' => $from_date . '...' . $to_date,652 'date_created' => gmdate( $start_date . '...' . $end_date ), 622 653 'limit' => -1, 623 654 )
Note: See TracChangeset
for help on using the changeset viewer.