Changeset 3337697
- Timestamp:
- 08/01/2025 10:00:43 AM (7 months ago)
- Location:
- recently-purchased-products-for-woo
- Files:
-
- 36 added
- 3 edited
-
tags/1.1.7 (added)
-
tags/1.1.7/includes (added)
-
tags/1.1.7/includes/assets (added)
-
tags/1.1.7/includes/assets/css (added)
-
tags/1.1.7/includes/assets/css/ajax-loader.gif (added)
-
tags/1.1.7/includes/assets/css/fonts (added)
-
tags/1.1.7/includes/assets/css/fonts/slick.eot (added)
-
tags/1.1.7/includes/assets/css/fonts/slick.svg (added)
-
tags/1.1.7/includes/assets/css/fonts/slick.ttf (added)
-
tags/1.1.7/includes/assets/css/fonts/slick.woff (added)
-
tags/1.1.7/includes/assets/css/index.php (added)
-
tags/1.1.7/includes/assets/css/rppw-style.css (added)
-
tags/1.1.7/includes/assets/css/slick-theme.css (added)
-
tags/1.1.7/includes/assets/css/slick.css (added)
-
tags/1.1.7/includes/assets/image (added)
-
tags/1.1.7/includes/assets/image/no-image.png (added)
-
tags/1.1.7/includes/assets/index.php (added)
-
tags/1.1.7/includes/assets/js (added)
-
tags/1.1.7/includes/assets/js/rppw-admin.js (added)
-
tags/1.1.7/includes/assets/js/rppw-public.js (added)
-
tags/1.1.7/includes/assets/js/slick.min.js (added)
-
tags/1.1.7/includes/class-rppw-admin.php (added)
-
tags/1.1.7/includes/class-rppw-public.php (added)
-
tags/1.1.7/includes/class-rppw-scripts.php (added)
-
tags/1.1.7/includes/index.php (added)
-
tags/1.1.7/includes/widget (added)
-
tags/1.1.7/includes/widget/class-rppw-elementor-widget.php (added)
-
tags/1.1.7/includes/widget/class-rppw-widget.php (added)
-
tags/1.1.7/includes/widget/index.php (added)
-
tags/1.1.7/index.php (added)
-
tags/1.1.7/languages (added)
-
tags/1.1.7/languages/index.php (added)
-
tags/1.1.7/languages/recently-purchased-products-for-woo.pot (added)
-
tags/1.1.7/license.txt (added)
-
tags/1.1.7/readme.txt (added)
-
tags/1.1.7/recently-purchased-products-for-woo.php (added)
-
trunk/includes/class-rppw-public.php (modified) (7 diffs)
-
trunk/readme.txt (modified) (4 diffs)
-
trunk/recently-purchased-products-for-woo.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
recently-purchased-products-for-woo/trunk/includes/class-rppw-public.php
r3273024 r3337697 34 34 * @author World Web Technology <[email protected]> 35 35 */ 36 public function get_recently_order($limit = 5, $order = 'DESC') 37 { 38 $args = array( 39 'post_type' => 'shop_order', 40 'post_status' => array('wc-completed', 'wc-processing'), 41 'posts_per_page' => $limit, 42 'orderby' => 'ID', 43 'order' => $order, 44 ); 45 $orders_list = wc_get_orders($args); 46 return $orders_list; 36 public function get_recently_order($limit = 5, $order = 'DESC', $allow_category = '') { 37 $args = array( 38 'post_type' => 'shop_order', 39 'post_status' => array('wc-completed', 'wc-processing'), 40 'posts_per_page' => -1, 41 'orderby' => 'ID', 42 'order' => $order, 43 ); 44 45 $all_orders = wc_get_orders($args); 46 $filtered_orders = array(); 47 48 // Convert allow_category to array and trim values 49 $allowed_categories = array_filter(array_map('trim', explode(',', $allow_category))); 50 51 foreach ($all_orders as $order) { 52 $items = $order->get_items(); 53 $has_category_product = false; 54 55 foreach ($items as $item) { 56 $product_id = $item->get_product_id(); 57 $terms = get_the_terms($product_id, 'product_cat'); 58 59 if (!empty($terms) && !is_wp_error($terms)) { 60 foreach ($terms as $term) { 61 // if term ID matches any allowed category ID. 62 if (empty($allow_category) || 63 in_array($term->term_id, $allowed_categories) || 64 in_array(strval($term->term_id), $allowed_categories)) { 65 $has_category_product = true; 66 break 2; 67 } 68 } 69 } 70 } 71 72 if ($has_category_product) { 73 $filtered_orders[] = $order; 74 if (count($filtered_orders) >= $limit) { 75 break; 76 } 77 } 78 } 79 80 return $filtered_orders; 47 81 } 48 82 /** … … 66 100 'price' => 'show', 67 101 'category' => 'show', 102 'allow_category' => '', 68 103 'cart' => 'show', 69 104 'rating' => 'show', … … 114 149 } else { 115 150 $category = ''; 151 } 152 153 if(!empty($atts['allow_category'])) { 154 $allow_category = $atts['allow_category']; 155 } else { 156 $allow_category = ''; 116 157 } 117 158 … … 147 188 $out .= '<div class="rppw_order_title">' . esc_html($title) . '</div>'; 148 189 } 149 $orders_list = $this->get_recently_order($limit, $order );190 $orders_list = $this->get_recently_order($limit, $order, $allow_category); 150 191 wp_enqueue_style('rppw-css'); 151 192 $columns = $col_class = ''; … … 290 331 'limit' => 5, 291 332 'category' => 'show', 333 'allow_category' => '', 292 334 'cart' => 'show', 293 335 'rating' => 'show', … … 316 358 $price = strtolower($atts['price']); 317 359 $category = strtolower($atts['category']); 360 $allow_category = $atts['allow_category']; 318 361 $cart = strtolower($atts['cart']); 319 362 $customer_info = strtolower($atts['customer_info']); … … 331 374 $out .= '<div class="rppw_order_title"><h2>' . sanitize_text_field(trim($title)) . '</h2></div>'; 332 375 } 333 $orders_list = $this->get_recently_order($limit, $order );376 $orders_list = $this->get_recently_order($limit, $order, $allow_category); 334 377 //Load Slick plugin CSS file 335 378 wp_enqueue_style('rppw-slick-style'); -
recently-purchased-products-for-woo/trunk/readme.txt
r3273024 r3337697 10 10 Requires PHP: 7.4 11 11 Tested up to: 6.8 12 Stable tag: 1.1. 612 Stable tag: 1.1.7 13 13 License: GPLv2 or later 14 14 License URI: https://www.gnu.org/licenses/gpl-2.0.html 15 Version: 1.1. 615 Version: 1.1.7 16 16 17 17 Display Recently Purchased Products For Woocommerce using Widget and Shortcode … … 34 34 You can use the shortcode to dispaly list of recently purchased products. Here's an example of how you can show the recently purchased 6 products with grid view: 35 35 36 `[recently_purchased_products limit="8" view="grid" category="hide" grid_cols="4" img_size="150" img_type="product" cart="Show" rating="show" customer_info="show"]`36 `[recently_purchased_products allow_category="" limit="8" view="grid" category="hide" grid_cols="4" img_size="150" img_type="product" cart="Show" rating="show" customer_info="show"]` 37 37 38 38 Below are the shortcode supported options: 39 39 40 40 * title: Display the title on top of listing. Default is empty. 41 * allow_category: It allows you to display orders belonging to specific categories. Leave blank to display for all categories. 41 42 * limit: Used to limit the number of products. Default is 5. 42 43 * order: Order of listing either ASC or DESC. Default is DESC. … … 55 56 Here's an example of how you can show the recently purchased 6 products with Slider view: 56 57 57 `[recently_purchased_products_slider title="" limit="6" category="show" cart="Show" rating="hide" order="DESC" img="show" img_size'="150" img_type="product" customer_info="first_name" date="show" price="show" slidestoshow="4" slidestoscroll="1" autoplay="true" dots="true" arrow="true" infinite="true"]`58 `[recently_purchased_products_slider title="" allow_category="" limit="6" category="show" cart="Show" rating="hide" order="DESC" img="show" img_size'="150" img_type="product" customer_info="first_name" date="show" price="show" slidestoshow="4" slidestoscroll="1" autoplay="true" dots="true" arrow="true" infinite="true"]` 58 59 59 60 Below are the shortcode supported options: 60 61 61 62 * title: Display the title on top of Slider. Default is empty. 63 * allow_category: It allows you to display orders belonging to specific categories. Leave blank to display for all categories. 62 64 * limit: Used to limit the number of products. Default is 5. 63 65 * category: Show or hide the product category. Default is Show. … … 153 155 == Changelog == 154 156 157 = 1.1.7 (Aug 1, 2025) = 158 * A new attribute allow_category has been added. 159 * It allows you to display orders belonging to specific categories. 160 155 161 = 1.1.6 (Apr 15, 2025) = 156 162 * Fixes depreciation errors with WordPress version 6.8 and PHP 8.2 -
recently-purchased-products-for-woo/trunk/recently-purchased-products-for-woo.php
r3273024 r3337697 4 4 * Plugin URI: https://wordpress.org/plugins/recently-purchased-products-for-woo 5 5 * Description: Display Recently Purchased Products For Woocommerce using Widget and Shortcode 6 * Version: 1.1. 66 * Version: 1.1.7 7 7 * Author: World Web Technology 8 8 * Author URI: http://www.worldwebtechnology.com … … 33 33 */ 34 34 if( !defined( 'RPPW_VERSION' ) ) { 35 define( 'RPPW_VERSION', '1.1. 6' ); // Plugin Version35 define( 'RPPW_VERSION', '1.1.7' ); // Plugin Version 36 36 } 37 37
Note: See TracChangeset
for help on using the changeset viewer.