Title: How add button save (solution)
Last modified: August 30, 2016

---

# How add button save (solution)

 *  Resolved [endwin](https://wordpress.org/support/users/endwin/)
 * (@endwin)
 * [10 years, 4 months ago](https://wordpress.org/support/topic/how-add-button-save-solution/)
 * Hi.
    I download this plugin and do some customization. How to add button SAVE?
   Here is instruction. In mq_woocommerce_products_price_bulk_edit.php rewrite this:
 *     ```
       // mq_wpbe_toplevel_page() displays the page content for the custom Test Toplevel menu
       	function mq_wpbe_toplevel_page(){
       	    echo '<div class="wrap">';
       ```
   
 * for this:
 *     ```
       // mq_wpbe_toplevel_page() displays the page content for the custom Test Toplevel menu
       	function mq_wpbe_toplevel_page(){
             echo '<div class="mq_wpbe_save" title="Save"><span class="dashicons dashicons-update"></span></div>';
       	    echo '<div class="wrap">';
       ```
   
 * is it about line 40.
    It’s code what add button.
 * And add data-bprice attr to input:
 *     ```
       echo '<input type="text" class="regular_price_input" id="' . $variation->variation_id . '" size="5" value="' . $variation->get_regular_price() . '" data-bprice="' . $variation->get_regular_price() . '">';
       	echo '<input type="text" class="sales_price_input" style="background-color: rgb(215, 255, 255);" id="' . $variation->variation_id . '" size="5" value="' . $variation->get_sale_price() . '" data-bprice="' . $variation->get_sale_price() . '"><span class="ajax_loader mq_wpbe_ajax_loader_' . (get_locale() == "fa_IR" ? 'right' : 'left') . '" id="' . $variation->variation_id . '">&nbsp;</span>';
       ```
   
 * about line 150.
 * Next is js:
 *     ```
       $('.mq_wpbe_save').click(function() {
               $('.mq_wpbe_products_ul').find('input').each(function() {
                   if( $(this).val() != $(this).data('bprice') ) {
                     var e = jQuery.Event("keypress");
                     e.which = 13; //choose the one you want
                     e.keyCode = 13;
                     $(this).trigger(e);
                   }
               });
             });
       ```
   
 * add it before:
 *     ```
       /************************
       			 *Save a Product's Price
       			 ***********************/
       ```
   
 * This js check if is value rewrite and if true, upload this value.(upload all 
   visible changed value)
 * For better listing, add to js short piece of code. When the value is uploaded,
   give this input green background. This code add to:
 *     ```
       $('span#' + product_id + '.ajax_loader').fadeIn('slow').html('<img src="<?php echo plugins_url( 'tick.png', __FILE__ ); ?>">');
       					   }
       					});
       					$.post(ajaxurl, data, function(response){});
       ```
   
 * Add them:
 *     ```
       $('span#' + product_id + '.ajax_loader').fadeIn('slow').html('<img src="<?php echo plugins_url( 'tick.png', __FILE__ ); ?>">');
                     prod_trg.css('background-color', '#96d993');
                     prod_trg.data('bprice', prod_trg.val());
       					   }
       					});
       					$.post(ajaxurl, data, function(response){});
       ```
   
 * And come CSS:
 *     ```
       .mq_wpbe_save {
         position: fixed;
         width: auto;
         height: auto;
         top: 25%;
         right: 0;
         rotate: 0;
         background-color: #008c17;
         color: white;
         padding: 2px;
         cursor: pointer;
       }
       .mq_wpbe_save:hover {
         background-color: #00b81e;
       }
       .mq_wpbe_save .dashicons-update {
         font-size: 40px;
         width: auto;
         height: auto;
       }
       ```
   
 * I hope, I don’t do fault…:-D
 * [https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/](https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/)

The topic ‘How add button save (solution)’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/mq-woocommerce-products-price-bulk-
   edit_b3658d.svg)
 * [Woocommerce Products Price Bulk Edit](https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/mq-woocommerce-products-price-bulk-edit/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/)
 * [Active Topics](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/mq-woocommerce-products-price-bulk-edit/reviews/)

## Tags

 * [save](https://wordpress.org/support/topic-tag/save/)

 * 0 replies
 * 1 participant
 * Last reply from: [endwin](https://wordpress.org/support/users/endwin/)
 * Last activity: [10 years, 4 months ago](https://wordpress.org/support/topic/how-add-button-save-solution/)
 * Status: resolved