Changeset 3072117
- Timestamp:
- 04/17/2024 07:06:13 AM (22 months ago)
- Location:
- bulk-woo-discount
- Files:
-
- 15 added
- 3 edited
-
assets/screenshot-3.png (added)
-
tags/1.1 (added)
-
tags/1.1/admin (added)
-
tags/1.1/admin/class-bwdp-admin.php (added)
-
tags/1.1/admin/css (added)
-
tags/1.1/admin/css/admin-style.css (added)
-
tags/1.1/bulk-woo-discount.php (added)
-
tags/1.1/languages (added)
-
tags/1.1/public (added)
-
tags/1.1/public/class-bwdp-public.php (added)
-
tags/1.1/readme.txt (added)
-
tags/1.1/screenshot-1.png (added)
-
tags/1.1/screenshot-2.png (added)
-
tags/1.1/screenshot-3.png (added)
-
trunk/admin/class-bwdp-admin.php (modified) (4 diffs)
-
trunk/bulk-woo-discount.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
-
trunk/screenshot-3.png (added)
Legend:
- Unmodified
- Added
- Removed
-
bulk-woo-discount/trunk/admin/class-bwdp-admin.php
r3036517 r3072117 126 126 public function bwdp_register_actions( $bulk_actions ) { 127 127 $bulk_actions['product-discount-action'] = __( 'Product discount', 'bulk-woo-discount' ); 128 $bulk_actions['product-removediscount-action'] = __( 'Remove discount', 'bulk-woo-discount' ); 128 129 return $bulk_actions; 129 130 } … … 139 140 */ 140 141 public function bwdp_action_handler( $redirect_to, $doaction, $post_ids ) { 141 if ( 'product-discount-action' !== $doaction ) { 142 return $redirect_to; 143 } 144 145 $bwdp_price = get_option( 'bwdp_price' ); 146 if ( ! empty( $bwdp_price ) ) { 142 if ( 'product-discount-action' === $doaction ) { 143 $bwdp_price = get_option( 'bwdp_price' ); 144 if ( ! empty( $bwdp_price ) ) { 145 foreach ( $post_ids as $post_id ) { 146 update_post_meta( $post_id, 'bwdp-product-discount', $bwdp_price ); 147 } 148 } 149 $redirect_to = add_query_arg( 'bulk_product-discount', count( $post_ids ), $redirect_to ); 150 } 151 if ( 'product-removediscount-action' === $doaction ) { 147 152 foreach ( $post_ids as $post_id ) { 148 update_post_meta( $post_id, 'bwdp-product-discount', $bwdp_price);149 } 150 }151 $redirect_to = add_query_arg( 'bulk_product-discount', count( $post_ids ), $redirect_to );153 update_post_meta( $post_id, 'bwdp-product-discount', null ); 154 } 155 $redirect_to = add_query_arg( 'bulk_product-discount', count( $post_ids ), $redirect_to ); 156 } 152 157 return $redirect_to; 153 158 } … … 278 283 279 284 /** 285 * Add custom column to the admin table for Products post type. 286 * 287 * @param array $columns Columns array. 288 * @return array Modified columns array. 289 * @package Bulk_Woo_Discount 290 * @since 1.0.0 291 */ 292 public function bwdp_columns_head($columns) { 293 $new_columns = array(); 294 // Copy existing columns 295 foreach ($columns as $key => $value) { 296 $new_columns[$key] = $value; 297 if ($key === 'sku') { 298 // Add custom column after 'sku' column 299 $new_columns['bwdp-pro-dis'] = __('Product Discount', 'your-text-domain'); 300 } 301 } 302 return $new_columns; 303 } 304 305 /** 306 * Display content for custom column in the admin table. 307 * 308 * @param string $column_name Column name. 309 * @param int $post_id Post ID. 310 * @package Bulk_Woo_Discount 311 * @since 1.0.0 312 */ 313 public function bwdb_columns_discount_price($column_name, $post_id) { 314 if ($column_name === 'bwdp-pro-dis') { 315 $bwdp_dis_data = get_post_meta($post_id, 'bwdp-product-discount', true); 316 if(!empty($bwdp_dis_data)){ 317 echo esc_html($bwdp_dis_data."%"); // Display custom data in the column 318 } 319 else{ 320 echo esc_html('—'); 321 } 322 } 323 } 324 325 /** 280 326 * Adding Hooks 281 327 * … … 300 346 301 347 add_action( 'admin_notices', array( $this, 'bwdp_action_notices' ) ); 348 349 add_filter('manage_edit-product_columns', array( $this, 'bwdp_columns_head') ); 350 351 add_action('manage_product_posts_custom_column', array( $this, 'bwdb_columns_discount_price'), 10, 2 ); 352 302 353 } 303 354 } -
bulk-woo-discount/trunk/bulk-woo-discount.php
r3037139 r3072117 3 3 * Plugin Name: Bulk Woo Discount 4 4 * Description: Woocommerce gives feature to provide discounted price. 5 * Version: 1. 0.05 * Version: 1.1.0 6 6 * Requires at least: 5.2 7 7 * Requires PHP: 7.2 -
bulk-woo-discount/trunk/readme.txt
r3036847 r3072117 4 4 Requires at least: 5.4 5 5 Tested up to: 6.3 6 Stable tag: 1. 0.06 Stable tag: 1.1.0 7 7 Requires PHP: 7.0 8 8 License: GPLv2 or later … … 51 51 1. [Screenshot 1: Plugin settings page](screenshot-1.png) 52 52 2. [Screenshot 2: Bulk discount configuration](screenshot-2.png) 53 3. [Screenshot 3: Remove product bulk discount](screenshot-3.png) 53 54 54 55 == Upgrade Notice ==
Note: See TracChangeset
for help on using the changeset viewer.