Fügen Sie Admin -Produkte Schnellbearbeitern in WooCommerce 3.2+ hinzu.Php

PHP-Programmierer chatten hier
Anonymous
 Fügen Sie Admin -Produkte Schnellbearbeitern in WooCommerce 3.2+ hinzu.

Post by Anonymous »

Ich folge diesem Tutorial von Misha Rudrastyh, um "benutzerdefinierte Felder in WordPress Quick Edit" hinzuzufügen. Ich habe es durch den größten Teil des Tutorials erfolgreich gemacht (Schritt 1, 2 und 3), aber ich habe Probleme im letzten Schritt 4, bei dem ein Skript hinzugefügt wird, um die Felder zu füllen.

Code: Select all

add_action( 'admin_footer', 'min_max_step_desc_quick_edit_populate');
function min_max_step_desc_quick_edit_populate(){
?>

jQuery( function($){
console.log('min max step code is enabled');

const wp_inline_edit_function = inlineEditPost.edit;

// we overwrite the it with our own
inlineEditPost.edit = function( post_id ) {

// let's merge arguments of the original function
wp_inline_edit_function.apply( this, arguments );

// get the post ID from the argument
if ( typeof( post_id ) == 'object' ) { // if it is object, get the ID number
post_id = parseInt( this.getId( post_id ) );
}

// add rows to variables
const edit_row = $( '#edit-' + post_id )
const post_row = $( '#post-' + post_id )

const minQty = $( '.column-min', post_row ).text().substring() //  remove $ sign
const maxQty = $( '.column-max', post_row ).text().substring() //  remove $ sign
const stepQty = $( '.column-step', post_row ).text().substring() //  remove $ sign
const productDesc = $( '.column-desc', post_row ).text().substring() //  remove $ sign

// populate the inputs with column data
$( ':input[name="min"]', edit_row ).val( minQty );
$( ':input[name="max"]', edit_row ).val( maxQty );
$( ':input[name="step"]', edit_row ).val( stepQty );
$( ':input[name="desc"]', edit_row ).val( productDesc );
}
});





Min






Max






Step






Description

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post